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