williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 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 |
* Interface for Series 60 font type, incorporating principles of series 60 layout
|
williamr@4
|
16 |
*
|
williamr@4
|
17 |
*
|
williamr@4
|
18 |
*/
|
williamr@4
|
19 |
|
williamr@4
|
20 |
|
williamr@4
|
21 |
#ifndef AKNLAYOUTFONT_H
|
williamr@4
|
22 |
#define AKNLAYOUTFONT_H
|
williamr@4
|
23 |
|
williamr@4
|
24 |
#include <gdi.h>
|
williamr@4
|
25 |
#include <fbs.h>
|
williamr@4
|
26 |
#include <AknFontSpecification.h>
|
williamr@4
|
27 |
#include <AknTextDecorationMetrics.h>
|
williamr@4
|
28 |
|
williamr@4
|
29 |
class CBitmapDevice;
|
williamr@4
|
30 |
|
williamr@4
|
31 |
/**
|
williamr@4
|
32 |
* This abstract class is a CFbsFont that can update itself (re-bind a font) and has standard
|
williamr@4
|
33 |
* Series 60 layout API available.
|
williamr@4
|
34 |
*
|
williamr@4
|
35 |
* Concrete classes derived from this implement constructors and Update methods that
|
williamr@4
|
36 |
* supply the specification required for the initially, and newly bound font, respectively.
|
williamr@4
|
37 |
* Derived classes must also implement the CreateFont framework method in order to
|
williamr@4
|
38 |
* implement the font binding itself.
|
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 |
NONSHARABLE_CLASS(CAknLayoutFont) : public CFbsFont
|
williamr@4
|
46 |
{
|
williamr@4
|
47 |
|
williamr@4
|
48 |
public:
|
williamr@4
|
49 |
/**
|
williamr@4
|
50 |
* C++ Destructor.
|
williamr@4
|
51 |
*/
|
williamr@4
|
52 |
virtual ~CAknLayoutFont();
|
williamr@4
|
53 |
|
williamr@4
|
54 |
public: // New functions
|
williamr@4
|
55 |
/**
|
williamr@4
|
56 |
* Update this object's binding to a CFbsFont, using the member data of the derived class.
|
williamr@4
|
57 |
* This method only needs to be called if the client owns the CAknLayoutFont
|
williamr@4
|
58 |
* object, and there has been a layout switch that may affect the font.
|
williamr@4
|
59 |
*
|
williamr@4
|
60 |
* It is functionally equivalent to deleting the CAknLayoutFont object, and
|
williamr@4
|
61 |
* reconstructing it with the same parameters.
|
williamr@4
|
62 |
*/
|
williamr@4
|
63 |
IMPORT_C void Update();
|
williamr@4
|
64 |
|
williamr@4
|
65 |
/**
|
williamr@4
|
66 |
* Return the maximum extent of any pixel in the font upwards from the baseline
|
williamr@4
|
67 |
* Measured up, so therefore it is a positive value.
|
williamr@4
|
68 |
*
|
williamr@4
|
69 |
* @return maximum ascent of the font
|
williamr@4
|
70 |
*/
|
williamr@4
|
71 |
IMPORT_C TInt MaxAscent() const;
|
williamr@4
|
72 |
|
williamr@4
|
73 |
/**
|
williamr@4
|
74 |
* Return the maximum extent of any pixel in the font down the baseline
|
williamr@4
|
75 |
* Measured down, so therefore it is usually a positive value.
|
williamr@4
|
76 |
*
|
williamr@4
|
77 |
* @return maximum descent of the font
|
williamr@4
|
78 |
*/
|
williamr@4
|
79 |
IMPORT_C TInt MaxDescent() const;
|
williamr@4
|
80 |
|
williamr@4
|
81 |
/*
|
williamr@4
|
82 |
* Position of the baseline measured down from the Series 60 layout text pane top
|
williamr@4
|
83 |
*
|
williamr@4
|
84 |
* @return distance from text pane top to baseline
|
williamr@4
|
85 |
*/
|
williamr@4
|
86 |
IMPORT_C TInt TextPaneTopToBaseline() const;
|
williamr@4
|
87 |
|
williamr@4
|
88 |
/*
|
williamr@4
|
89 |
* Position of the text pane bottom measured down from the baseline
|
williamr@4
|
90 |
*
|
williamr@4
|
91 |
* @return distance from text pane top to baseline
|
williamr@4
|
92 |
*/
|
williamr@4
|
93 |
IMPORT_C TInt BaselineToTextPaneBottom() const;
|
williamr@4
|
94 |
|
williamr@4
|
95 |
/*
|
williamr@4
|
96 |
* Series 60 text pane height.
|
williamr@4
|
97 |
* Always equal to TextPaneTopToBaseline() + BaselineToTextPaneBottom()
|
williamr@4
|
98 |
*
|
williamr@4
|
99 |
* @return text pane height
|
williamr@4
|
100 |
*/
|
williamr@4
|
101 |
IMPORT_C TInt TextPaneHeight() const;
|
williamr@4
|
102 |
|
williamr@4
|
103 |
/**
|
williamr@4
|
104 |
* This provides the baseline relative to the top of the combined font for a specific
|
williamr@4
|
105 |
* character code. This value does not include any TopShortfall.
|
williamr@4
|
106 |
**/
|
williamr@4
|
107 |
TInt AscentForCharacter( TChar aCharacter ) const;
|
williamr@4
|
108 |
|
williamr@4
|
109 |
/**
|
williamr@4
|
110 |
* Returns if a font pointer cast to this type if the actual type conforms to this type.
|
williamr@4
|
111 |
*
|
williamr@4
|
112 |
* @returns NULL if the font does not conform to CAknLayoutFont.
|
williamr@4
|
113 |
*/
|
williamr@4
|
114 |
IMPORT_C static const CAknLayoutFont* AsCAknLayoutFontOrNull( const CFont* aFont );
|
williamr@4
|
115 |
|
williamr@4
|
116 |
/**
|
williamr@4
|
117 |
* Returns an object describing how the text with this font is to be decorated
|
williamr@4
|
118 |
*
|
williamr@4
|
119 |
* @return text decoration metrics for the font
|
williamr@4
|
120 |
*/
|
williamr@4
|
121 |
IMPORT_C TAknTextDecorationMetrics TextDecorationMetrics() const;
|
williamr@4
|
122 |
|
williamr@4
|
123 |
/**
|
williamr@4
|
124 |
* Returns the Avkon font category (EAknFontCategoryPrimary, EAknFontCategorySecondary...)
|
williamr@4
|
125 |
* that was used to generate this font.
|
williamr@4
|
126 |
*
|
williamr@4
|
127 |
* @return font category
|
williamr@4
|
128 |
*/
|
williamr@4
|
129 |
IMPORT_C TAknFontCategory FontCategory() const;
|
williamr@4
|
130 |
|
williamr@4
|
131 |
/**
|
williamr@4
|
132 |
* This API allows the font to provide the metrics under which the font was requested.
|
williamr@4
|
133 |
*
|
williamr@4
|
134 |
* @return the font specification for which the font has been supplied
|
williamr@4
|
135 |
*/
|
williamr@4
|
136 |
IMPORT_C TAknFontSpecification FontSpecification() const;
|
williamr@4
|
137 |
|
williamr@4
|
138 |
public: // Functions from CFont
|
williamr@4
|
139 |
|
williamr@4
|
140 |
public:// Functions from CFbsFont
|
williamr@4
|
141 |
|
williamr@4
|
142 |
TFontSpec DoFontSpecInTwips() const;
|
williamr@4
|
143 |
|
williamr@4
|
144 |
protected:
|
williamr@4
|
145 |
/**
|
williamr@4
|
146 |
* C++ Constructor.
|
williamr@4
|
147 |
*/
|
williamr@4
|
148 |
CAknLayoutFont( CBitmapDevice& aScreenDevice );
|
williamr@4
|
149 |
CBitmapDevice& BitmapDevice() const;
|
williamr@4
|
150 |
|
williamr@4
|
151 |
protected: // Internal methods
|
williamr@4
|
152 |
|
williamr@4
|
153 |
void SetExcessAscent( TInt aExcessAscent );
|
williamr@4
|
154 |
void SetExcessDescent( TInt aExcessDescent );
|
williamr@4
|
155 |
void SetBottomShortfall( TInt aBottomShortfall );
|
williamr@4
|
156 |
void SetTextPaneHeight( TInt aTextPaneHeight );
|
williamr@4
|
157 |
|
williamr@4
|
158 |
private: // New Framework methods
|
williamr@4
|
159 |
virtual CFbsFont* SupplyFont() = 0;
|
williamr@4
|
160 |
virtual TInt DoAscentForCharacter( TChar aCharacter ) const;
|
williamr@4
|
161 |
virtual TAknTextDecorationMetrics DoTextDecorationMetrics() const = 0;
|
williamr@4
|
162 |
virtual TAknFontSpecification DoFontSpecification() const = 0;
|
williamr@4
|
163 |
virtual void CAknLayoutFont_Reserved_1();
|
williamr@4
|
164 |
|
williamr@4
|
165 |
private:
|
williamr@4
|
166 |
void Register();
|
williamr@4
|
167 |
void Deregister();
|
williamr@4
|
168 |
|
williamr@4
|
169 |
private:
|
williamr@4
|
170 |
|
williamr@4
|
171 |
CFbsFont* iNonDynamicFont;
|
williamr@4
|
172 |
CBitmapDevice& iScreenDevice;
|
williamr@4
|
173 |
TInt iExcessAscent;
|
williamr@4
|
174 |
TInt iExcessDescent;
|
williamr@4
|
175 |
TInt iBottomShortfall;
|
williamr@4
|
176 |
TInt iTextPaneHeight;
|
williamr@4
|
177 |
TInt iSpare;
|
williamr@4
|
178 |
};
|
williamr@4
|
179 |
|
williamr@4
|
180 |
|
williamr@4
|
181 |
#endif //AKNLAYOUTFONT_H
|