2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef AKNTEXTDECORATIONMETRICS_H
20 #define AKNTEXTDECORATIONMETRICS_H
23 #include <AknFontCategory.hrh>
26 class TAknFontSpecification;
27 class TAknWindowComponentLayout;
28 class TAknTextComponentLayout;
31 * This class contains information to decorate a text with highlights, cursors and margins
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.
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.
45 class TAknTextDecorationMetrics
50 * Construct the object with values that are correct for the given font identifier.
52 * @param A Series 60 Font id
54 IMPORT_C TAknTextDecorationMetrics( TInt aFontId );
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.
60 * @param A generic Symbian font object pointer
62 IMPORT_C TAknTextDecorationMetrics( const CFont* aFont );
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
69 * @param A Series 60 font specification
71 IMPORT_C TAknTextDecorationMetrics( const TAknFontSpecification& aFontSpecification );
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)
78 * Values are positive for any normal margin - one that is outside the glyphs area.
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
83 IMPORT_C void GetLeftAndRightMargins( TInt& aLeft, TInt& aRight ) const;
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)
89 * Values are positive for any normal margin - one that is outside the glyphs area.
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
94 IMPORT_C void GetTopAndBottomMargins( TInt& aTop, TInt& aBottom ) const;
97 * Width of the cursor in pixels. This width is to be used when cursor is drawn
98 * rather than an image.
100 * @return Width of the cursor in pixels.
102 IMPORT_C TInt CursorWidth() const;
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
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'
115 * @return Offset distance measured from bottom of glyphs baseline to bottom of underline graphics
117 IMPORT_C TInt BaselineToUnderlineOffset() const;
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.
123 * @return Number of rows pixels in the underline graphics
125 IMPORT_C TInt UnderlineHeight() const;
127 private: // Internal routines for construction
128 void SetMetricsFromSizeAndBoldness(
129 TAknFontCategory aCategory,
132 void SetDefaultMetrics(
133 TAknFontCategory aCategory,
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;
147 TInt16 iBottomMargin;
151 TInt16 iBaselineToUnderlineOffset;
152 TInt16 iUnderlineHeight;