epoc32/include/mw/AknTextDecorationMetrics.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 *
    16 */
    17 
    18 
    19 #ifndef AKNTEXTDECORATIONMETRICS_H
    20 #define AKNTEXTDECORATIONMETRICS_H
    21 
    22 #include <e32std.h>
    23 #include <AknFontCategory.hrh>
    24 
    25 class CFont;
    26 class TAknFontSpecification;
    27 class TAknWindowComponentLayout;
    28 class TAknTextComponentLayout;
    29 
    30 /**
    31 * This class contains information to decorate a text with highlights, cursors and margins
    32 *
    33 * Construction is performed driven by metrics and style derived from the various object that are 
    34 * used in the different contstructors. The metrics used are height, weight, and posture.
    35 * 
    36 * From Series 60 font id, the current layout is accessed to provide metrics and style info.
    37 * From a CFont object, the font's own accessible metrics and styles are accessed (e.g. HeightInPixels())
    38 * From a TFontSpec object, the height and style are extracted via its APIs.
    39 * 
    40 *  @lib avkon.dll
    41 *  @since 2.8
    42 *
    43 *  @internal
    44 */
    45 class TAknTextDecorationMetrics
    46     {
    47 public:
    48     // C++ Constructors
    49     /**
    50     * Construct the object with values that are correct for the given font identifier.
    51     *
    52     * @param    A Series 60 Font id
    53     */
    54     IMPORT_C TAknTextDecorationMetrics( TInt aFontId );
    55 
    56     /**
    57     * Construct the object with values that are correct for the given Symbian Font
    58     * A null pointer passed in will result in a default set of metrics.
    59     *
    60     * @param    A generic Symbian font object pointer
    61     */
    62     IMPORT_C TAknTextDecorationMetrics( const CFont* aFont );
    63 
    64     /**
    65     * Construct the object with values that are correct for the given Series 60 Font Specification.
    66     * This constructor depends upon the font height and boldness being set in the font specifcation 
    67     * object.
    68     *
    69     * @param    A Series 60 font specification
    70     */
    71     IMPORT_C TAknTextDecorationMetrics( const TAknFontSpecification& aFontSpecification );
    72 
    73 public:
    74     /**
    75     * Fetch the values in pixels for the distances reserved for cursor and highlights 
    76     * that extend beyond the font's rendering area (where the glyphs draw)
    77     *
    78     * Values are positive for any normal margin - one that is outside the glyphs area.
    79     *
    80     * @param aLeft   number of extra columns of pixels left of glyphs for additional graphics
    81     * @param aRight   number of extra rows of pixels right of glyphs for additional graphics
    82     */
    83     IMPORT_C void GetLeftAndRightMargins( TInt& aLeft, TInt& aRight ) const;
    84 
    85     /**
    86     * Fetch the values in pixels for the distances reserved for cursor and highlights 
    87     * that extend beyond the font's rendering area (where the glyphs draw)
    88     *
    89     * Values are positive for any normal margin - one that is outside the glyphs area.
    90     *
    91     * @param aTop   number of extra rows of pixels above font ascent for additional graphics
    92     * @param aTop   number of extra rows of pixels below font descent for additional graphics
    93     */
    94     IMPORT_C void GetTopAndBottomMargins( TInt& aTop, TInt& aBottom ) const;
    95 
    96     /**
    97     * Width of the cursor in pixels. This width is to be used when cursor is drawn
    98     * rather than an image.
    99     *
   100     * @return   Width of the cursor in pixels.
   101     */
   102     IMPORT_C TInt CursorWidth() const;
   103 
   104     /**
   105     * Offset distance measured from the bottom of the baseline row of pixels to the 
   106     * bottom of the underline.  E.g. if this method returns 3, and the underline height 
   107     * is 1, then there are 2 pixel rows of gap between the baseline of glyphs and the 
   108     * underline.
   109     * 
   110     * The baseline referred to is the natural baseline of the glyph, not the formal
   111     * baseline reported by the font. To draw the underline, it may be necessary, depending
   112     * on how the font is compounded, to find the baseline (i.e. ascent) of individual character codes'
   113     * glyphs. 
   114     *
   115     * @return   Offset distance measured from bottom of glyphs baseline to bottom of underline graphics
   116     */
   117     IMPORT_C TInt BaselineToUnderlineOffset() const;
   118 
   119     /**
   120     * Height (i.e. thickness) of the drawing of the underline
   121     * Positive for any visible line. e.g. a value of 1, means one row of pixels is drawn.
   122     *
   123     * @return   Number of rows pixels in the underline graphics
   124     */
   125     IMPORT_C TInt UnderlineHeight() const;
   126 
   127 private: // Internal routines for construction
   128     void SetMetricsFromSizeAndBoldness( 
   129         TAknFontCategory aCategory, 
   130         TInt aTextHeight, 
   131         TBool aIsBold );
   132     void SetDefaultMetrics( 
   133         TAknFontCategory aCategory, 
   134         TBool aIsBold );
   135     void GetHighlightLayoutsFromCategory( 
   136         TAknFontCategory aCategory,
   137         TAknWindowComponentLayout& aHighlightParentPane,
   138         TAknTextComponentLayout& aHighlightTextPane,
   139         TAknWindowComponentLayout& aHighlightPane ) const;
   140     void GetCursorLayoutsFromCategory( 
   141         TAknFontCategory aCategory,
   142         TAknWindowComponentLayout& aCursorLayout,
   143         TAknWindowComponentLayout& aCursorLayoutGraphic ) const;
   144 
   145 private:
   146 	TInt16 iTopMargin;
   147 	TInt16 iBottomMargin;
   148 	TInt16 iLeftMargin;
   149 	TInt16 iRightMargin;
   150     TInt16 iCursorWidth;
   151     TInt16 iBaselineToUnderlineOffset;
   152     TInt16 iUnderlineHeight;
   153     TInt16 iSpare;
   154     };
   155 
   156 #endif
   157 // End of File