branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
3:e1b950c65cb4 | 4:837f303aceeb |
---|---|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 /* |
2 // All rights reserved. |
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 // This component and the accompanying materials are made available |
3 * All rights reserved. |
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
4 * This component and the accompanying materials are made available |
5 // which accompanies this distribution, and is available |
5 * under the terms of "Eclipse Public License v1.0" |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 * which accompanies this distribution, and is available |
7 // |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 // Initial Contributors: |
8 * |
9 // Nokia Corporation - initial contribution. |
9 * Initial Contributors: |
10 // |
10 * Nokia Corporation - initial contribution. |
11 // Contributors: |
11 * |
12 // |
12 * Contributors: |
13 // Description: |
13 * |
14 // A header for the open font system, which allows |
14 * Description: |
15 // EPOC32 to use fonts of arbitrary types, including TrueType |
15 * A header for the open font system, which allows SymbianOS |
16 // and other outline font formats. |
16 * to use fonts of arbitrary types, including TrueType/OpenType |
17 // |
17 * and other outline font formats. |
18 // |
18 * |
19 |
19 */ |
20 #ifndef OPENFONT_H__ |
20 |
21 #define OPENFONT_H__ |
21 |
22 #ifndef __OPENFONT_H__ |
|
23 #define __OPENFONT_H__ |
|
22 |
24 |
23 #include <e32base.h> |
25 #include <e32base.h> |
24 #include <gdi.h> |
26 #include <gdi.h> |
25 #include <ecom/ecom.h> |
27 #include <ecom/ecom.h> |
26 |
28 |
29 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
30 #include <linkedfonts.h> |
|
31 #include <graphics/openfontconstants.h> |
|
32 #include <graphics/openfontrasterizer.h> |
|
33 #include <openfontlinkedtypefaceelementspec.h> |
|
34 #include <graphics/openfontlinkedtypefacespecification.h> |
|
35 #include <graphics/openfontlinkedtypefaceextension.h> |
|
36 #endif |
|
27 |
37 |
28 class CFont; |
38 class CFont; |
29 class COpenFontFile; |
39 class COpenFontFile; |
30 class COpenFontGlyph; |
40 class COpenFontGlyph; |
31 class COpenFontGlyphCache; |
41 class COpenFontGlyphCache; |
46 class TShapeHeader; |
56 class TShapeHeader; |
47 class TFontShapeFunctionParameters; |
57 class TFontShapeFunctionParameters; |
48 class TFontShapeDeleteFunctionParameters; |
58 class TFontShapeDeleteFunctionParameters; |
49 class RShapeInfo; |
59 class RShapeInfo; |
50 class TShapeMessageParameters; |
60 class TShapeMessageParameters; |
51 /** |
61 class CRasterizerLinkedTypefaceSpecification; |
52 The OpenFont ECOM Plug-in Interface Definition UID. |
62 class TLinkedTypefaceSpecificationArgs; |
53 |
|
54 @internalTechnology |
|
55 */ |
|
56 const TInt KUidOpenFontRasterizerPlunginInterface = 0x101F7F5D; |
|
57 |
|
58 /** |
|
59 |
|
60 The Shaper Factory ECOM Plug-in Interface Definition UID. |
|
61 |
|
62 @internalTechnology |
|
63 */ |
|
64 const TInt KUidShaperFactoryPlunginInterface = 0x10279726; |
|
65 |
|
66 |
|
67 /** |
|
68 Replacement character code. |
|
69 |
|
70 This is a Unicode private use area codepoint, which is reserved in the Symbian |
|
71 OS to represent characters for which a glyph does not exist in a font (either |
|
72 a bitmap or scalable font). If a glyph exists in a font with this character |
|
73 code, it will be used for nonexistent characters, otherwise, the rasterizer's |
|
74 default replacement character glyph will be used. For example, TrueType fonts |
|
75 return glyph index 0 for nonexistent characters, and that is usually mapped |
|
76 to an empty rectangle. |
|
77 @internalTechnology |
|
78 */ |
|
79 const TUint KReplacementCharacter = 0xF6DB; |
|
80 |
|
81 /** |
|
82 KFillCharacterOffset is a significant offset that is set when a character within a code section is |
|
83 not in the font. This means that for these fill characters nothing is stored within the binary |
|
84 data part of the code section. |
|
85 @internalTechnology |
|
86 */ |
|
87 const TInt KFillCharacterOffset = 0x7FFF; |
|
88 |
63 |
89 /** |
64 /** |
90 Supplied to COpenFont::ExtendedInterface() to access the extended |
65 Supplied to COpenFont::ExtendedInterface() to access the extended |
91 API interface MOpenFontShapingExtension. |
66 API interface MOpenFontShapingExtension. |
92 |
67 |
93 @see COpenFont::ExtendedInterface() |
68 @see COpenFont::ExtendedInterface() |
94 @see MOpenFontShapingExtension |
69 @see MOpenFontShapingExtension |
95 @publishedAll |
70 @publishedAll |
96 @released |
71 @released |
97 */ |
72 */ |
98 const TUid KUidOpenFontShapingExtension = {0x10274DB9}; |
73 const TUid KUidOpenFontShapingExtension = {0x10274DB9}; |
99 |
74 |
100 /** |
75 /** |
101 Supplied to COpenFont::ExtendedInterface() to access the extended |
76 Supplied to COpenFont::ExtendedInterface() to access the extended |
102 API interface MOpenFontTrueTypeExtension. |
77 API interface MOpenFontTrueTypeExtension. |
103 |
78 |
104 @see COpenFont::ExtendedInterface() |
79 @see COpenFont::ExtendedInterface() |
105 @see MOpenFontTrueTypeExtension |
80 @see MOpenFontTrueTypeExtension |
106 @publishedAll |
81 @publishedAll |
107 @released |
82 @released |
108 */ |
83 */ |
109 const TUid KUidOpenFontTrueTypeExtension = {0x1027553E}; |
84 const TUid KUidOpenFontTrueTypeExtension = {0x1027553E}; |
85 const TUid KUidOpenFontGlyphOutlineExtension = {0x102872CE}; |
|
110 |
86 |
111 /** |
87 /** |
112 Supplied to CShaper::ExtendedInterface() to get the language and script |
88 Supplied to CShaper::ExtendedInterface() to get the language and script |
113 code with which the current shaper is instatsiated. |
89 code with which the current shaper is instatsiated. |
114 @see CShaper::ExtendedInterface() |
90 @see CShaper::ExtendedInterface() |
115 @publishedAll |
91 @publishedAll |
116 @released |
92 @released |
117 */ |
93 */ |
118 const TUid KUidShaperGetScript = {0x20009966}; |
94 const TUid KUidShaperGetScript = {0x20009966}; |
119 const TUid KUidShaperGetLang = {0x20009967}; |
95 const TUid KUidShaperGetLang = {0x20009967}; |
120 |
96 |
121 /** |
97 /** |
122 Font metrics. |
98 Font metrics. |
123 |
99 |
124 @see CFbsFont::GetFontMetrics() |
100 @see CFbsFont::GetFontMetrics() |
125 @publishedAll |
101 @publishedAll |
126 @released |
102 @released |
127 */ |
103 */ |
128 class TOpenFontMetrics |
104 class TOpenFontMetrics |
129 { |
105 { |
140 inline void SetAscent(TInt aAscent); |
116 inline void SetAscent(TInt aAscent); |
141 inline void SetDescent(TInt aDescent); |
117 inline void SetDescent(TInt aDescent); |
142 inline void SetMaxHeight(TInt aMaxHeight); |
118 inline void SetMaxHeight(TInt aMaxHeight); |
143 inline void SetMaxDepth(TInt aMaxDepth); |
119 inline void SetMaxDepth(TInt aMaxDepth); |
144 inline void SetMaxWidth(TInt aMaxWidth); |
120 inline void SetMaxWidth(TInt aMaxWidth); |
121 /** WARNING: Function for internal and partner use ONLY. Compatibility is not guaranteed in future releases.*/ |
|
122 IMPORT_C void SetBaselineCorrection(TInt aBaselineCorrection); |
|
123 IMPORT_C TInt BaselineCorrection(); |
|
145 private: |
124 private: |
146 TInt16 iDesignHeight; // size of the font ('pointsize' in pixels) |
125 TInt16 iDesignHeight; // size of the font ('pointsize' in pixels) |
147 TInt16 iAscent; // typographic ascent |
126 TInt16 iAscent; // typographic ascent |
148 TInt16 iDescent; // typographic descent |
127 TInt16 iDescent; // typographic descent |
149 TInt16 iMaxHeight; // maximum height of a character; may be greater than iAscent |
128 TInt16 iMaxHeight; // maximum height of a character; may be greater than iAscent |
150 TInt16 iMaxDepth; // maximum depth of a character; may be greater than iDescent |
129 TInt16 iMaxDepth; // maximum depth of a character; may be greater than iDescent |
151 TInt16 iMaxWidth; // maximum width of a character |
130 TInt16 iMaxWidth; // maximum width of a character |
152 TInt32 iReserved; |
131 TInt16 iBaselineCorrection; |
132 TInt16 iReserved; |
|
153 }; |
133 }; |
154 |
134 |
155 |
135 |
156 /** |
136 /** |
157 Character metrics includes more information than TCharacterMetrics. |
137 Character metrics includes more information than TCharacterMetrics. |
158 |
138 |
159 Character metrics allow characters to be placed horizontally or vertically. |
139 Character metrics allow characters to be placed horizontally or vertically. |
160 The character metrics encapsulated by this class are: Height, Width, Horizontal |
140 The character metrics encapsulated by this class are: Height, Width, Horizontal |
161 Bearing X, Horizontal Bearing Y, Horizontal Advance, Vertical Bearing X, |
141 Bearing X, Horizontal Bearing Y, Horizontal Advance, Vertical Bearing X, |
165 Note : |
145 Note : |
166 |
146 |
167 Vertical drawing (in the sense of characters drawn with horizontal baselines, |
147 Vertical drawing (in the sense of characters drawn with horizontal baselines, |
168 but in a vertical line) is not yet supported by Symbian OS. |
148 but in a vertical line) is not yet supported by Symbian OS. |
169 |
149 |
170 @see CFont::GetCharacterData() |
150 @see CFont::GetCharacterData() |
171 @see CFbsFont::GetCharacterData() |
151 @see CFbsFont::GetCharacterData() |
172 @publishedAll |
152 @publishedAll |
173 @released |
153 @released |
174 */ |
154 */ |
175 class TOpenFontCharMetrics |
155 class TOpenFontCharMetrics |
176 { |
156 { |
177 public: |
157 public: |
178 enum TUninitialized { EUninitialized }; |
158 enum TUninitialized { EUninitialized }; |
179 public: |
159 public: |
180 /** Default constructor initializes all members to 0. */ |
160 /** Default constructor initializes all members to 0. */ |
181 inline TOpenFontCharMetrics(); |
161 inline TOpenFontCharMetrics(); |
182 |
162 |
183 /** Constructor that does not initialize any members. */ |
163 /** Constructor that does not initialize any members. */ |
184 TOpenFontCharMetrics(TUninitialized) {} |
164 TOpenFontCharMetrics(TUninitialized) {} |
185 IMPORT_C TOpenFontCharMetrics(const TCharacterMetrics& aMetrics); |
165 IMPORT_C TOpenFontCharMetrics(const TCharacterMetrics& aMetrics); |
186 IMPORT_C TBool GetTCharacterMetrics(TCharacterMetrics& aMetrics) const; |
166 IMPORT_C TBool GetTCharacterMetrics(TCharacterMetrics& aMetrics) const; |
187 inline TInt Width() const; |
167 inline TInt Width() const; |
188 inline TInt Height() const; |
168 inline TInt Height() const; |
200 inline void SetHorizBearingY(TInt aHorizBearingY); |
180 inline void SetHorizBearingY(TInt aHorizBearingY); |
201 inline void SetHorizAdvance(TInt aHorizAdvance); |
181 inline void SetHorizAdvance(TInt aHorizAdvance); |
202 inline void SetVertBearingX(TInt aVertBearingX); |
182 inline void SetVertBearingX(TInt aVertBearingX); |
203 inline void SetVertBearingY(TInt aVertBearingY); |
183 inline void SetVertBearingY(TInt aVertBearingY); |
204 inline void SetVertAdvance(TInt aVertAdvance); |
184 inline void SetVertAdvance(TInt aVertAdvance); |
185 IMPORT_C void SetGlyphType(TGlyphBitmapType); |
|
186 IMPORT_C TGlyphBitmapType GlyphType() const; |
|
205 private: |
187 private: |
206 TInt16 iWidth; // width of the glyph |
188 TInt16 iWidth; // width of the glyph |
207 TInt16 iHeight; // height of the glyph |
189 TInt16 iHeight; // height of the glyph |
208 TInt16 iHorizBearingX; // x component of horizontal bearing |
190 TInt16 iHorizBearingX; // x component of horizontal bearing |
209 TInt16 iHorizBearingY; // y component of horizontal bearing |
191 TInt16 iHorizBearingY; // y component of horizontal bearing |
210 TInt16 iHorizAdvance; // horizontal advance |
192 TInt16 iHorizAdvance; // horizontal advance |
211 TInt16 iVertBearingX; // x component of vertical bearing |
193 TInt16 iVertBearingX; // x component of vertical bearing |
212 TInt16 iVertBearingY; // y component of vertical bearing |
194 TInt16 iVertBearingY; // y component of vertical bearing |
213 TInt16 iVertAdvance; // vertical advance |
195 TInt16 iVertAdvance; // vertical advance |
214 TInt32 iReserved; |
196 TUint16 iGlyphBitmapType;// Glyph bitmap type; TGlyphBitmapType |
197 TInt16 iReserved; |
|
215 }; |
198 }; |
216 |
199 |
217 |
200 |
218 /** |
201 /** |
219 Font glyph data. |
202 Font glyph data. |
220 |
203 |
221 Objects of this type are used by rasterizers to supply glyph data to font |
204 Objects of this type are used by rasterizers to supply glyph data to font |
222 and bitmap server clients. Unless you are writing a rasterizer you will not |
205 and bitmap server clients. Unless you are writing a rasterizer you will not |
223 need to use an object of this type. |
206 need to use an object of this type. |
224 |
207 |
225 The object cannot be constructed and destroyed by normal means. It resides |
208 The object cannot be constructed and destroyed by normal means. It resides |
226 on a specified heap. It is created by New() and deleted by RHeap::Free(). |
209 on a specified heap. It is created by New() and deleted by RHeap::Free(). |
227 |
210 |
228 @see COpenFont::RasterizeL() |
211 @see COpenFont::RasterizeL() |
229 @publishedAll |
212 @publishedAll |
230 @released |
213 @released |
231 */ |
214 */ |
232 class TOpenFontGlyphData |
215 class TOpenFontGlyphData |
233 { |
216 { |
267 TUint8 iBitmapBuffer[1]; // buffer used to write the bitmap when it is first rasterized; this |
250 TUint8 iBitmapBuffer[1]; // buffer used to write the bitmap when it is first rasterized; this |
268 // is actually of size iBitmapBufferSize. |
251 // is actually of size iBitmapBufferSize. |
269 }; |
252 }; |
270 |
253 |
271 class COpenFontGlyph; |
254 class COpenFontGlyph; |
272 class CLinkedFontInformation; |
255 /** |
273 /** |
|
274 Open Font System font abstract base class. |
256 Open Font System font abstract base class. |
275 |
257 |
276 Derive a class from this class to represent an instance of a typeface at a |
258 Derive a class from this class to represent an instance of a typeface at a |
277 particular size, provide bitmaps of the glyphs, and determine whether |
259 particular size, provide bitmaps of the glyphs, and determine whether |
278 characters exist in the typeface. |
260 characters exist in the typeface. |
292 Derived classes must implement the pure virtual function RasterizeL(). |
274 Derived classes must implement the pure virtual function RasterizeL(). |
293 Information about this function is provided in the function definition below. |
275 Information about this function is provided in the function definition below. |
294 |
276 |
295 Information about deriving from this class is also provided in the API guide. |
277 Information about deriving from this class is also provided in the API guide. |
296 |
278 |
297 @see COpenFontFile::GetNearestFontInPixelsL() |
279 @see COpenFontFile::GetNearestFontInPixelsL() |
298 @publishedAll |
280 @publishedAll |
299 @released |
281 @released |
300 */ |
282 */ |
301 class COpenFont: public CBase |
283 class COpenFont: public CBase |
302 { |
284 { |
303 public: |
285 public: |
304 /** Creates a bitmap for the specified Unicode character. |
286 /** Creates a bitmap for the specified Unicode character. |
305 |
287 |
306 Implementations of this function should put the bitmap in |
288 Implementations of this function should put the bitmap in |
307 aGlyphData->iBitmapBuffer, and the character metrics are placed in |
289 aGlyphData->iBitmapBuffer, and the character metrics are placed in |
308 aGlyphData->iMetricsBuffer. The other parts of aGlyphData should be left |
290 aGlyphData->iMetricsBuffer. The other parts of aGlyphData should be left |
309 alone. |
291 alone. |
310 |
292 |
311 There are a number of strategies for achieving this, e.g. pass the |
293 There are a number of strategies for achieving this, e.g. pass the |
312 rasterization task all the way up to the rasterizer engine. These are |
294 rasterization task all the way up to the rasterizer engine. These are |
313 discussed in the API guide. |
295 discussed in the API guide. |
314 |
296 |
315 At present you must write the bitmap in the Symbian platform's |
297 At present you must write the bitmap in the Symbian platform's |
316 run-length-encoded format. This is a packed binary format starting on a |
298 run-length-encoded format. This is a packed binary format starting on a |
317 byte boundary and made up of a number of sections. Each section starts |
299 byte boundary and made up of a number of sections. Each section starts |
318 with a five-bit header. If the first bit of the header is 0 the next four |
300 with a five-bit header. If the first bit of the header is 0 the next four |
319 bits are a repeat count, starting with the least significant bit, and a |
301 bits are a repeat count, starting with the least significant bit, and a |
320 single row of bits (the number of bits in a row is specified by |
302 single row of bits (the number of bits in a row is specified by |
321 aGlyphData->iMetricsBuffer.Width()) follows. If the first bit of the header |
303 aGlyphData->iMetricsBuffer.Width()) follows. If the first bit of the header |
322 is 1 the next four bits are a count of non-repeating rows, again starting |
304 is 1 the next four bits are a count of non-repeating rows, again starting |
323 with the least significant bit, and that many rows of bits follow. |
305 with the least significant bit, and that many rows of bits follow. |
324 |
306 |
325 @param aCode The character code of the Unicode character for which the |
307 @param aCode The character code of the Unicode character for which the |
326 bitmap is required. |
308 bitmap is required. |
327 @param aGlyphData On return, contains a pointer to a TOpenFontGlyphData |
309 @param aGlyphData On return, contains a pointer to a TOpenFontGlyphData |
328 containing the character's bitmap and metrics. */ |
310 containing the character's bitmap and metrics. */ |
329 virtual void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0; |
311 virtual void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0; |
354 inline TInt FontStandardDescent() const; |
336 inline TInt FontStandardDescent() const; |
355 inline TInt FontMaxDescent() const; |
337 inline TInt FontMaxDescent() const; |
356 inline TInt FontLineGap() const; |
338 inline TInt FontLineGap() const; |
357 inline TInt FontMaxHeight() const; |
339 inline TInt FontMaxHeight() const; |
358 void DeleteShaper() const; |
340 void DeleteShaper() const; |
341 TInt GetFontTable(TUint32 aTag, TAny*& aTableContent, TInt& aLength); |
|
342 TInt GetGlyphOutline(TUint aCode, TBool aHinted, TAny*& aOutline, TInt& aLength); |
|
343 |
|
344 protected: |
|
345 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
346 */ |
|
347 TInt PointerToThisOffset(const TAny* aAny); |
|
348 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
349 */ |
|
350 TAny* ThisOffsetToPointer(const TInt aOffset); |
|
351 |
|
359 protected: |
352 protected: |
360 RHeap* iHeap; |
353 RHeap* iHeap; |
361 TOpenFontMetrics iMetrics; |
354 TOpenFontMetrics iMetrics; |
362 private: |
355 private: |
363 /** The shaper for performing complex character positioning and |
356 /** The shaper for performing complex character positioning and |
364 substitution, if available. Null otherwise. |
357 substitution, if available. Null otherwise. |
365 @internalComponent */ |
358 |
359 WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. |
|
360 */ |
|
366 CShaper* iShaper; |
361 CShaper* iShaper; |
367 |
362 |
368 protected: |
363 protected: |
369 /** The positive distance in pixels from the baseline to |
364 /** The positive distance in pixels from the baseline to |
370 the top of an ANSI capital (whether or not there are |
365 the top of an ANSI capital (whether or not there are |
371 ANSI capitals in the font) */ |
366 ANSI capitals in the font) */ |
372 TInt iFontCapitalAscent; |
367 TInt iFontCapitalAscent; |
373 /** The positive distance in pixels from the baseline to |
368 /** The positive distance in pixels from the baseline to |
374 the top of the highest pre-composed glyph in the font */ |
369 the top of the highest pre-composed glyph in the font */ |
375 TInt iFontMaxAscent; |
370 TInt iFontMaxAscent; |
376 /** The positive distance in pixels from the baseline to |
371 /** The positive distance in pixels from the baseline to |
377 the bottom of the lowest ANSI descender (whether or |
372 the bottom of the lowest ANSI descender (whether or |
378 not there are ANSI chars in the font)*/ |
373 not there are ANSI chars in the font)*/ |
379 TInt iFontStandardDescent; |
374 TInt iFontStandardDescent; |
380 /** The positive distance in pixels from the baseline to |
375 /** The positive distance in pixels from the baseline to |
381 the bottom of the lowest pre-composed glyph in the font */ |
376 the bottom of the lowest pre-composed glyph in the font */ |
382 TInt iFontMaxDescent; |
377 TInt iFontMaxDescent; |
383 /** The recommended baseline to baseline gap for successive |
378 /** The recommended baseline to baseline gap for successive |
384 lines of text in the font */ |
379 lines of text in the font */ |
385 TInt iFontLineGap; |
380 TInt iFontLineGap; |
386 private: |
381 private: |
387 const COpenFontGlyph* Glyph(TInt aSessionHandle,TInt aCode) const; |
382 const COpenFontGlyph* Glyph(TInt aSessionHandle,TInt aCode) const; |
388 protected: |
383 protected: |
389 /** |
384 |
390 @internalTechnology |
385 /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
391 */ |
386 */ |
392 const COpenFontGlyph* FontCacheGlyph(TInt aCode,COpenFontGlyphTreeEntry**& aNode); |
387 const COpenFontGlyph* FontCacheGlyph(TInt aCode,TInt*& aNode); |
393 private: |
388 const COpenFontGlyph* FontCacheGlyph(TInt aCode); |
389 |
|
390 void SetGlyphCache(COpenFontGlyphCache* aGlyphCache); |
|
391 |
|
392 private: |
|
394 const COpenFontGlyph* SessionCacheGlyph(RHeap* aHeap,TInt aSessionHandle,TInt aCode, |
393 const COpenFontGlyph* SessionCacheGlyph(RHeap* aHeap,TInt aSessionHandle,TInt aCode, |
395 COpenFontSessionCache*& aCache,TInt& aIndex,TBool aCreate) const; |
394 COpenFontSessionCache*& aCache,TInt& aIndex,TBool aCreate) const; |
396 void RasterizeHelperL(TInt aCode,TOpenFontGlyphData* aGlyphData,TOpenFontGlyphData*& aTempGlyphData); |
395 void RasterizeHelperL(TInt aCode,TOpenFontGlyphData* aGlyphData,TOpenFontGlyphData*& aTempGlyphData); |
396 |
|
397 COpenFontSessionCacheList* SessionCacheList()const; |
|
398 |
|
399 void SetSessionCacheList(COpenFontSessionCacheList* aSessionCacheList); |
|
400 |
|
401 void SetFile(COpenFontFile* aFile); |
|
397 private: |
402 private: |
398 COpenFontFile* iFile; // the file used by this font; null if it has been deleted |
403 |
399 // or cannot be used |
404 // Offset from the address of the file used by this font. |
405 // If the file has been deleted or cannot be used, the offest will be zero. |
|
406 TInt iFileOffset; |
|
407 |
|
400 TInt iFaceIndex; // index of the face in the font file |
408 TInt iFaceIndex; // index of the face in the font file |
401 protected: |
409 protected: |
402 /** |
410 /** |
403 @internalTechnology |
411 WARNING: Compatibility is not guaranteed in future releases. Please use the provided APIs only. |
404 */ |
412 Offset from the address of this font of the per-font glyph cache which is owned by the font |
405 COpenFontGlyphCache* iGlyphCache; // the per-font glyph cache; owned by the font |
413 @internalTechnology |
406 private: |
414 */ |
407 COpenFontSessionCacheList* iSessionCacheList; // the list of per-session glyph caches; owned by CFontStore |
415 TInt iGlyphCacheOffset; |
416 private: |
|
417 // Offset from the address of this font of the list of per-session glyph |
|
418 // caches which are owned by CFontStore |
|
419 TInt iSessionCacheListOffset; |
|
420 |
|
408 TAny* iReserved; // unused; for future expansion |
421 TAny* iReserved; // unused; for future expansion |
409 }; |
422 }; |
410 |
423 |
411 /** Open Font System Extension Interface abstract base class. |
424 /** Open Font System Extension Interface abstract base class. |
412 |
425 |
415 |
428 |
416 This interface should be returned by the overridden |
429 This interface should be returned by the overridden |
417 COpenFont::ExtendedInterface function when KUidOpenFontShapingExtension is |
430 COpenFont::ExtendedInterface function when KUidOpenFontShapingExtension is |
418 supplied as the UID. |
431 supplied as the UID. |
419 |
432 |
420 @see COpenFont |
433 @see COpenFont |
421 @see KUidOpenFontShapingExtension |
434 @see KUidOpenFontShapingExtension |
422 @publishedAll |
435 @publishedAll |
423 @released |
436 @released |
424 */ |
437 */ |
425 class MOpenFontShapingExtension |
438 class MOpenFontShapingExtension |
426 { |
439 { |
456 This function provides the same functionality as the |
469 This function provides the same functionality as the |
457 COpenFont::RasterizeL() except that the glyph code is supplied rather than |
470 COpenFont::RasterizeL() except that the glyph code is supplied rather than |
458 the unicode. |
471 the unicode. |
459 |
472 |
460 For more information: |
473 For more information: |
461 @see COpenFont::RasterizeL() |
474 @see COpenFont::RasterizeL() |
462 |
475 |
463 @param aCode |
476 @param aCode The glyph code of the character for which the bitmap is required. |
464 The glyph code of the character for which the bitmap is required. |
477 @param aGlyphData The function puts its output here. |
465 @param aGlyphData |
|
466 The function puts its output here. |
|
467 */ |
478 */ |
468 virtual void RasterizeGlyphL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0; |
479 virtual void RasterizeGlyphL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0; |
469 |
480 |
470 /** Maps a character to a glyph index. |
481 /** Maps a character to a glyph index. |
471 @param aUnicodeCharacter Unicode character code to be mapped. |
482 @param aUnicodeCharacter Unicode character code to be mapped. |
505 This class will be used by |
516 This class will be used by |
506 |
517 |
507 This interface should be returned by the overridden |
518 This interface should be returned by the overridden |
508 COpenFont::ExtendedInterface function when KUidOpenFontTrueTypeExtension is |
519 COpenFont::ExtendedInterface function when KUidOpenFontTrueTypeExtension is |
509 supplied as the UID. |
520 supplied as the UID. |
510 @see KUidOpenFontTrueTypeExtension |
521 @see KUidOpenFontTrueTypeExtension |
511 @publishedAll |
522 @publishedAll |
512 @released |
523 @released |
513 */ |
524 */ |
514 class MOpenFontTrueTypeExtension |
525 class MOpenFontTrueTypeExtension |
515 { |
526 { |
541 @param aTag The tag of the table as for GetTrueTypeTable. |
552 @param aTag The tag of the table as for GetTrueTypeTable. |
542 @return True if the table exists in the font file, false otherwise. |
553 @return True if the table exists in the font file, false otherwise. |
543 @see GetTrueTypeTable */ |
554 @see GetTrueTypeTable */ |
544 virtual TBool HasTrueTypeTable(TUint32 aTag) = 0; |
555 virtual TBool HasTrueTypeTable(TUint32 aTag) = 0; |
545 }; |
556 }; |
546 |
557 |
558 class MOpenFontGlyphOutlineExtension |
|
559 { |
|
560 public: |
|
561 virtual TInt GetGlyphOutline(TUint aCode, TBool aIsGlyphId, |
|
562 TBool aHinted, TAny*& aOutline, TInt& aLength) = 0; |
|
563 }; |
|
547 /** |
564 /** |
548 Font attribute base class. |
565 Font attribute base class. |
549 |
566 |
550 This class is not intended for user derivation. |
567 This class is not intended for user derivation. |
551 |
568 |
552 @see TOpenFontFaceAttrib |
569 @see TOpenFontFaceAttrib |
553 @see TOpenFontSpec |
570 @see TOpenFontSpec |
554 @publishedAll |
571 @publishedAll |
555 @released |
572 @released |
556 */ |
573 */ |
557 class TOpenFontFaceAttribBase |
574 class TOpenFontFaceAttribBase |
558 { |
575 { |
577 inline void SetItalic(TBool aItalic); |
594 inline void SetItalic(TBool aItalic); |
578 inline void SetSerif(TBool aSerif); |
595 inline void SetSerif(TBool aSerif); |
579 inline void SetMonoWidth(TBool aMonoWidth); |
596 inline void SetMonoWidth(TBool aMonoWidth); |
580 inline TBool operator==(const TOpenFontFaceAttribBase& aAttrib) const; |
597 inline TBool operator==(const TOpenFontFaceAttribBase& aAttrib) const; |
581 |
598 |
582 // Unicode ranges for iCoverage[0] (incomplete; see the TrueType documentation for other values) |
599 // Unicode ranges for iCoverage[0] (see the TrueType documentation for other values which are not included) |
583 enum |
600 enum |
584 { |
601 { |
585 ELatinSet = 0x1, // 0000-007F |
602 ELatinSet = 0x1, // 0000-007F |
586 EGreekSet = 0x80, // 0370-03FF |
603 EGreekSet = 0x80, // 0370-03FF |
587 ECyrillicSet = 0x200, // 0400-04FF |
604 ECyrillicSet = 0x200, // 0400-04FF |
634 // in the OS/2 table in TrueType fonts |
651 // in the OS/2 table in TrueType fonts |
635 TInt iStyle; // bold, italic serif, and mono-width |
652 TInt iStyle; // bold, italic serif, and mono-width |
636 TInt32 iReserved; |
653 TInt32 iReserved; |
637 }; |
654 }; |
638 |
655 |
639 |
656 |
640 /** |
657 /** |
641 Typeface attributes. |
658 Typeface attributes. |
642 |
659 |
643 These attributes include the name, family name, and supported scripts. |
660 These attributes include the name, family name, and supported scripts. |
644 |
661 |
645 @see CFbsFont::GetFaceAttrib() |
662 @see CFbsFont::GetFaceAttrib() |
646 @publishedAll |
663 @publishedAll |
647 @released |
664 @released |
648 */ |
665 */ |
649 class TOpenFontFaceAttrib: public TOpenFontFaceAttribBase |
666 class TOpenFontFaceAttrib: public TOpenFontFaceAttribBase |
650 { |
667 { |
671 TBufC<ENameLength> iLocalFamilyName; // the family name in the language of the current locale |
688 TBufC<ENameLength> iLocalFamilyName; // the family name in the language of the current locale |
672 TInt iMinSizeInPixels; // minimum supported size, (or readable size if scalable) in pixels |
689 TInt iMinSizeInPixels; // minimum supported size, (or readable size if scalable) in pixels |
673 TInt32 iReserved2; |
690 TInt32 iReserved2; |
674 }; |
691 }; |
675 |
692 |
676 |
693 |
677 /** |
694 /** |
678 Font specification allowing more attributes to be specified than TFontSpec. |
695 Font specification allowing more attributes to be specified than TFontSpec. |
679 |
696 |
680 In addition to the attributes specified by TFontSpec, this font specification |
697 In addition to the attributes specified by TFontSpec, this font specification |
681 allows stretching and slanting in the x dimension, and other algorithmic effects. |
698 allows stretching and slanting in the x dimension, and other algorithmic effects. |
682 This is used to correct for non-square pixels, and to allow algorithmic slanting |
699 This is used to correct for non-square pixels, and to allow algorithmic slanting |
716 inline void SetEffects(TUint32 aEffects); |
733 inline void SetEffects(TUint32 aEffects); |
717 IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn); |
734 IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn); |
718 IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const; |
735 IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const; |
719 IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage); |
736 IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage); |
720 IMPORT_C TInt ScriptTypeForMetrics() const; |
737 IMPORT_C TInt ScriptTypeForMetrics() const; |
721 static TBool IsCompensationForAspectRatioNeeded(TInt aPixelWidth, TInt aPixelHeight, TReal& aRatio); |
738 static TBool IsCompensationForAspectRatioNeeded(TInt aPixelWidth, TInt aPixelHeight); |
739 static TInt ApplyRatio(TInt& aValue,TInt aNumerator,TInt aDenominator); |
|
740 static TInt ApplyRatio(TInt32& aValue,TInt aNumerator,TInt aDenominator); |
|
722 public: |
741 public: |
723 /** Algorithmic effects flags. |
742 /** Algorithmic effects flags. |
724 |
743 |
725 These can be combined using an OR operation. |
744 These can be combined using an OR operation. |
726 @publishedPartner For use by system/UI software. |
745 |
746 WARNING: Enum for internal and partner use ONLY. Compatibility is not guaranteed in future releases. |
|
747 |
|
727 @deprecated Use FontEffect::TEffect instead. |
748 @deprecated Use FontEffect::TEffect instead. |
728 */ |
749 */ |
729 enum |
750 enum |
730 { |
751 { |
731 /** Font is algorithmic bold. */ |
752 /** Font is algorithmic bold. */ |
754 |
775 |
755 TInt iReserved2; |
776 TInt iReserved2; |
756 }; |
777 }; |
757 |
778 |
758 /** |
779 /** |
759 Constants for attachment points for diacritics. |
|
760 @internalComponent |
|
761 */ |
|
762 enum TOpenFontAttachment |
|
763 { |
|
764 EBaselineLeft, |
|
765 EBaselineRight, |
|
766 ETopLeft, |
|
767 ETopCenter, |
|
768 ETopRight, |
|
769 EBottomLeft, |
|
770 EBottomCenter, |
|
771 EBottomRight |
|
772 }; |
|
773 |
|
774 |
|
775 |
|
776 /** |
|
777 Font file abstract base class. |
780 Font file abstract base class. |
778 |
781 |
779 Write a class derived from COpenFontFile to manage a file with the font format |
782 Write a class derived from COpenFontFile to manage a file with the font format |
780 supported by your DLL. The derived class must implement the virtual |
783 supported by your DLL. The derived class must implement the virtual |
781 GetNearestFontInPixelsL() function. This function takes a font description |
784 GetNearestFontInPixelsL() function. This function takes a font description |
804 Derived classes must also implement the two pure virtual functions |
807 Derived classes must also implement the two pure virtual functions |
805 GetNearestFontInPixelsL() and HasUnicodeCharacterL(). Information about |
808 GetNearestFontInPixelsL() and HasUnicodeCharacterL(). Information about |
806 these functions is provided in the definitions below. Information about |
809 these functions is provided in the definitions below. Information about |
807 deriving from this class is also provided in the API guide. |
810 deriving from this class is also provided in the API guide. |
808 |
811 |
809 @see COpenFontRasterizer::NewFontFileL() |
812 @see COpenFontRasterizer::NewFontFileL() |
810 @see CWsScreenDevice::AddFile() |
813 @see CWsScreenDevice::AddFile() |
811 @publishedAll |
814 @publishedAll |
812 @released |
815 @released |
813 */ |
816 */ |
814 class COpenFontFile : public CBase |
817 class COpenFontFile : public CBase |
815 { |
818 { |
826 the COpenFont constructor. |
829 the COpenFont constructor. |
827 |
830 |
828 Implementations may use the utility function GetNearestFontHelper() |
831 Implementations may use the utility function GetNearestFontHelper() |
829 to get the attributes of the closest matching font. |
832 to get the attributes of the closest matching font. |
830 |
833 |
831 @param aHeap Shared heap. This value should be passed to the COpenFont derived |
834 @param aHeap Shared heap. This value should be passed to the |
832 classes' constructor. |
835 COpenFont derived classes' constructor. |
833 @param aSessionCacheList The session cache list. This value should be passed |
836 @param aSessionCacheList The session cache list. This value should be passed |
834 to the COpenFont derived classes' constructor. |
837 to the COpenFont derived classes' constructor. |
835 @param aDesiredFontSpec The desired font specification. |
838 @param aDesiredFontSpec The desired font specification. |
836 @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating |
839 @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating |
837 the algorithmic slant of the typeface. |
840 the algorithmic slant of the typeface. |
838 @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating |
841 @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating |
839 the algorithmic slant of the typeface. |
842 the algorithmic slant of the typeface. |
840 @param aFont On return, contains a pointer to the newly created COpenFont |
843 @param aFont On return, contains a pointer to the newly created COpenFont |
841 derived object, or NULL if no font matching aDesiredFontSpec exists. |
844 derived object, or NULL if no font matching aDesiredFontSpec exists. |
842 @param aActualFontSpec The actual font specification of the font retrieved |
845 @param aActualFontSpec The actual font specification of the font retrieved into aFont. |
843 into aFont. |
846 @see GetNearestFontHelper() |
844 @publishedAll |
|
845 @see GetNearestFontHelper() |
|
846 */ |
847 */ |
847 virtual void GetNearestFontInPixelsL( |
848 virtual void GetNearestFontInPixelsL( |
848 RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList, |
849 RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList, |
849 const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight, |
850 const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight, |
850 COpenFont*& aFont, TOpenFontSpec& aActualFontSpec) = 0; |
851 COpenFont*& aFont, TOpenFontSpec& aActualFontSpec) = 0; |
861 the COpenFont constructor. |
862 the COpenFont constructor. |
862 |
863 |
863 Implementations may use the utility function GetNearestFontHelper() |
864 Implementations may use the utility function GetNearestFontHelper() |
864 to get the attributes of the closest matching font. |
865 to get the attributes of the closest matching font. |
865 |
866 |
866 @param aHeap Shared heap. This value should be passed to the COpenFont derived |
867 @param aHeap Shared heap. This value should be passed to the COpenFont |
867 classes' constructor. |
868 derived classes' constructor. |
868 @param aSessionCacheList The session cache list. This value should be passed |
869 @param aSessionCacheList The session cache list. This value should be passed |
869 to the COpenFont derived classes' constructor. |
870 to the COpenFont derived classes' constructor. |
870 @param aDesiredFontSpec The desired font specification. |
871 @param aDesiredFontSpec The desired font specification. |
871 @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating |
872 @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating |
872 the algorithmic slant of the typeface. |
873 the algorithmic slant of the typeface. |
873 @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating |
874 @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating |
874 the algorithmic slant of the typeface. |
875 the algorithmic slant of the typeface. |
875 @param aFont On return, contains a pointer to the newly created COpenFont |
876 @param aFont On return, contains a pointer to the newly created COpenFont |
876 derived object, or NULL if no font matching aDesiredFontSpec exists. |
877 derived object, or NULL if no font matching aDesiredFontSpec exists. |
877 @param aActualFontSpec The actual font specification of the font retrieved |
878 @param aActualFontSpec The actual font specification of the font retrieved into aFont. |
878 into aFont. |
879 @see GetNearestFontHelper() |
879 @publishedAll |
|
880 @see GetNearestFontHelper() |
|
881 */ |
880 */ |
882 virtual void GetNearestFontToDesignHeightInPixelsL( |
881 virtual void GetNearestFontToDesignHeightInPixelsL( |
883 RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/, |
882 RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/, |
884 const TOpenFontSpec& /*aDesiredFontSpec*/, TInt /*aPixelWidth*/, TInt /*aPixelHeight*/, |
883 const TOpenFontSpec& /*aDesiredFontSpec*/, TInt /*aPixelWidth*/, TInt /*aPixelHeight*/, |
885 COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/) {} |
884 COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/) {} |
895 the COpenFont constructor. |
894 the COpenFont constructor. |
896 |
895 |
897 Implementations may use the utility function GetNearestFontHelper() |
896 Implementations may use the utility function GetNearestFontHelper() |
898 to get the attributes of the closest matching font. |
897 to get the attributes of the closest matching font. |
899 |
898 |
900 @param aHeap Shared heap. This value should be passed to the COpenFont derived |
899 @param aHeap Shared heap. This value should be passed to the COpenFont |
901 classes' constructor. |
900 derived classes' constructor. |
902 @param aSessionCacheList The session cache list. This value should be passed |
901 @param aSessionCacheList The session cache list. This value should be passed |
903 to the COpenFont derived classes' constructor. |
902 to the COpenFont derived classes' constructor. |
904 @param aDesiredFontSpec The desired font specification. |
903 @param aDesiredFontSpec The desired font specification. |
905 @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating |
904 @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating |
906 the algorithmic slant of the typeface. |
905 the algorithmic slant of the typeface. |
907 @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating |
906 @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating |
908 the algorithmic slant of the typeface. |
907 the algorithmic slant of the typeface. |
909 @param aFont On return, contains a pointer to the newly created COpenFont |
908 @param aFont On return, contains a pointer to the newly created COpenFont |
910 derived object, or NULL if no font matching aDesiredFontSpec exists. |
909 derived object, or NULL if no font matching aDesiredFontSpec exists. |
911 @param aActualFontSpec The actual font specification of the font retrieved |
910 @param aActualFontSpec The actual font specification of the font retrieved into aFont. |
912 into aFont. |
911 @param aMaxHeight The maximum height (vertical extent) within which the font must fit. |
913 @param aMaxHeight The maximum height within which the font must fit. |
912 @see GetNearestFontHelper() |
914 @publishedAll |
|
915 @see GetNearestFontHelper() |
|
916 */ |
913 */ |
917 virtual void GetNearestFontToMaxHeightInPixelsL( |
914 virtual void GetNearestFontToMaxHeightInPixelsL( |
918 RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/, |
915 RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/, |
919 const TOpenFontSpec& /*aDesiredFontSpec*/, TInt /*aPixelWidth*/, TInt /*aPixelHeight*/, |
916 const TOpenFontSpec& /*aDesiredFontSpec*/, TInt /*aPixelWidth*/, TInt /*aPixelHeight*/, |
920 COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/, TInt /*aMaxHeight*/) {} |
917 COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/, TInt /*aMaxHeight*/) {} |
921 |
918 |
922 /** Tests whether a specified typeface contains a particular character. |
919 /** Tests whether a specified typeface contains a particular character. |
923 |
920 |
924 @param aFaceIndex The index of the typeface to be tested. |
921 @param aFaceIndex The index of the typeface to be tested. |
925 @param aCode The Unicode character code for the character to be tested. |
922 @param aCode The Unicode character code for the character to be tested. |
926 @return ETrue if the typeface contains aCode, otherwise EFalse. */ |
923 @return ETrue if the typeface contains aCode, otherwise EFalse. */ |
927 virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const = 0; |
924 virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const = 0; |
928 IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam); |
925 IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam); |
929 IMPORT_C COpenFontFile(TInt aUid,const TDesC& aFileName); |
926 IMPORT_C COpenFontFile(TInt aUid,const TDesC& aFileName); |
930 IMPORT_C ~COpenFontFile(); |
927 IMPORT_C ~COpenFontFile(); |
931 IMPORT_C TBool GetNearestFontHelper(const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight, |
928 IMPORT_C TBool GetNearestFontHelper(const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight, |
958 TInt& aFaceIndex,TOpenFontSpec& aActualFontSpec) const; |
955 TInt& aFaceIndex,TOpenFontSpec& aActualFontSpec) const; |
959 private: |
956 private: |
960 // A class to contain the public font attributes and private positioning information (for kerning, ligatures, etc.) |
957 // A class to contain the public font attributes and private positioning information (for kerning, ligatures, etc.) |
961 class TAttrib: public TOpenFontFaceAttrib |
958 class TAttrib: public TOpenFontFaceAttrib |
962 { |
959 { |
963 public: |
960 public: |
964 COpenFontPositioner* iPositioner; // if non-null, positioning information for the typeface |
961 COpenFontPositioner* iPositioner; // if non-null, positioning information for the typeface |
965 }; |
962 }; |
966 static TInt ScoreByName(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib); |
963 static TInt ScoreByName(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib); |
967 static TInt ScoreByStyle(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib); |
964 static TInt ScoreByStyle(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib); |
968 void GetNearestFontToDesignHeightInPixelsAndAddToListL( |
965 void GetNearestFontToDesignHeightInPixelsAndAddToListL( |
981 TInt iRefCount; |
978 TInt iRefCount; |
982 CArrayPtrFlat<COpenFont> iFontList; |
979 CArrayPtrFlat<COpenFont> iFontList; |
983 TOpenFontFileData* iData; |
980 TOpenFontFileData* iData; |
984 }; |
981 }; |
985 |
982 |
986 |
983 /** |
987 /** |
|
988 The Open Font rasterizer plug-in Interface Definition class. |
|
989 |
|
990 This interface allows the implementation of an Open Font rasterizer plug-in, |
|
991 which can then be dynamically loaded at run time by the ECOM plug-in framework. |
|
992 The plug-in implementation is instantiated by calling NewL(), passing the implementation |
|
993 UID so that ECOM can instantiate the correct implementation. |
|
994 |
|
995 The rasterizer interface declares a single pure virtual functions, which the |
|
996 plug-in derived from this interface must implement. The function reads font files, and creates |
|
997 a COpenFontFile object if the font file is of the right type. |
|
998 |
|
999 Writing derived classes: |
|
1000 |
|
1001 Open font rasterizers should derive from this class and implement the |
|
1002 NewFontFileL() function. |
|
1003 |
|
1004 Derived classes should also define the factory function. It is a static function |
|
1005 which takes no arguments. It creates a COpenFontRasterizer derived object on the heap, and returns it |
|
1006 to the caller. This factory function, together with the implementation UID will form |
|
1007 the TImplementationProxy used by the ECOM framework to instatiate the plug-in. |
|
1008 |
|
1009 The rasterizer class may also need to store an 'engine context'. This is an |
|
1010 object derived from COpenFontRasterizerContext, which provides functions that |
|
1011 make it easier to write the glyph bitmap during rasterization. |
|
1012 |
|
1013 |
|
1014 @publishedAll |
|
1015 @released |
|
1016 */ |
|
1017 class COpenFontRasterizer: public CBase |
|
1018 { |
|
1019 public: |
|
1020 /** Creates a COpenFontFile derived object for loading font files in the |
|
1021 new format. |
|
1022 |
|
1023 This function is called by the framework during font and bitmap server |
|
1024 startup. It creates a font file object for font files in the \\resource\\fonts |
|
1025 directory on all drives, using the default search path. The first font of |
|
1026 a given name overrides subsequent ones. The directory search path is soft |
|
1027 to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added |
|
1028 dynamically after startup using CWsScreenDevice::AddFile(), which |
|
1029 indirectly calls this function. |
|
1030 |
|
1031 Implementations of this function should examine the file aFileName, and if |
|
1032 it is of the correct type attempt to create a COpenFontFile derived object |
|
1033 to load it. The caller is responsible for deleting the object. The function |
|
1034 must return NULL if it cannot recognise the file, and it may also leave if |
|
1035 there is an error. |
|
1036 |
|
1037 @param aUid An ID to be used for the file. UIDs are required by the font |
|
1038 framework, so the font store allocates them for non Symbian OS-native font |
|
1039 files. This ID persists until the font is unloaded, e.g. if the device is |
|
1040 rebooted. |
|
1041 @param aFileName The full path and filename of the file from which the |
|
1042 COpenFontFile object is created, if the file is the correct type. |
|
1043 @param aFileSession The file session owned by the Font and Bitmap server. |
|
1044 This file session should be used for any file access. If COpenFontFile |
|
1045 objects need to keep files open, aFileSession should be stored in a place |
|
1046 that is accessible to them. |
|
1047 @return A pointer to a new COpenFontFile derived object, or NULL if the |
|
1048 file type is not recognised. |
|
1049 @see CWsScreenDevice::AddFile() */ |
|
1050 virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession) = 0; |
|
1051 inline static COpenFontRasterizer* NewL(TUid aInterfaceImplUid); |
|
1052 inline virtual ~COpenFontRasterizer(); |
|
1053 IMPORT_C virtual void Reserved(); // unused; for future expansion |
|
1054 private: |
|
1055 TUid iDtor_ID_Key;//ECOM identifier used during destruction |
|
1056 }; |
|
1057 |
|
1058 |
|
1059 /** |
|
1060 Convenience class from which rasterizer contexts may be derived. |
984 Convenience class from which rasterizer contexts may be derived. |
1061 |
985 |
1062 A rasterizer context object may (optionally) be created to provide the link |
986 A rasterizer context object may (optionally) be created to provide the link |
1063 between the rasterizer DLL code supported by the Open Font System, and the |
987 between the rasterizer DLL code supported by the Open Font System, and the |
1064 rasterizer engine code. A rasterizer context object class should get the |
988 rasterizer engine code. A rasterizer context object class should get the |
1089 TAny* iReserved; // unused; for future expansion |
1013 TAny* iReserved; // unused; for future expansion |
1090 }; |
1014 }; |
1091 |
1015 |
1092 |
1016 |
1093 /** |
1017 /** |
1094 Shaper abstract class. All shaper implementations derive from this |
1018 Shaper abstract class. All shaper implementations derive from this |
1095 @publishedAll */ |
1019 @publishedAll |
1020 @released |
|
1021 */ |
|
1096 class CShaper : public CBase |
1022 class CShaper : public CBase |
1097 { |
1023 { |
1098 public: |
1024 public: |
1099 class TInput |
1025 class TInput |
1100 { |
1026 { |
1125 |
1051 |
1126 /** Destructor */ |
1052 /** Destructor */ |
1127 IMPORT_C virtual ~CShaper(); |
1053 IMPORT_C virtual ~CShaper(); |
1128 |
1054 |
1129 /** construct a shaper object |
1055 /** construct a shaper object |
1130 @param aBitmapFont The font to be shaped. |
1056 @param aBitmapFont The font to be shaped. |
1131 @param aHeap The heap to be used by the shaper. |
1057 @param aHeap The heap to be used by the shaper. |
1132 @return KErrNone if this font can be shaper or system wide error code*/ |
1058 @return KErrNone if this font can be shaper or system wide error code*/ |
1133 virtual TInt ConstructL(CBitmapFont* aBitmapFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0; |
1059 virtual TInt ConstructL(CBitmapFont* aBitmapFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0; |
1134 |
1060 |
1135 /** If possible, shape the text described by aInput, placing the |
1061 /** If possible, shape the text described by aInput, placing the output on aHeapForOutput. |
1136 output on aHeapForOutput. |
1062 @param aOutput The output, as a newly allocate object on aHeapForOutput. |
1137 @param aOutput The output, as a newly allocate object on |
1063 @param aInput The input text and other parameters. |
1138 aHeapForOutput. |
1064 @param aHeapForOutput On success, aOutput should be allocated from this and nothing else. |
1139 @param aInput The input text and other parameters. |
1065 On failure, nothing should be allocated from it. |
1140 @param aHeapForOutput. On success, aOutput should be allocated from |
1066 @return Error value from one of the system-wide error codes on failure, KErrNone on success. |
1141 this and nothing else. On failure, nothing should be allocated from |
1067 @see TShapeHeader */ |
1142 it. |
|
1143 @return Error value from one of the system-wide error codes on |
|
1144 failure, KErrNone on success. |
|
1145 @see TShapeHeader */ |
|
1146 virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput) = 0; |
1068 virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput) = 0; |
1147 |
1069 |
1148 /** For future expansion. Any overriders must base-call |
1070 /** For future expansion. Any overriders must base-call |
1149 if aInterface is unrecognized. |
1071 if aInterface is unrecognized. |
1150 @param aInterfaceId The ID of the interface to return. |
1072 |
1151 @return A pointer to the extension interface. |
1073 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
1152 @internalComponent |
1074 |
1075 @param aInterfaceId The ID of the interface to return. |
|
1076 @return A pointer to the extension interface. |
|
1153 */ |
1077 */ |
1154 |
1078 IMPORT_C virtual void* ExtendedInterface(TUid aInterfaceId); |
1155 IMPORT_C virtual void* ExtendedInterface(TUid aInterfaceId); |
|
1156 }; |
1079 }; |
1157 |
1080 |
1158 /** ECOM plug-in base class for shaper factories. |
1081 /** ECOM plug-in base class for shaper factories. |
1159 @publishedAll */ |
1082 @publishedAll |
1083 @released |
|
1084 */ |
|
1160 class CShaperFactory : public CBase |
1085 class CShaperFactory : public CBase |
1161 { |
1086 { |
1162 public: |
1087 public: |
1163 /** Create a shaper if possible, for typeface aFaceIndex |
1088 /** Create a shaper if possible, for typeface aFaceIndex |
1164 within file aFileName. |
1089 within file aFileName. |
1165 @param aFont The font to be shaped. |
1090 @param aFont The font to be shaped. |
1166 @param iHeap The heap to use for constructing the shaper. |
1091 @param iHeap The heap to use for constructing the shaper. |
1167 @return 0 If the font is not understood or inappropriate for |
1092 @return 0 If the font is not understood or inappropriate for any shaper that might be constructed |
1168 any shaper that might be constructed by this class, otherwise |
1093 by this class, otherwise returns the newly-constructed shaper on iHeap. */ |
1169 returns the newly-constructed shaper on iHeap. */ |
|
1170 virtual CShaper* NewShaperL(CBitmapFont* aFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0; |
1094 virtual CShaper* NewShaperL(CBitmapFont* aFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0; |
1171 |
1095 |
1172 inline static CShaperFactory* NewL(TUid aInterfaceImplUid); |
1096 inline static CShaperFactory* NewL(TUid aInterfaceImplUid); |
1173 inline virtual ~CShaperFactory(); |
1097 inline virtual ~CShaperFactory(); |
1174 |
1098 |
1175 /** For future expansion. Any overriders must base-call |
1099 /** For future expansion. Any overriders must base-call if aInterface is unrecognized. |
1176 if aInterface is unrecognized. |
1100 |
1177 @param aInterfaceId The ID of the interface to return. |
1101 WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. |
1178 @return A pointer to the extension interface. |
1102 |
1179 @internalComponent |
1103 @param aInterfaceId The ID of the interface to return. |
1104 @return A pointer to the extension interface. |
|
1180 */ |
1105 */ |
1181 virtual void* ExtendedInterface(TUid aInterfaceId); |
1106 virtual void* ExtendedInterface(TUid aInterfaceId); |
1182 |
1107 |
1183 private: |
1108 private: |
1184 TUid iDtor_ID_Key;//ECOM identifier used during destruction |
1109 TUid iDtor_ID_Key;//ECOM identifier used during destruction |
1185 }; |
1110 }; |
1186 |
|
1187 |
1111 |
1188 // Inline functions start here. |
1112 // Inline functions start here. |
1189 /** Default C++ constructor. |
1113 /** Default C++ constructor. |
1190 |
1114 |
1191 This creates then zero fills the object. */ |
1115 This creates then zero fills the object. */ |
1192 inline TOpenFontMetrics::TOpenFontMetrics() |
1116 inline TOpenFontMetrics::TOpenFontMetrics() |
1193 { |
1117 { |
1194 Mem::FillZ(this,sizeof(*this)); |
1118 Mem::FillZ(this,sizeof(*this)); |
1195 } |
1119 } |
1196 |
1120 |
1197 /** Gets the font's size. |
1121 /** Gets the font's size. |
1198 |
1122 |
1199 @return The font's size. |
1123 @return The font's size. |
1200 @see SetSize() */ |
1124 @see SetSize() */ |
1201 inline TInt TOpenFontMetrics::Size() const |
1125 inline TInt TOpenFontMetrics::Size() const |
1202 { |
1126 { |
1203 return iDesignHeight; |
1127 return iDesignHeight; |
1204 } |
1128 } |
1205 |
1129 |
1206 /** Gets the font's ascent. |
1130 /** Gets the font's ascent. |
1207 |
1131 |
1208 This is the ascent for the Latin character which is highest above the baseline. |
1132 This is the ascent for the Latin character which is highest above the baseline. |
1209 |
1133 |
1210 @return The font's ascent, in pixels. |
1134 @return The font's ascent, in pixels. |
1211 @see SetAscent() */ |
1135 @see SetAscent() */ |
1212 inline TInt TOpenFontMetrics::Ascent() const |
1136 inline TInt TOpenFontMetrics::Ascent() const |
1213 { |
1137 { |
1214 return iAscent; |
1138 return iAscent; |
1215 } |
1139 } |
1216 |
1140 |
1217 /** Gets the font's descent. |
1141 /** Gets the font's descent. |
1218 |
1142 |
1219 This is the descent for the Latin character in the font which falls furthest below the baseline. |
1143 This is the descent for the Latin character in the font which falls furthest below the baseline. |
1220 |
1144 |
1221 @return The font's descent, in pixels. |
1145 @return The font's descent, in pixels. |
1222 @see SetDescent() */ |
1146 @see SetDescent() */ |
1223 inline TInt TOpenFontMetrics::Descent() const |
1147 inline TInt TOpenFontMetrics::Descent() const |
1224 { |
1148 { |
1225 return iDescent; |
1149 return iDescent; |
1226 } |
1150 } |
1227 |
1151 |
1228 /** Sets the font's maximum height. |
1152 /** Sets the font's maximum height. |
1229 |
1153 |
1230 Note that if this object was initialised from the CFont this will be the same |
1154 Note that if this object was initialised from the CFont this will be the same |
1231 as the ascent. |
1155 as the ascent. |
1232 |
1156 |
1233 This is the ascent for the character which is highest above the baseline. |
1157 This is the ascent for the character which is highest above the baseline. |
1234 In many fonts this will be the height of an accented character like Â, |
1158 In many fonts this will be the height of an accented character like Â, |
1235 including the accent. |
1159 including the accent. |
1236 |
1160 |
1237 @return The maximum height of the font, in pixels. |
1161 @return The maximum height of the font, in pixels. |
1238 @see SetMaxDepth() */ |
1162 @see SetMaxDepth() */ |
1239 inline TInt TOpenFontMetrics::MaxHeight() const |
1163 inline TInt TOpenFontMetrics::MaxHeight() const |
1240 { |
1164 { |
1241 return iMaxHeight; |
1165 return iMaxHeight; |
1242 } |
1166 } |
1243 |
1167 |
1244 /** Gets the font's maximum depth. |
1168 /** Gets the font's maximum depth. |
1245 |
1169 |
1246 Note: If this object was initialised from the CFont this will be the same as the |
1170 Note: If this object was initialised from the CFont this will be the same as the |
1247 descent. |
1171 descent. |
1248 |
1172 |
1249 This is the descent for the character in the font which falls furthest below |
1173 This is the descent for the character in the font which falls furthest below |
1250 the baseline. |
1174 the baseline. |
1251 |
1175 |
1252 @return The font's maximum depth. |
1176 @return The font's maximum depth. |
1253 @see SetMaxDepth() */ |
1177 @see SetMaxDepth() */ |
1254 inline TInt TOpenFontMetrics::MaxDepth() const |
1178 inline TInt TOpenFontMetrics::MaxDepth() const |
1255 { |
1179 { |
1256 return iMaxDepth; |
1180 return iMaxDepth; |
1257 } |
1181 } |
1258 |
1182 |
1259 /** Gets the maximum character width, in pixels. |
1183 /** Gets the maximum character width, in pixels. |
1260 |
1184 |
1261 @return The maximum character width, in pixels. |
1185 @return The maximum character width, in pixels. |
1262 @see SetMaxWidth() */ |
1186 @see SetMaxWidth() */ |
1263 inline TInt TOpenFontMetrics::MaxWidth() const |
1187 inline TInt TOpenFontMetrics::MaxWidth() const |
1264 { |
1188 { |
1265 return iMaxWidth; |
1189 return iMaxWidth; |
1266 } |
1190 } |
1267 |
1191 |
1268 /** Sets the font's size. |
1192 /** Sets the font's size. |
1269 |
1193 |
1270 @param aSize The font's size. |
1194 @param aSize The font's size. |
1271 @see Size() */ |
1195 @see Size() */ |
1272 inline void TOpenFontMetrics::SetSize(TInt aSize) |
1196 inline void TOpenFontMetrics::SetSize(TInt aSize) |
1273 { |
1197 { |
1274 iDesignHeight = static_cast<TInt16>(aSize); |
1198 iDesignHeight = static_cast<TInt16>(aSize); |
1275 } |
1199 } |
1276 |
1200 |
1277 /** Sets the ascent. |
1201 /** Sets the ascent. |
1278 |
1202 |
1279 @param aAscent The ascent, in pixels. |
1203 @param aAscent The ascent, in pixels. |
1280 @see Ascent() */ |
1204 @see Ascent() */ |
1281 inline void TOpenFontMetrics::SetAscent(TInt aAscent) |
1205 inline void TOpenFontMetrics::SetAscent(TInt aAscent) |
1282 { |
1206 { |
1283 iAscent = static_cast<TInt16>(aAscent); |
1207 iAscent = static_cast<TInt16>(aAscent); |
1284 } |
1208 } |
1285 |
1209 |
1286 /** Sets the descent. |
1210 /** Sets the descent. |
1287 |
1211 |
1288 @param aDescent The descent, in pixels. |
1212 @param aDescent The descent, in pixels. |
1289 @see Descent() */ |
1213 @see Descent() */ |
1290 inline void TOpenFontMetrics::SetDescent(TInt aDescent) |
1214 inline void TOpenFontMetrics::SetDescent(TInt aDescent) |
1291 { |
1215 { |
1292 iDescent = static_cast<TInt16>(aDescent); |
1216 iDescent = static_cast<TInt16>(aDescent); |
1293 } |
1217 } |
1294 |
1218 |
1295 /** Sets the font's maximum height. |
1219 /** Sets the font's maximum height. |
1296 |
1220 |
1297 @param aMaxHeight The font's maximum height, in pixels. |
1221 @param aMaxHeight The font's maximum height, in pixels. |
1298 @see MaxHeight() */ |
1222 @see MaxHeight() */ |
1299 inline void TOpenFontMetrics::SetMaxHeight(TInt aMaxHeight) |
1223 inline void TOpenFontMetrics::SetMaxHeight(TInt aMaxHeight) |
1300 { |
1224 { |
1301 iMaxHeight = static_cast<TInt16>(aMaxHeight); |
1225 iMaxHeight = static_cast<TInt16>(aMaxHeight); |
1302 } |
1226 } |
1303 |
1227 |
1304 /** Sets the font's maximum depth. |
1228 /** Sets the font's maximum depth. |
1305 |
1229 |
1306 @param aMaxDepth The font's maximum depth, in pixels. |
1230 @param aMaxDepth The font's maximum depth, in pixels. |
1307 @see MaxDepth() */ |
1231 @see MaxDepth() */ |
1308 inline void TOpenFontMetrics::SetMaxDepth(TInt aMaxDepth) |
1232 inline void TOpenFontMetrics::SetMaxDepth(TInt aMaxDepth) |
1309 { |
1233 { |
1310 iMaxDepth = static_cast<TInt16>(aMaxDepth); |
1234 iMaxDepth = static_cast<TInt16>(aMaxDepth); |
1311 } |
1235 } |
1312 |
1236 |
1313 /** Sets the maximum character width, in pixels. |
1237 /** Sets the maximum character width, in pixels. |
1314 |
1238 |
1315 @param aMaxWidth The maximum character width, in pixels. |
1239 @param aMaxWidth The maximum character width, in pixels. |
1316 @see MaxWidth() */ |
1240 @see MaxWidth() */ |
1317 inline void TOpenFontMetrics::SetMaxWidth(TInt aMaxWidth) |
1241 inline void TOpenFontMetrics::SetMaxWidth(TInt aMaxWidth) |
1318 { |
1242 { |
1319 iMaxWidth = static_cast<TInt16>(aMaxWidth); |
1243 iMaxWidth = static_cast<TInt16>(aMaxWidth); |
1320 } |
1244 } |
1321 |
1245 |
1322 /** Default C++ constructor. |
1246 /** Default C++ constructor. |
1323 |
1247 |
1324 The constructor initialises all data members to zero. As for other T classes, |
1248 The constructor initialises all data members to zero. As for other T classes, |
1325 there is no need to explicitly cleanup TOpenFontCharMetrics objects. */ |
1249 there is no need to explicitly cleanup TOpenFontCharMetrics objects. */ |
1326 inline TOpenFontCharMetrics::TOpenFontCharMetrics() |
1250 inline TOpenFontCharMetrics::TOpenFontCharMetrics() |
1327 { |
1251 { |
1328 Mem::FillZ(this,sizeof(*this)); |
1252 Mem::FillZ(this,sizeof(*this)); |
1329 } |
1253 } |
1330 |
1254 |
1331 /** Gets the width of the character's bitmap. |
1255 /** Gets the width of the character's bitmap. |
1332 |
1256 |
1333 @return The width of the bitmap in pixels. */ |
1257 @return The width of the bitmap in pixels. */ |
1334 inline TInt TOpenFontCharMetrics::Width() const |
1258 inline TInt TOpenFontCharMetrics::Width() const |
1335 { |
1259 { |
1336 return iWidth; |
1260 return iWidth; |
1337 } |
1261 } |
1338 |
1262 |
1339 /** Gets the height of the character's bitmap. |
1263 /** Gets the height of the character's bitmap. |
1340 |
1264 |
1341 @return The character's height in pixels. */ |
1265 @return The character's height in pixels. */ |
1342 inline TInt TOpenFontCharMetrics::Height() const |
1266 inline TInt TOpenFontCharMetrics::Height() const |
1343 { |
1267 { |
1344 return iHeight; |
1268 return iHeight; |
1345 } |
1269 } |
1346 |
1270 |
1347 /** Gets the horizontal bearing X. |
1271 /** Gets the horizontal bearing X. |
1348 |
1272 |
1349 This is the distance in pixels from the pen point before the character is |
1273 This is the distance in pixels from the pen point before the character is |
1350 drawn (the origin) to the left edge of the bitmap, when drawing horizontally. |
1274 drawn (the origin) to the left edge of the bitmap, when drawing horizontally. |
1351 A positive value means that the left edge of the bitmap is right of the origin. |
1275 A positive value means that the left edge of the bitmap is right of the origin. |
1352 |
1276 |
1353 @return The horizontal bearing X in pixels */ |
1277 @return The horizontal bearing X in pixels */ |
1354 inline TInt TOpenFontCharMetrics::HorizBearingX() const |
1278 inline TInt TOpenFontCharMetrics::HorizBearingX() const |
1355 { |
1279 { |
1356 return iHorizBearingX; |
1280 return iHorizBearingX; |
1357 } |
1281 } |
1358 |
1282 |
1359 /** Gets horizontal bearing Y. |
1283 /** Gets horizontal bearing Y. |
1360 |
1284 |
1361 This is the vertical distance in pixels from the pen point before the character |
1285 This is the vertical distance in pixels from the pen point before the character |
1362 is drawn (the origin) to the top edge of the bitmap, when drawing horizontally. |
1286 is drawn (the origin) to the top edge of the bitmap, when drawing horizontally. |
1363 A positive value means that the top edge of the bitmap is above the origin |
1287 A positive value means that the top edge of the bitmap is above the origin |
1364 |
1288 |
1365 @return The horizontal bearing Y in pixels. */ |
1289 @return The horizontal bearing Y in pixels. */ |
1366 inline TInt TOpenFontCharMetrics::HorizBearingY() const |
1290 inline TInt TOpenFontCharMetrics::HorizBearingY() const |
1367 { |
1291 { |
1368 return iHorizBearingY; |
1292 return iHorizBearingY; |
1369 } |
1293 } |
1370 |
1294 |
1371 /** Gets the horizontal advance. |
1295 /** Gets the horizontal advance. |
1372 |
1296 |
1373 This is the amount added to the x co-ordinate of the origin after the character |
1297 This is the amount added to the x co-ordinate of the origin after the character |
1374 is drawn what most people understand by the width or escapement of a character. |
1298 is drawn what most people understand by the width or escapement of a character. |
1375 The origin here is the pen point before the character is drawn. |
1299 The origin here is the pen point before the character is drawn. |
1376 |
1300 |
1377 @return The horizontal advance in pixels */ |
1301 @return The horizontal advance in pixels */ |
1378 inline TInt TOpenFontCharMetrics::HorizAdvance() const |
1302 inline TInt TOpenFontCharMetrics::HorizAdvance() const |
1379 { |
1303 { |
1380 return iHorizAdvance; |
1304 return iHorizAdvance; |
1381 } |
1305 } |
1382 |
1306 |
1383 /** Gets the vertical bearing X. |
1307 /** Gets the vertical bearing X. |
1384 |
1308 |
1385 This is the distance in pixels from the pen point before the character is |
1309 This is the distance in pixels from the pen point before the character is |
1386 drawn (the origin) to the left edge of the bitmap, when drawing vertically. |
1310 drawn (the origin) to the left edge of the bitmap, when drawing vertically. |
1387 A positive value means that the left edge of the bitmap is right of the origin. |
1311 A positive value means that the left edge of the bitmap is right of the origin. |
1388 |
1312 |
1389 @return The vertical bearing X in pixels. */ |
1313 @return The vertical bearing X in pixels. */ |
1390 inline TInt TOpenFontCharMetrics::VertBearingX() const |
1314 inline TInt TOpenFontCharMetrics::VertBearingX() const |
1391 { |
1315 { |
1392 return iVertBearingX; |
1316 return iVertBearingX; |
1393 } |
1317 } |
1394 |
1318 |
1395 /** Gets the vertical bearing Y. |
1319 /** Gets the vertical bearing Y. |
1396 |
1320 |
1397 This is the distance in pixels from the pen point before the character is |
1321 This is the distance in pixels from the pen point before the character is |
1398 drawn (the origin) to the top edge of the bitmap, when drawing vertically. |
1322 drawn (the origin) to the top edge of the bitmap, when drawing vertically. |
1399 A positive value means that the top edge of the bitmap is above the origin. |
1323 A positive value means that the top edge of the bitmap is above the origin. |
1400 |
1324 |
1401 @return The vertical bearing Y in pixels. */ |
1325 @return The vertical bearing Y in pixels. */ |
1402 inline TInt TOpenFontCharMetrics::VertBearingY() const |
1326 inline TInt TOpenFontCharMetrics::VertBearingY() const |
1403 { |
1327 { |
1404 return iVertBearingY; |
1328 return iVertBearingY; |
1405 } |
1329 } |
1406 |
1330 |
1407 /** Gets the vertical advance. |
1331 /** Gets the vertical advance. |
1408 |
1332 |
1409 When drawing vertically, this is the amount added to the y co-ordinate of |
1333 When drawing vertically, this is the amount added to the y co-ordinate of |
1410 the origin after the character is drawn what most people understand by |
1334 the origin after the character is drawn what most people understand by |
1411 the height of a character. The origin here is the pen point before the character |
1335 the height of a character. The origin here is the pen point before the character |
1412 is drawn. |
1336 is drawn. |
1413 |
1337 |
1414 Note: Vertical drawing is not supported in v5. |
1338 Note: Vertical drawing is not supported in v5. |
1415 |
1339 |
1416 @return The vertical advance in pixels. */ |
1340 @return The vertical advance in pixels. */ |
1417 inline TInt TOpenFontCharMetrics::VertAdvance() const |
1341 inline TInt TOpenFontCharMetrics::VertAdvance() const |
1418 { |
1342 { |
1419 return iVertAdvance; |
1343 return iVertAdvance; |
1420 } |
1344 } |
1421 |
1345 |
1422 /** Gets the bounds of the character relative to its origin when setting text |
1346 /** Gets the bounds of the character relative to its origin when setting text |
1423 horizontally. |
1347 horizontally. |
1424 |
1348 |
1425 The origin here is the pen point before the character is drawn. |
1349 The origin here is the pen point before the character is drawn. |
1426 |
1350 |
1427 @param aBounds The character's bounds. */ |
1351 @param aBounds The character's bounds. */ |
1428 inline void TOpenFontCharMetrics::GetHorizBounds(TRect& aBounds) const |
1352 inline void TOpenFontCharMetrics::GetHorizBounds(TRect& aBounds) const |
1429 { |
1353 { |
1430 aBounds.iTl.iX = iHorizBearingX; |
1354 aBounds.iTl.iX = iHorizBearingX; |
1431 aBounds.iTl.iY = -iHorizBearingY; |
1355 aBounds.iTl.iY = -iHorizBearingY; |
1432 aBounds.iBr.iX = aBounds.iTl.iX + iWidth; |
1356 aBounds.iBr.iX = aBounds.iTl.iX + iWidth; |
1433 aBounds.iBr.iY = aBounds.iTl.iY + iHeight; |
1357 aBounds.iBr.iY = aBounds.iTl.iY + iHeight; |
1434 } |
1358 } |
1435 |
1359 |
1436 /** Gets the bounds of the character relative to its origin when setting text |
1360 /** Gets the bounds of the character relative to its origin when setting text |
1437 vertically. |
1361 vertically. |
1438 |
1362 |
1439 The origin here is the pen point before the character is drawn. |
1363 The origin here is the pen point before the character is drawn. |
1440 |
1364 |
1441 @param aBounds The character's bounds. */ |
1365 @param aBounds The character's bounds. */ |
1442 inline void TOpenFontCharMetrics::GetVertBounds(TRect& aBounds) const |
1366 inline void TOpenFontCharMetrics::GetVertBounds(TRect& aBounds) const |
1443 { |
1367 { |
1444 aBounds.iTl.iX = -iVertBearingX; |
1368 aBounds.iTl.iX = -iVertBearingX; |
1445 aBounds.iTl.iY = iVertBearingY; |
1369 aBounds.iTl.iY = iVertBearingY; |
1446 aBounds.iBr.iX = aBounds.iTl.iX + iWidth; |
1370 aBounds.iBr.iX = aBounds.iTl.iX + iWidth; |
1447 aBounds.iBr.iY = aBounds.iTl.iY + iHeight; |
1371 aBounds.iBr.iY = aBounds.iTl.iY + iHeight; |
1448 } |
1372 } |
1449 |
1373 |
1450 /** Sets the width of the character's bitmap. |
1374 /** Sets the width of the character's bitmap. |
1451 |
1375 |
1452 @param aWidth The width of the bitmap in pixels. */ |
1376 @param aWidth The width of the bitmap in pixels. */ |
1453 inline void TOpenFontCharMetrics::SetWidth(TInt aWidth) |
1377 inline void TOpenFontCharMetrics::SetWidth(TInt aWidth) |
1454 { |
1378 { |
1455 iWidth = (TInt16)aWidth; |
1379 iWidth = (TInt16)aWidth; |
1456 } |
1380 } |
1457 |
1381 |
1458 /** Sets the height of the character's bitmap. |
1382 /** Sets the height of the character's bitmap. |
1459 |
1383 |
1460 @param aHeight The character height (in pixels). */ |
1384 @param aHeight The character height (in pixels). */ |
1461 inline void TOpenFontCharMetrics::SetHeight(TInt aHeight) |
1385 inline void TOpenFontCharMetrics::SetHeight(TInt aHeight) |
1462 { |
1386 { |
1463 iHeight = (TInt16)aHeight; |
1387 iHeight = (TInt16)aHeight; |
1464 } |
1388 } |
1465 |
1389 |
1466 /** Sets the horizontal bearing X. |
1390 /** Sets the horizontal bearing X. |
1467 |
1391 |
1468 This is the distance in pixels from the pen point before the character is |
1392 This is the distance in pixels from the pen point before the character is |
1469 drawn (the origin) to the left edge of the bitmap, when drawing horizontally. |
1393 drawn (the origin) to the left edge of the bitmap, when drawing horizontally. |
1470 A positive value means that the left edge of the bitmap is right of the origin. |
1394 A positive value means that the left edge of the bitmap is right of the origin. |
1471 |
1395 |
1472 @param aHorizBearingX The horizontal bearing X (in pixels). */ |
1396 @param aHorizBearingX The horizontal bearing X (in pixels). */ |
1473 inline void TOpenFontCharMetrics::SetHorizBearingX(TInt aHorizBearingX) |
1397 inline void TOpenFontCharMetrics::SetHorizBearingX(TInt aHorizBearingX) |
1474 { |
1398 { |
1475 iHorizBearingX = (TInt16)aHorizBearingX; |
1399 iHorizBearingX = (TInt16)aHorizBearingX; |
1476 } |
1400 } |
1477 |
1401 |
1478 /** Sets the horizontal bearing Y. |
1402 /** Sets the horizontal bearing Y. |
1479 |
1403 |
1480 This is the distance in pixels from the pen point before the character is |
1404 This is the distance in pixels from the pen point before the character is |
1481 drawn (the origin) to the top edge of the bitmap, when drawing horizontally. |
1405 drawn (the origin) to the top edge of the bitmap, when drawing horizontally. |
1482 A positive value means that the top edge of the bitmap is above the origin. |
1406 A positive value means that the top edge of the bitmap is above the origin. |
1483 |
1407 |
1484 @param aHorizBearingY The horizontal bearing Y (in pixels). */ |
1408 @param aHorizBearingY The horizontal bearing Y (in pixels). */ |
1485 inline void TOpenFontCharMetrics::SetHorizBearingY(TInt aHorizBearingY) |
1409 inline void TOpenFontCharMetrics::SetHorizBearingY(TInt aHorizBearingY) |
1486 { |
1410 { |
1487 iHorizBearingY = (TInt16)aHorizBearingY; |
1411 iHorizBearingY = (TInt16)aHorizBearingY; |
1488 } |
1412 } |
1489 |
1413 |
1490 /** Sets the horizontal advance. |
1414 /** Sets the horizontal advance. |
1491 |
1415 |
1492 This is the amount added to the x co-ordinate of the origin after the character |
1416 This is the amount added to the x co-ordinate of the origin after the character |
1493 is drawn, what most people understand by the width or escapement of a character. |
1417 is drawn, what most people understand by the width or escapement of a character. |
1494 The origin here is the pen point before the character is drawn. |
1418 The origin here is the pen point before the character is drawn. |
1495 |
1419 |
1496 @param aHorizAdvance The horizontal advance (in pixels). */ |
1420 @param aHorizAdvance The horizontal advance (in pixels). */ |
1497 inline void TOpenFontCharMetrics::SetHorizAdvance(TInt aHorizAdvance) |
1421 inline void TOpenFontCharMetrics::SetHorizAdvance(TInt aHorizAdvance) |
1498 { |
1422 { |
1499 iHorizAdvance = (TInt16)aHorizAdvance; |
1423 iHorizAdvance = (TInt16)aHorizAdvance; |
1500 } |
1424 } |
1501 |
1425 |
1502 /** Set vertical bearing X. |
1426 /** Set vertical bearing X. |
1503 |
1427 |
1504 This is the distance in pixels from the pen point before the character is |
1428 This is the distance in pixels from the pen point before the character is |
1505 drawn (the origin) to the left edge of the bitmap, when drawing vertically. |
1429 drawn (the origin) to the left edge of the bitmap, when drawing vertically. |
1506 A positive value means that the left edge of the bitmap is right of the origin. |
1430 A positive value means that the left edge of the bitmap is right of the origin. |
1507 |
1431 |
1508 @param aVertBearingX The vertical bearing X (in pixels). */ |
1432 @param aVertBearingX The vertical bearing X (in pixels). */ |
1509 inline void TOpenFontCharMetrics::SetVertBearingX(TInt aVertBearingX) |
1433 inline void TOpenFontCharMetrics::SetVertBearingX(TInt aVertBearingX) |
1510 { |
1434 { |
1511 iVertBearingX = (TInt16)aVertBearingX; |
1435 iVertBearingX = (TInt16)aVertBearingX; |
1512 } |
1436 } |
1513 |
1437 |
1514 /** Sets the vertical bearing Y. |
1438 /** Sets the vertical bearing Y. |
1515 |
1439 |
1516 This is the distance in pixels from the pen point before the character is |
1440 This is the distance in pixels from the pen point before the character is |
1517 drawn (the origin) to the top edge of the bitmap, when drawing vertically. |
1441 drawn (the origin) to the top edge of the bitmap, when drawing vertically. |
1518 A positive value means that the top edge of the bitmap is above the origin. |
1442 A positive value means that the top edge of the bitmap is above the origin. |
1519 |
1443 |
1520 @param aVertBearingY The vertical bearing Y (in pixels). */ |
1444 @param aVertBearingY The vertical bearing Y (in pixels). */ |
1521 inline void TOpenFontCharMetrics::SetVertBearingY(TInt aVertBearingY) |
1445 inline void TOpenFontCharMetrics::SetVertBearingY(TInt aVertBearingY) |
1522 { |
1446 { |
1523 iVertBearingY = (TInt16)aVertBearingY; |
1447 iVertBearingY = (TInt16)aVertBearingY; |
1524 } |
1448 } |
1525 |
1449 |
1526 /** Sets the vertical advance. |
1450 /** Sets the vertical advance. |
1527 |
1451 |
1528 When drawing vertically, this is the amount added to the y co-ordinate of |
1452 When drawing vertically, this is the amount added to the y co-ordinate of |
1529 the origin after the character is drawn what most people understand by |
1453 the origin after the character is drawn what most people understand by |
1530 the height of a character. The origin here is the pen point before the character |
1454 the height of a character. The origin here is the pen point before the character |
1531 is drawn. |
1455 is drawn. |
1532 |
1456 |
1533 Note: Vertical drawing is not supported in v5. |
1457 Note: Vertical drawing is not supported in v5. |
1534 |
1458 |
1535 @param aVertAdvance The vertical advance (in pixels). */ |
1459 @param aVertAdvance The vertical advance (in pixels). */ |
1536 inline void TOpenFontCharMetrics::SetVertAdvance(TInt aVertAdvance) |
1460 inline void TOpenFontCharMetrics::SetVertAdvance(TInt aVertAdvance) |
1537 { |
1461 { |
1538 iVertAdvance = (TInt16)aVertAdvance; |
1462 iVertAdvance = (TInt16)aVertAdvance; |
1539 } |
1463 } |
1540 |
1464 |
1541 /** Gets the character metrics for this font. |
1465 /** Gets the character metrics for this font. |
1542 |
1466 |
1543 @return The character metrics for this font. */ |
1467 @return The character metrics for this font. */ |
1544 inline const TOpenFontMetrics& COpenFont::Metrics() const |
1468 inline const TOpenFontMetrics& COpenFont::Metrics() const |
1545 { |
1469 { |
1546 return iMetrics; |
1470 return iMetrics; |
1547 } |
1471 } |
1548 |
1472 |
1549 /** Gets the glyph index. |
1473 /** Gets the glyph index. |
1550 |
1474 |
1551 This is the index of a particular glyph within the font file. |
1475 This is the index of a particular glyph within the font file. |
1552 |
1476 |
1553 Note: This makes it possible to gain access to glyphs which are not referenced |
1477 Note: This makes it possible to gain access to glyphs which are not referenced |
1554 by the Unicode character set. However, this feature is not yet supported by |
1478 by the Unicode character set. However, this feature is not yet supported by |
1555 Symbian OS. |
1479 Symbian OS. |
1556 |
1480 |
1557 @return The glyph index. |
1481 @return The glyph index. |
1558 @see SetGlyphIndex() */ |
1482 @see SetGlyphIndex() */ |
1559 inline TInt TOpenFontGlyphData::GlyphIndex() const |
1483 inline TInt TOpenFontGlyphData::GlyphIndex() const |
1560 { |
1484 { |
1561 return iGlyphIndex; |
1485 return iGlyphIndex; |
1562 } |
1486 } |
1563 |
1487 |
1564 /** Gets the typeface attributes. |
1488 /** Gets the typeface attributes. |
1565 |
1489 |
1566 These are the attributes of the font represented by this object. |
1490 These are the attributes of the font represented by this object. |
1567 |
1491 |
1568 @return The typeface attributes. */ |
1492 @return The typeface attributes. */ |
1569 inline const TOpenFontFaceAttrib* COpenFont::FaceAttrib() const |
1493 inline const TOpenFontFaceAttrib* COpenFont::FaceAttrib() const |
1570 { |
1494 { |
1571 return iFile ? &iFile->FaceAttrib(iFaceIndex) : NULL; |
1495 return iFileOffset == 0 ? NULL : &File()->FaceAttrib(iFaceIndex); |
1572 } |
1496 } |
1573 |
1497 |
1574 /** Gets a pointer to the COpenFontFile which created this object. |
1498 /** Gets a pointer to the COpenFontFile which created this object. |
1575 |
1499 |
1576 This is the COpenFontFile which owns the file that contains the definition |
1500 This is the COpenFontFile which owns the file that contains the definition |
1577 of the typeface. It can be used to get information about the typeface, or |
1501 of the typeface. It can be used to get information about the typeface, or |
1578 to access the rasterizer context (engine). |
1502 to access the rasterizer context (engine). |
1579 |
1503 |
1580 @return The COpenFontFile which created this object. */ |
1504 @return The COpenFontFile which created this object. */ |
1581 inline COpenFontFile* COpenFont::File() const |
1505 inline COpenFontFile* COpenFont::File() const |
1582 { |
1506 { |
1583 return iFile; |
1507 return iFileOffset == 0 ? NULL : reinterpret_cast<COpenFontFile*>(const_cast<COpenFont*>(PtrAdd(this, iFileOffset))); |
1584 } |
1508 } |
1585 |
1509 |
1586 /** Gets the index of this typeface within the font file. |
1510 /** Gets the index of this typeface within the font file. |
1587 |
1511 |
1588 @return The index of this typeface within the font file. */ |
1512 @return The index of this typeface within the font file. */ |
1589 inline TInt COpenFont::FaceIndex() const |
1513 inline TInt COpenFont::FaceIndex() const |
1590 { |
1514 { |
1591 return iFaceIndex; |
1515 return iFaceIndex; |
1592 } |
1516 } |
1593 |
1517 |
1594 /** Tests whether or not a character needs to be rasterized. |
1518 /** Tests whether or not a character needs to be rasterized. |
1595 |
1519 |
1596 Characters that have been rasterized are cached there is no need to regenerate |
1520 Characters that have been rasterized are cached there is no need to regenerate |
1597 the character bitmap. This function should only be called by the Font and |
1521 the character bitmap. This function should only be called by the Font and |
1598 Bitmap server. |
1522 Bitmap server. |
1599 |
1523 |
1600 @param aSessionHandle A handle to the font and bitmap server session. |
1524 @param aSessionHandle A handle to the font and bitmap server session. |
1601 @param aCode The code for the Unicode character. |
1525 @param aCode The code for the Unicode character. |
1602 @return ETrue if the character needs to be rasterized, otherwise EFalse. */ |
1526 @return ETrue if the character needs to be rasterized, otherwise EFalse. */ |
1603 inline TBool COpenFont::CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const |
1527 inline TBool COpenFont::CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const |
1604 { |
1528 { |
1700 { |
1624 { |
1701 return iFontMaxAscent + iFontMaxDescent; |
1625 return iFontMaxAscent + iFontMaxDescent; |
1702 } |
1626 } |
1703 |
1627 |
1704 /** Default C++ constructor. |
1628 /** Default C++ constructor. |
1705 |
1629 |
1706 This sets all attribute fields to zero. As for other T classes, there is no |
1630 This sets all attribute fields to zero. As for other T classes, there is no |
1707 need to explicitly clean-up objects derived from this class. */ |
1631 need to explicitly clean-up objects derived from this class. */ |
1708 inline TOpenFontFaceAttribBase::TOpenFontFaceAttribBase() |
1632 inline TOpenFontFaceAttribBase::TOpenFontFaceAttribBase() |
1709 { |
1633 { |
1710 Mem::FillZ(this,sizeof(*this)); |
1634 Mem::FillZ(this,sizeof(*this)); |
1711 } |
1635 } |
1712 |
1636 |
1713 /** Default C++ constructor. |
1637 /** Default C++ constructor. |
1714 |
1638 |
1715 The function initialises the minimum typeface size to zero, the names to NULL, |
1639 The function initialises the minimum typeface size to zero, the names to NULL, |
1716 and the coverage and style flags to zero. */ |
1640 and the coverage and style flags to zero. */ |
1717 inline TOpenFontFaceAttrib::TOpenFontFaceAttrib(): |
1641 inline TOpenFontFaceAttrib::TOpenFontFaceAttrib(): |
1718 iMinSizeInPixels(0), |
1642 iMinSizeInPixels(0), |
1719 iReserved2(0) |
1643 iReserved2(0) |
1720 { |
1644 { |
1721 } |
1645 } |
1722 |
1646 |
1723 /** Tests for support of Latin characters. |
1647 /** Tests for support of Latin characters. |
1724 |
1648 |
1725 Note: A return value of ETrue implies that the font has a usable set of |
1649 Note: A return value of ETrue implies that the font has a usable set of |
1726 characters. It does not imply exhaustive coverage. |
1650 characters. It does not imply exhaustive coverage. |
1727 |
1651 |
1728 @return ETrue if Latin characters are supported */ |
1652 @return ETrue if Latin characters are supported */ |
1729 inline TBool TOpenFontFaceAttribBase::HasLatin() const |
1653 inline TBool TOpenFontFaceAttribBase::HasLatin() const |
1730 { |
1654 { |
1731 return iCoverage[0] & ELatinSet; |
1655 return iCoverage[0] & ELatinSet; |
1732 } |
1656 } |
1733 |
1657 |
1734 /** Tests for support of Greek characters. |
1658 /** Tests for support of Greek characters. |
1735 |
1659 |
1736 Note: A return value of ETrue implies that the font has a usable set of |
1660 Note: A return value of ETrue implies that the font has a usable set of |
1737 characters. It does not imply exhaustive coverage. |
1661 characters. It does not imply exhaustive coverage. |
1738 |
1662 |
1739 @return ETrue if Greek characters are supported. */ |
1663 @return ETrue if Greek characters are supported. */ |
1740 inline TBool TOpenFontFaceAttribBase::HasGreek() const |
1664 inline TBool TOpenFontFaceAttribBase::HasGreek() const |
1741 { |
1665 { |
1742 return iCoverage[0] & EGreekSet; |
1666 return iCoverage[0] & EGreekSet; |
1743 } |
1667 } |
1744 |
1668 |
1745 /** Tests for support of Cyrillic characters. |
1669 /** Tests for support of Cyrillic characters. |
1746 |
1670 |
1747 Note: A return value of ETrue implies that the font has a usable set of |
1671 Note: A return value of ETrue implies that the font has a usable set of |
1748 characters. It does not imply exhaustive coverage. |
1672 characters. It does not imply exhaustive coverage. |
1749 |
1673 |
1750 @return ETrue if Cyrillic characters are supported. */ |
1674 @return ETrue if Cyrillic characters are supported. */ |
1751 inline TBool TOpenFontFaceAttribBase::HasCyrillic() const |
1675 inline TBool TOpenFontFaceAttribBase::HasCyrillic() const |
1752 { |
1676 { |
1753 return iCoverage[0] & ECyrillicSet; |
1677 return iCoverage[0] & ECyrillicSet; |
1754 } |
1678 } |
1755 |
1679 |
1756 /** Tests for support of Japanese syllabic characters. |
1680 /** Tests for support of Japanese syllabic characters. |
1757 |
1681 |
1758 This function tests for the presence of Hiragana and Katakana syllabic |
1682 This function tests for the presence of Hiragana and Katakana syllabic |
1759 characters in the font, collectively called kana. These characters are not |
1683 characters in the font, collectively called kana. These characters are not |
1760 sufficient for the Japanese language, which also makes use of Chinese characters. |
1684 sufficient for the Japanese language, which also makes use of Chinese characters. |
1761 |
1685 |
1762 Note: A return value of ETrue implies that the font has a usable set of |
1686 Note: A return value of ETrue implies that the font has a usable set of |
1763 characters. It does not imply exhaustive coverage. |
1687 characters. It does not imply exhaustive coverage. |
1764 |
1688 |
1765 @return ETrue if Japanese characters are supported |
1689 @return ETrue if Japanese characters are supported |
1766 @see HasCJK() */ |
1690 @see HasCJK() */ |
1767 inline TBool TOpenFontFaceAttribBase::HasKana() const |
1691 inline TBool TOpenFontFaceAttribBase::HasKana() const |
1768 { |
1692 { |
1769 return iCoverage[1] & EKanaSets; |
1693 return iCoverage[1] & EKanaSets; |
1770 } |
1694 } |
1771 |
1695 |
1772 /** Tests for support of Korean Hangul characters. |
1696 /** Tests for support of Korean Hangul characters. |
1773 |
1697 |
1774 Korean may also make use of Chinese characters. |
1698 Korean may also make use of Chinese characters. |
1775 |
1699 |
1776 Note: A return value of ETrue implies that the font has a usable set of |
1700 Note: A return value of ETrue implies that the font has a usable set of |
1777 characters. It does not imply exhaustive coverage. |
1701 characters. It does not imply exhaustive coverage. |
1778 |
1702 |
1779 @return ETrue if Korean characters are supported |
1703 @return ETrue if Korean characters are supported |
1780 @see HasCJK() */ |
1704 @see HasCJK() */ |
1781 inline TBool TOpenFontFaceAttribBase::HasHangul() const |
1705 inline TBool TOpenFontFaceAttribBase::HasHangul() const |
1782 { |
1706 { |
1783 return iCoverage[1] & EHangulSet; |
1707 return iCoverage[1] & EHangulSet; |
1784 } |
1708 } |
1785 |
1709 |
1786 /** Tests for support of Chinese ideographic characters. |
1710 /** Tests for support of Chinese ideographic characters. |
1787 |
1711 |
1788 These are used in Chinese, Japanese and Korean. |
1712 These are used in Chinese, Japanese and Korean. |
1789 |
1713 |
1790 Note: A return value of ETrue implies that the font has a usable set of |
1714 Note: A return value of ETrue implies that the font has a usable set of |
1791 characters. It does not imply exhaustive coverage. |
1715 characters. It does not imply exhaustive coverage. |
1792 |
1716 |
1793 @return ETrue if Chinese ideographs are supported. */ |
1717 @return ETrue if Chinese ideographs are supported. */ |
1794 inline TBool TOpenFontFaceAttribBase::HasCJK() const |
1718 inline TBool TOpenFontFaceAttribBase::HasCJK() const |
1795 { |
1719 { |
1796 return iCoverage[1] & ECJKSet; |
1720 return iCoverage[1] & ECJKSet; |
1797 } |
1721 } |
1798 |
1722 |
1799 /** Tests if the typeface contains symbols only. |
1723 /** Tests if the typeface contains symbols only. |
1800 |
1724 |
1801 @return ETrue if the typeface contains symbols only. */ |
1725 @return ETrue if the typeface contains symbols only. */ |
1802 inline TBool TOpenFontFaceAttribBase::IsSymbol() const |
1726 inline TBool TOpenFontFaceAttribBase::IsSymbol() const |
1803 { |
1727 { |
1804 return iCoverage[0] == 0 && iCoverage[2] == 0 && iCoverage[3] == 0 && |
1728 return iCoverage[0] == 0 && iCoverage[2] == 0 && iCoverage[3] == 0 && |
1805 iCoverage[1] & ESymbolSets && !(iCoverage[1] & ~ESymbolSets); |
1729 iCoverage[1] & ESymbolSets && !(iCoverage[1] & ~ESymbolSets); |
1806 } |
1730 } |
1807 |
1731 |
1808 /** Tests if the typeface is inherently bold. |
1732 /** Tests if the typeface is inherently bold. |
1809 |
1733 |
1810 @return ETrue if the typeface is inherently bold. */ |
1734 @return ETrue if the typeface is inherently bold. */ |
1811 inline TBool TOpenFontFaceAttribBase::IsBold() const |
1735 inline TBool TOpenFontFaceAttribBase::IsBold() const |
1812 { |
1736 { |
1813 return iStyle & EBold; |
1737 return iStyle & EBold; |
1814 } |
1738 } |
1815 |
1739 |
1816 /** Tests if the typeface is inherently italic. |
1740 /** Tests if the typeface is inherently italic. |
1817 |
1741 |
1818 @return ETrue if the typeface is inherently italic. */ |
1742 @return ETrue if the typeface is inherently italic. */ |
1819 inline TBool TOpenFontFaceAttribBase::IsItalic() const |
1743 inline TBool TOpenFontFaceAttribBase::IsItalic() const |
1820 { |
1744 { |
1821 return iStyle & EItalic; |
1745 return iStyle & EItalic; |
1822 } |
1746 } |
1823 |
1747 |
1824 /** Tests if the typeface has serifs. |
1748 /** Tests if the typeface has serifs. |
1825 |
1749 |
1826 @return ETrue if the typeface has serifs. */ |
1750 @return ETrue if the typeface has serifs. */ |
1827 inline TBool TOpenFontFaceAttribBase::IsSerif() const |
1751 inline TBool TOpenFontFaceAttribBase::IsSerif() const |
1828 { |
1752 { |
1829 return iStyle & ESerif; |
1753 return iStyle & ESerif; |
1830 } |
1754 } |
1831 |
1755 |
1832 /** Tests if all the characters have the same width. |
1756 /** Tests if all the characters have the same width. |
1833 |
1757 |
1834 @return ETrue if all the characters have the same width. */ |
1758 @return ETrue if all the characters have the same width. */ |
1835 inline TBool TOpenFontFaceAttribBase::IsMonoWidth() const |
1759 inline TBool TOpenFontFaceAttribBase::IsMonoWidth() const |
1836 { |
1760 { |
1837 return iStyle & EMonoWidth; |
1761 return iStyle & EMonoWidth; |
1838 } |
1762 } |
1839 |
1763 |
1840 /** Gets the typeface's name. |
1764 /** Gets the typeface's name. |
1841 |
1765 |
1842 @return Descriptor containing typeface name. */ |
1766 @return Descriptor containing typeface name. */ |
1843 inline TPtrC TOpenFontFaceAttribBase::Name() const |
1767 inline TPtrC TOpenFontFaceAttribBase::Name() const |
1844 { |
1768 { |
1845 return iName; |
1769 return iName; |
1846 } |
1770 } |
1847 |
1771 |
1848 /** Gets the full name. |
1772 /** Gets the full name. |
1849 |
1773 |
1850 The full name of the typeface includes style attributes like Italic, Bold, |
1774 The full name of the typeface includes style attributes like Italic, Bold, |
1851 and Cursive. |
1775 and Cursive. |
1852 |
1776 |
1853 @return The full name of the typeface. |
1777 @return The full name of the typeface. |
1854 @see FamilyName() */ |
1778 @see FamilyName() */ |
1855 inline TPtrC TOpenFontFaceAttrib::FullName() const |
1779 inline TPtrC TOpenFontFaceAttrib::FullName() const |
1856 { |
1780 { |
1857 return Name(); |
1781 return Name(); |
1858 } |
1782 } |
1859 |
1783 |
1860 /** Gets the family name. |
1784 /** Gets the family name. |
1861 |
1785 |
1862 Note: The family name of the typeface does not include style attributes like |
1786 Note: The family name of the typeface does not include style attributes like |
1863 "Italic". |
1787 "Italic". |
1864 |
1788 |
1865 @return The family name of the typeface. |
1789 @return The family name of the typeface. |
1866 @see FullName() */ |
1790 @see FullName() */ |
1867 inline TPtrC TOpenFontFaceAttrib::FamilyName() const |
1791 inline TPtrC TOpenFontFaceAttrib::FamilyName() const |
1868 { |
1792 { |
1869 return iFamilyName; |
1793 return iFamilyName; |
1870 } |
1794 } |
1871 |
1795 |
1872 /** Gets the local full name. |
1796 /** Gets the local full name. |
1873 |
1797 |
1874 The local full name of the typeface includes style attributes like Italic, |
1798 The local full name of the typeface includes style attributes like Italic, |
1875 Bold, and Cursive. |
1799 Bold, and Cursive. |
1876 |
1800 |
1877 The local name of the typeface is the name in the language of the current |
1801 The local name of the typeface is the name in the language of the current |
1878 locale, where this is provided by the font file. If the local name is not |
1802 locale, where this is provided by the font file. If the local name is not |
1879 available then the local name will be the same as the ordinary name. |
1803 available then the local name will be the same as the ordinary name. |
1880 |
1804 |
1881 @return The local full name of the typeface. */ |
1805 @return The local full name of the typeface. */ |
1882 inline TPtrC TOpenFontFaceAttrib::LocalFullName() const |
1806 inline TPtrC TOpenFontFaceAttrib::LocalFullName() const |
1883 { |
1807 { |
1884 return iLocalFullName; |
1808 return iLocalFullName; |
1885 } |
1809 } |
1886 |
1810 |
1887 /** Gets the local family name. |
1811 /** Gets the local family name. |
1888 |
1812 |
1889 The local name of the typeface is the name in the language of the current |
1813 The local name of the typeface is the name in the language of the current |
1890 locale, where this is provided by the font file. If the local name is not |
1814 locale, where this is provided by the font file. If the local name is not |
1891 available then the local name will be the same as the ordinary name. |
1815 available then the local name will be the same as the ordinary name. |
1892 |
1816 |
1893 Note: The family name of the typeface does not include style attributes like |
1817 Note: The family name of the typeface does not include style attributes like |
1894 'Italic'. |
1818 'Italic'. |
1895 |
1819 |
1896 @return The local family name of the typeface. */ |
1820 @return The local family name of the typeface. */ |
1897 inline TPtrC TOpenFontFaceAttrib::LocalFamilyName() const |
1821 inline TPtrC TOpenFontFaceAttrib::LocalFamilyName() const |
1898 { |
1822 { |
1899 return iLocalFamilyName; |
1823 return iLocalFamilyName; |
1900 } |
1824 } |
1901 |
1825 |
1902 /** Gets the short full name. |
1826 /** Gets the short full name. |
1903 |
1827 |
1904 This is the full name of the typeface, truncated to KMaxTypefaceNameLength, |
1828 This is the full name of the typeface, truncated to KMaxTypefaceNameLength, |
1905 if necessary. |
1829 if necessary. |
1906 |
1830 |
1907 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1831 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1908 where necessary so that they can be used in the TTypeFace class. The Open |
1832 where necessary so that they can be used in the TTypeFace class. The Open |
1909 Font Framework allows 32 characters as a maximum name length. |
1833 Font Framework allows 32 characters as a maximum name length. |
1910 |
1834 |
1911 @return The short full name of the typeface. |
1835 @return The short full name of the typeface. |
1912 @see FullName() */ |
1836 @see FullName() */ |
1913 inline TPtrC TOpenFontFaceAttrib::ShortFullName() const |
1837 inline TPtrC TOpenFontFaceAttrib::ShortFullName() const |
1914 { |
1838 { |
1915 // Can't use TDesC::Left for this because it panics if the desired length is > the existing length! |
1839 // Can't use TDesC::Left for this because it panics if the desired length is > the existing length! |
1916 return TPtrC(iName.Ptr(),Min(iName.Length(),KMaxTypefaceNameLength)); |
1840 return TPtrC(iName.Ptr(),Min(iName.Length(),KMaxTypefaceNameLength)); |
1917 } |
1841 } |
1918 |
1842 |
1919 /** Gets the short family name. |
1843 /** Gets the short family name. |
1920 |
1844 |
1921 This is the family name, truncated to KMaxTypefaceNameLength, if necessary. |
1845 This is the family name, truncated to KMaxTypefaceNameLength, if necessary. |
1922 |
1846 |
1923 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1847 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1924 where necessary so that they can be used in the TTypeFace class. The Open |
1848 where necessary so that they can be used in the TTypeFace class. The Open |
1925 Font Framework allows 32 characters as a maximum name length. |
1849 Font Framework allows 32 characters as a maximum name length. |
1926 |
1850 |
1927 @return The short family name of the typeface. |
1851 @return The short family name of the typeface. |
1928 @see FamilyName() */ |
1852 @see FamilyName() */ |
1929 inline TPtrC TOpenFontFaceAttrib::ShortFamilyName() const |
1853 inline TPtrC TOpenFontFaceAttrib::ShortFamilyName() const |
1930 { |
1854 { |
1931 return TPtrC(iFamilyName.Ptr(),Min(iFamilyName.Length(),KMaxTypefaceNameLength)); |
1855 return TPtrC(iFamilyName.Ptr(),Min(iFamilyName.Length(),KMaxTypefaceNameLength)); |
1932 } |
1856 } |
1933 |
1857 |
1934 /** Gets the short local full name. |
1858 /** Gets the short local full name. |
1935 |
1859 |
1936 This is the local full name of the typeface, truncated to KMaxTypefaceNameLength, |
1860 This is the local full name of the typeface, truncated to KMaxTypefaceNameLength, |
1937 if necessary. |
1861 if necessary. |
1938 |
1862 |
1939 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1863 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1940 where necessary so that they can be used in the TTypeFace class. The Open |
1864 where necessary so that they can be used in the TTypeFace class. The Open |
1941 Font Framework allows 32 characters as a maximum name length. |
1865 Font Framework allows 32 characters as a maximum name length. |
1942 |
1866 |
1943 @return The short local full name of the typeface. |
1867 @return The short local full name of the typeface. |
1944 @see LocalFullName() */ |
1868 @see LocalFullName() */ |
1945 inline TPtrC TOpenFontFaceAttrib::ShortLocalFullName() const |
1869 inline TPtrC TOpenFontFaceAttrib::ShortLocalFullName() const |
1946 { |
1870 { |
1947 return TPtrC(iLocalFullName.Ptr(),Min(iLocalFullName.Length(),KMaxTypefaceNameLength)); |
1871 return TPtrC(iLocalFullName.Ptr(),Min(iLocalFullName.Length(),KMaxTypefaceNameLength)); |
1948 } |
1872 } |
1949 |
1873 |
1950 /** Gets the short local family name. |
1874 /** Gets the short local family name. |
1951 |
1875 |
1952 This is the local family name of the typeface, truncated to KMaxTypefaceNameLength, |
1876 This is the local family name of the typeface, truncated to KMaxTypefaceNameLength, |
1953 if necessary. |
1877 if necessary. |
1954 |
1878 |
1955 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1879 Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters |
1956 where necessary so that they can be used in the TTypeFace class. The Open |
1880 where necessary so that they can be used in the TTypeFace class. The Open |
1957 Font Framework allows 32 characters as a maximum name length. |
1881 Font Framework allows 32 characters as a maximum name length. |
1958 |
1882 |
1959 @return The short local family name of the typeface. |
1883 @return The short local family name of the typeface. |
1960 @see LocalFamilyName() */ |
1884 @see LocalFamilyName() */ |
1961 inline TPtrC TOpenFontFaceAttrib::ShortLocalFamilyName() const |
1885 inline TPtrC TOpenFontFaceAttrib::ShortLocalFamilyName() const |
1962 { |
1886 { |
1963 return TPtrC(iLocalFamilyName.Ptr(),Min(iLocalFamilyName.Length(),KMaxTypefaceNameLength)); |
1887 return TPtrC(iLocalFamilyName.Ptr(),Min(iLocalFamilyName.Length(),KMaxTypefaceNameLength)); |
1964 } |
1888 } |
1965 |
1889 |
1966 /** Gets a pointer to the sets of flags that indicate the font's Unicode coverage. |
1890 /** Gets a pointer to the sets of flags that indicate the font's Unicode coverage. |
1967 |
1891 |
1968 Each flag that is set represents a supported Unicode range. The mapping is |
1892 Each flag that is set represents a supported Unicode range. The mapping is |
1969 defined in the TrueType documentation under the OS/2 table. |
1893 defined in the TrueType documentation under the OS/2 table. |
1970 |
1894 |
1971 Note: Some useful subsets are defined as anonymous enumerated constants at the end |
1895 Note: Some useful subsets are defined as anonymous enumerated constants at the end |
1972 of this class, see ELatinSet etc. |
1896 of this class, see ELatinSet etc. |
1973 |
1897 |
1974 @return A pointer to the flags that indicate the font's Unicode coverage. |
1898 @return A pointer to the flags that indicate the font's Unicode coverage. |
1975 The flags are stored in an array of four 32-bit integers. When no information |
1899 The flags are stored in an array of four 32-bit integers. When no information |
1976 is available, all four integers are zero. |
1900 is available, all four integers are zero. |
1977 @see SetCoverage() */ |
1901 @see SetCoverage() */ |
1978 inline const TUint* TOpenFontFaceAttribBase::Coverage() const |
1902 inline const TUint* TOpenFontFaceAttribBase::Coverage() const |
1979 { |
1903 { |
1980 return iCoverage; |
1904 return iCoverage; |
1981 } |
1905 } |
1982 |
1906 |
1983 /** Gets the minimum typeface size. |
1907 /** Gets the minimum typeface size. |
1984 |
1908 |
1985 This is the smallest size that can be drawn legibly. |
1909 This is the smallest size that can be drawn legibly. |
1986 |
1910 |
1987 @return The minimum typeface size (in pixels). */ |
1911 @return The minimum typeface size (in pixels). */ |
1988 inline TInt TOpenFontFaceAttrib::MinSizeInPixels() const |
1912 inline TInt TOpenFontFaceAttrib::MinSizeInPixels() const |
1989 { |
1913 { |
1990 return iMinSizeInPixels; |
1914 return iMinSizeInPixels; |
1991 } |
1915 } |
1992 |
1916 |
1993 /** Sets the name attribute. |
1917 /** Sets the name attribute. |
1994 |
1918 |
1995 @param aName Descriptor containing typeface name. */ |
1919 @param aName Descriptor containing typeface name. */ |
1996 inline void TOpenFontFaceAttribBase::SetName(const TDesC& aName) |
1920 inline void TOpenFontFaceAttribBase::SetName(const TDesC& aName) |
1997 { |
1921 { |
1998 iName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
1922 iName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
1999 } |
1923 } |
2000 |
1924 |
2001 /** Sets the full name. |
1925 /** Sets the full name. |
2002 |
1926 |
2003 @param aName The full name of the typeface. |
1927 @param aName The full name of the typeface. |
2004 @see FullName() */ |
1928 @see FullName() */ |
2005 inline void TOpenFontFaceAttrib::SetFullName(const TDesC& aName) |
1929 inline void TOpenFontFaceAttrib::SetFullName(const TDesC& aName) |
2006 { |
1930 { |
2007 SetName(aName); |
1931 SetName(aName); |
2008 } |
1932 } |
2009 |
1933 |
2010 /** Sets the family name. |
1934 /** Sets the family name. |
2011 |
1935 |
2012 @param aName The family name of the typeface. |
1936 @param aName The family name of the typeface. |
2013 @see FamilyName() */ |
1937 @see FamilyName() */ |
2014 inline void TOpenFontFaceAttrib::SetFamilyName(const TDesC& aName) |
1938 inline void TOpenFontFaceAttrib::SetFamilyName(const TDesC& aName) |
2015 { |
1939 { |
2016 iFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
1940 iFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
2017 } |
1941 } |
2018 |
1942 |
2019 /** Sets the local full name. |
1943 /** Sets the local full name. |
2020 |
1944 |
2021 @param aName The local full name of the typeface. |
1945 @param aName The local full name of the typeface. |
2022 @see LocalFullName() */ |
1946 @see LocalFullName() */ |
2023 inline void TOpenFontFaceAttrib::SetLocalFullName(const TDesC& aName) |
1947 inline void TOpenFontFaceAttrib::SetLocalFullName(const TDesC& aName) |
2024 { |
1948 { |
2025 iLocalFullName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
1949 iLocalFullName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
2026 } |
1950 } |
2027 |
1951 |
2028 /** Sets the local family name. |
1952 /** Sets the local family name. |
2029 |
1953 |
2030 @param aName The local family name of the typeface. |
1954 @param aName The local family name of the typeface. |
2031 @see LocalFamilyName() */ |
1955 @see LocalFamilyName() */ |
2032 inline void TOpenFontFaceAttrib::SetLocalFamilyName(const TDesC& aName) |
1956 inline void TOpenFontFaceAttrib::SetLocalFamilyName(const TDesC& aName) |
2033 { |
1957 { |
2034 iLocalFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
1958 iLocalFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); |
2053 iCoverage[0] = aCoverage0; |
1977 iCoverage[0] = aCoverage0; |
2054 iCoverage[1] = aCoverage1; |
1978 iCoverage[1] = aCoverage1; |
2055 iCoverage[2] = aCoverage2; |
1979 iCoverage[2] = aCoverage2; |
2056 iCoverage[3] = aCoverage3; |
1980 iCoverage[3] = aCoverage3; |
2057 } |
1981 } |
2058 |
1982 |
2059 /** Set the minimum typeface size. |
1983 /** Set the minimum typeface size. |
2060 |
1984 |
2061 This is the smallest size that can be drawn legibly. |
1985 This is the smallest size that can be drawn legibly. |
2062 |
1986 |
2063 @param aSize Sets the minimum typeface size (in pixels). |
1987 @param aSize Sets the minimum typeface size (in pixels). |
2064 @see MinSizeInPixels() */ |
1988 @see MinSizeInPixels() */ |
2065 inline void TOpenFontFaceAttrib::SetMinSizeInPixels(TInt aSize) |
1989 inline void TOpenFontFaceAttrib::SetMinSizeInPixels(TInt aSize) |
2066 { |
1990 { |
2067 iMinSizeInPixels = aSize; |
1991 iMinSizeInPixels = aSize; |
2068 } |
1992 } |
2069 |
1993 |
2070 /** Equality operator. |
1994 /** Equality operator. |
2071 |
1995 |
2072 Compares this and another set of font attributes, including the coverage, |
1996 Compares this and another set of font attributes, including the coverage, |
2073 the family name, the local full name, the local family name, and the minimum |
1997 the family name, the local full name, the local family name, and the minimum |
2074 size in pixels. |
1998 size in pixels. |
2075 |
1999 |
2076 @param aAttrib Contains the font attributes and names to compare. |
2000 @param aAttrib Contains the font attributes and names to compare. |
2077 @return ETrue if all values are equal, EFalse if not. */ |
2001 @return ETrue if all values are equal, EFalse if not. */ |
2078 inline TBool TOpenFontFaceAttrib::operator==(const TOpenFontFaceAttrib& aAttrib) const |
2002 inline TBool TOpenFontFaceAttrib::operator==(const TOpenFontFaceAttrib& aAttrib) const |
2079 { |
2003 { |
2080 return TOpenFontFaceAttribBase::operator==(aAttrib) && |
2004 return TOpenFontFaceAttribBase::operator==(aAttrib) && |
2094 else |
2018 else |
2095 iStyle &= ~EBold; |
2019 iStyle &= ~EBold; |
2096 } |
2020 } |
2097 |
2021 |
2098 /** Sets the italic attribute. |
2022 /** Sets the italic attribute. |
2099 |
2023 |
2100 @param aItalic The italic attribute takes this value ETrue or EFalse. */ |
2024 @param aItalic The italic attribute takes this value ETrue or EFalse. */ |
2101 inline void TOpenFontFaceAttribBase::SetItalic(TBool aItalic) |
2025 inline void TOpenFontFaceAttribBase::SetItalic(TBool aItalic) |
2102 { |
2026 { |
2103 if (aItalic) |
2027 if (aItalic) |
2104 iStyle |= EItalic; |
2028 iStyle |= EItalic; |
2105 else |
2029 else |
2106 iStyle &= ~EItalic; |
2030 iStyle &= ~EItalic; |
2107 } |
2031 } |
2108 |
2032 |
2109 /** Sets the serif attribute. |
2033 /** Sets the serif attribute. |
2110 |
2034 |
2111 @param aSerif The serif attribute takes this value ETrue or EFalse. */ |
2035 @param aSerif The serif attribute takes this value ETrue or EFalse. */ |
2112 inline void TOpenFontFaceAttribBase::SetSerif(TBool aSerif) |
2036 inline void TOpenFontFaceAttribBase::SetSerif(TBool aSerif) |
2113 { |
2037 { |
2114 if (aSerif) |
2038 if (aSerif) |
2115 iStyle |= ESerif; |
2039 iStyle |= ESerif; |
2127 else |
2051 else |
2128 iStyle &= ~EMonoWidth; |
2052 iStyle &= ~EMonoWidth; |
2129 } |
2053 } |
2130 |
2054 |
2131 /** Equality operator. |
2055 /** Equality operator. |
2132 |
2056 |
2133 Compares this and a specified set of font attributes, including the coverage |
2057 Compares this and a specified set of font attributes, including the coverage |
2134 and the typeface name. |
2058 and the typeface name. |
2135 |
2059 |
2136 In version 6.1, and earlier, the return value was TInt. |
2060 In version 6.1, and earlier, the return value was TInt. |
2137 |
2061 |
2138 @param aAttrib The font attributes to compare. This is an object of TOpenFontFaceAttribBase |
2062 @param aAttrib The font attributes to compare. This is an object of TOpenFontFaceAttribBase |
2139 or of a derived class. |
2063 or of a derived class. |
2140 @return ETrue if the values are equal. */ |
2064 @return ETrue if the values are equal. */ |
2141 inline TBool TOpenFontFaceAttribBase::operator==(const TOpenFontFaceAttribBase& aAttrib) const |
2065 inline TBool TOpenFontFaceAttribBase::operator==(const TOpenFontFaceAttribBase& aAttrib) const |
2142 { |
2066 { |
2167 iPrintPosition == aOpenFontSpec.iPrintPosition && |
2091 iPrintPosition == aOpenFontSpec.iPrintPosition && |
2168 TOpenFontFaceAttribBase::operator==(aOpenFontSpec); |
2092 TOpenFontFaceAttribBase::operator==(aOpenFontSpec); |
2169 } |
2093 } |
2170 |
2094 |
2171 /** Gets the height of the font. |
2095 /** Gets the height of the font. |
2172 |
2096 |
2173 @return The height of the font, in pixels or twips. |
2097 @return The height of the font, in pixels or twips. |
2174 @see SetHeight() */ |
2098 @see SetHeight() */ |
2175 inline TInt TOpenFontSpec::Height() const |
2099 inline TInt TOpenFontSpec::Height() const |
2176 { |
2100 { |
2177 return iHeight; |
2101 return iHeight; |
2178 } |
2102 } |
2179 |
2103 |
2180 /** Gets the algorithmic width factor. |
2104 /** Gets the algorithmic width factor. |
2181 |
2105 |
2182 @return The algorithmic width factor as a 16.16 fixed-point number. |
2106 @return The algorithmic width factor as a 16.16 fixed-point number. |
2183 @see SetWidthFactor() */ |
2107 @see SetWidthFactor() */ |
2184 inline TInt32 TOpenFontSpec::WidthFactor() const |
2108 inline TInt32 TOpenFontSpec::WidthFactor() const |
2185 { |
2109 { |
2186 return iWidthFactor; |
2110 return iWidthFactor; |
2187 } |
2111 } |
2188 |
2112 |
2189 /** Gets the algorithmic slant factor. |
2113 /** Gets the algorithmic slant factor. |
2190 |
2114 |
2191 @return The algorithmic slant factor as a 16.16 fixed-point number. |
2115 @return The algorithmic slant factor as a 16.16 fixed-point number. |
2192 @see SetSlantFactor() */ |
2116 @see SetSlantFactor() */ |
2193 inline TInt32 TOpenFontSpec::SlantFactor() const |
2117 inline TInt32 TOpenFontSpec::SlantFactor() const |
2194 { |
2118 { |
2195 return iSlantFactor; |
2119 return iSlantFactor; |
2196 } |
2120 } |
2197 |
2121 |
2198 /** Gets the anti-aliasing setting for the font, as set by SetBitmapType(). |
2122 /** Gets the anti-aliasing setting for the font, as set by SetBitmapType(). |
2199 |
2123 |
2200 @return Indicates whether or not the font should be drawn using anti-aliasing. */ |
2124 @return Indicates whether or not the font should be drawn using anti-aliasing. */ |
2201 inline TGlyphBitmapType TOpenFontSpec::BitmapType() const |
2125 inline TGlyphBitmapType TOpenFontSpec::BitmapType() const |
2202 { |
2126 { |
2203 return (TGlyphBitmapType)iBitmapType; |
2127 return (TGlyphBitmapType)iBitmapType; |
2204 } |
2128 } |
2215 { |
2139 { |
2216 return iEffects; |
2140 return iEffects; |
2217 } |
2141 } |
2218 |
2142 |
2219 /** Gets the print position. |
2143 /** Gets the print position. |
2220 |
2144 |
2221 @return The print position. */ |
2145 @return The print position. */ |
2222 inline TFontPrintPosition TOpenFontSpec::PrintPosition() const |
2146 inline TFontPrintPosition TOpenFontSpec::PrintPosition() const |
2223 { |
2147 { |
2224 return iPrintPosition; |
2148 return iPrintPosition; |
2225 } |
2149 } |
2226 |
2150 |
2227 /** Sets the font's height. |
2151 /** Sets the font's height. |
2228 |
2152 |
2229 @param aHeight The font's height, in pixels or twips. |
2153 @param aHeight The font's height, in pixels or twips. |
2230 @see Height() */ |
2154 @see Height() */ |
2231 inline void TOpenFontSpec::SetHeight(TInt aHeight) |
2155 inline void TOpenFontSpec::SetHeight(TInt aHeight) |
2232 { |
2156 { |
2233 iHeight = aHeight; |
2157 iHeight = aHeight; |
2234 } |
2158 } |
2235 |
2159 |
2236 /** Sets the algorithmic width factor. |
2160 /** Sets the algorithmic width factor. |
2237 |
2161 |
2238 The width factor is multiplied by the pixel's x position to get the new position, |
2162 The width factor is multiplied by the pixel's x position to get the new position, |
2239 causing characters to become wider or narrower. A width factor of 1 (65536 |
2163 causing characters to become wider or narrower. A width factor of 1 (65536 |
2240 in 16.16 fixed-point number format) should be used if the character width |
2164 in 16.16 fixed-point number format) should be used if the character width |
2241 is not to be changed. |
2165 is not to be changed. |
2242 |
2166 |
2243 @param aWidthFactor The algorithmic width factor as a 16.16 fixed-point number. |
2167 @param aWidthFactor The algorithmic width factor as a 16.16 fixed-point number. |
2244 @see WidthFactor() */ |
2168 @see WidthFactor() */ |
2245 inline void TOpenFontSpec::SetWidthFactor(TInt32 aWidthFactor) |
2169 inline void TOpenFontSpec::SetWidthFactor(TInt32 aWidthFactor) |
2246 { |
2170 { |
2247 iWidthFactor = aWidthFactor; |
2171 iWidthFactor = aWidthFactor; |
2248 } |
2172 } |
2249 |
2173 |
2250 /** Sets the algorithmic slant factor. |
2174 /** Sets the algorithmic slant factor. |
2251 |
2175 |
2252 Note: The slant factor is used to create an italic effect for characters which |
2176 Note: The slant factor is used to create an italic effect for characters which |
2253 do not have an italic glyph in the typeface. When slanting is active, pixel x |
2177 do not have an italic glyph in the typeface. When slanting is active, pixel x |
2254 co-ordinates are shifted by a factor relative to the y co-ordinate (i.e. x |
2178 co-ordinates are shifted by a factor relative to the y co-ordinate (i.e. x |
2255 = x + y x slant factor). |
2179 = x + y x slant factor). |
2256 |
2180 |
2257 The slant factor is a 32 bit, 16.16 fixed-point number. This means that the |
2181 The slant factor is a 32 bit, 16.16 fixed-point number. This means that the |
2258 first 16 bits are treated as a whole number, and the second 16 as the fractional |
2182 first 16 bits are treated as a whole number, and the second 16 as the fractional |
2259 part. e.g. if aSlantFactor=0, there is no slant. If aSlantFactor=65536 this |
2183 part. e.g. if aSlantFactor=0, there is no slant. If aSlantFactor=65536 this |
2260 is equivalent to an integer slant value of 1, which causes a 45 degree slant |
2184 is equivalent to an integer slant value of 1, which causes a 45 degree slant |
2261 on the character. |
2185 on the character. |
2262 |
2186 |
2263 @param aSlantFactor The slant factor as a 16.16 fixed-point number. |
2187 @param aSlantFactor The slant factor as a 16.16 fixed-point number. |
2264 @see SlantFactor() */ |
2188 @see SlantFactor() */ |
2265 inline void TOpenFontSpec::SetSlantFactor(TInt32 aSlantFactor) |
2189 inline void TOpenFontSpec::SetSlantFactor(TInt32 aSlantFactor) |
2266 { |
2190 { |
2267 iSlantFactor = aSlantFactor; |
2191 iSlantFactor = aSlantFactor; |
2268 } |
2192 } |
2269 |
2193 |
2270 /** Sets whether the font should be drawn using anti-aliasing. If set, this value |
2194 /** Sets whether the font should be drawn using anti-aliasing. If set, this value |
2271 overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType()) |
2195 overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType()) |
2272 for this font. |
2196 for this font. |
2273 |
2197 |
2274 Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing |
2198 Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing |
2275 support for bitmapped fonts. |
2199 support for bitmapped fonts. |
2276 |
2200 |
2277 @param aBitmapType Indicates whether or not the font should be drawn using |
2201 @param aBitmapType Indicates whether or not the font should be drawn using |
2278 anti-aliasing. */ |
2202 anti-aliasing. */ |
2279 inline void TOpenFontSpec::SetBitmapType(TGlyphBitmapType aBitmapType) |
2203 inline void TOpenFontSpec::SetBitmapType(TGlyphBitmapType aBitmapType) |
2280 { |
2204 { |
2281 iBitmapType = aBitmapType; |
2205 iBitmapType = aBitmapType; |
2293 { |
2217 { |
2294 iEffects = aEffects; |
2218 iEffects = aEffects; |
2295 } |
2219 } |
2296 |
2220 |
2297 /** Gets the font file's UID. |
2221 /** Gets the font file's UID. |
2298 |
2222 |
2299 @return The uid of the file. */ |
2223 @return The uid of the file. */ |
2300 inline TUid COpenFontFile::Uid() const |
2224 inline TUid COpenFontFile::Uid() const |
2301 { |
2225 { |
2302 return iUid; |
2226 return iUid; |
2303 } |
2227 } |
2304 |
2228 |
2305 /** Gets the full path and filename of the font file |
2229 /** Gets the full path and filename of the font file |
2306 |
2230 |
2307 This is the filename that was passed to the constructor when the object is |
2231 This is the filename that was passed to the constructor when the object is |
2308 created. |
2232 created. |
2309 |
2233 |
2310 @return The filename of the font file. */ |
2234 @return The filename of the font file. */ |
2311 inline const TDesC& COpenFontFile::FileName() const |
2235 inline const TDesC& COpenFontFile::FileName() const |
2312 { |
2236 { |
2313 return iFileName; |
2237 return iFileName; |
2314 } |
2238 } |
2315 |
2239 |
2316 /** Gets the typeface at a specified index in the typeface attribute array. |
2240 /** Gets the typeface at a specified index in the typeface attribute array. |
2317 |
2241 |
2318 @param aFaceIndex The index of the typeface for which the attributes are required. |
2242 @param aFaceIndex The index of the typeface for which the attributes are required. |
2319 @return The attributes of the typeface with the specified index. |
2243 @return The attributes of the typeface with the specified index. |
2320 @see AddFaceL() |
2244 @see AddFaceL() |
2321 @see FaceCount() */ |
2245 @see FaceCount() */ |
2322 inline const TOpenFontFaceAttrib& COpenFontFile::FaceAttrib(TInt aFaceIndex) const |
2246 inline const TOpenFontFaceAttrib& COpenFontFile::FaceAttrib(TInt aFaceIndex) const |
2323 { |
2247 { |
2324 return iFaceAttrib[aFaceIndex]; |
2248 return iFaceAttrib[aFaceIndex]; |
2325 } |
2249 } |
2326 |
2250 |
2327 /** Gets the number of typefaces in the typeface attributes array. |
2251 /** Gets the number of typefaces in the typeface attributes array. |
2328 |
2252 |
2329 This is the number of typefaces in the font file: the attributes for each |
2253 This is the number of typefaces in the font file: the attributes for each |
2330 typeface should be loaded into the array when the derived object is constructed. |
2254 typeface should be loaded into the array when the derived object is constructed. |
2331 |
2255 |
2334 @see FaceAttrib() */ |
2258 @see FaceAttrib() */ |
2335 inline TInt COpenFontFile::FaceCount() const |
2259 inline TInt COpenFontFile::FaceCount() const |
2336 { |
2260 { |
2337 return iFaceAttrib.Count(); |
2261 return iFaceAttrib.Count(); |
2338 } |
2262 } |
2339 |
2263 |
2340 /** Increments a reference count by one. |
2264 /** Increments a reference count by one. |
2341 |
2265 |
2342 @see DecRefCount() */ |
2266 @see DecRefCount() */ |
2343 inline void COpenFontFile::IncRefCount() |
2267 inline void COpenFontFile::IncRefCount() |
2344 { |
2268 { |
2345 iRefCount++; |
2269 iRefCount++; |
2346 } |
2270 } |
2347 |
2271 |
2348 /** Decrement a reference count by one. |
2272 /** Decrement a reference count by one. |
2349 |
2273 |
2350 @return ETrue if the reference count has reached zero (i.e. is less than or |
2274 @return ETrue if the reference count has reached zero (i.e. is less than or |
2351 equal to zero); EFalse if the reference count has not yet reached zero (i.e. |
2275 equal to zero); EFalse if the reference count has not yet reached zero (i.e. |
2352 is positive). |
2276 is positive). |
2353 @see IncRefCount() */ |
2277 @see IncRefCount() */ |
2354 inline TBool COpenFontFile::DecRefCount() |
2278 inline TBool COpenFontFile::DecRefCount() |
2355 { |
2279 { |
2356 iRefCount--; |
2280 iRefCount--; |
2357 return iRefCount <= 0; |
2281 return iRefCount <= 0; |
2358 } |
2282 } |
2359 |
2283 |
2360 /** Default C++ constructor. */ |
2284 /** Default C++ constructor. */ |
2361 inline COpenFontRasterizerContext::COpenFontRasterizerContext(): |
2285 inline COpenFontRasterizerContext::COpenFontRasterizerContext(): |
2362 iGlyphData(NULL) |
2286 iGlyphData(NULL) |
2363 { |
2287 { |
2364 } |
2288 } |
2365 |
2289 |
2366 /** Start writing the glyph data. |
2290 /** Start writing the glyph data. |
2367 |
2291 |
2368 Use this function to initialise the buffer to which the glyph bitmap is to |
2292 Use this function to initialise the buffer to which the glyph bitmap is to |
2369 be written. Call WriteGlyphBit() to add bits to the buffer. |
2293 be written. Call WriteGlyphBit() to add bits to the buffer. |
2370 |
2294 |
2371 @param aGlyphData A pointer to the glyph data. */ |
2295 @param aGlyphData A pointer to the glyph data. */ |
2372 inline void COpenFontRasterizerContext::StartGlyph(TOpenFontGlyphData* aGlyphData) |
2296 inline void COpenFontRasterizerContext::StartGlyph(TOpenFontGlyphData* aGlyphData) |
2373 { |
2297 { |
2374 aGlyphData->SetPointersToInternalBuffers(); |
2298 aGlyphData->SetPointersToInternalBuffers(); |
2375 iGlyphData = aGlyphData; |
2299 iGlyphData = aGlyphData; |
2379 iGlyphBit = 1; |
2303 iGlyphBit = 1; |
2380 *iGlyphDataPtr = 0; |
2304 *iGlyphDataPtr = 0; |
2381 iBytesNeeded = 1; |
2305 iBytesNeeded = 1; |
2382 iOverflow = FALSE; |
2306 iOverflow = FALSE; |
2383 } |
2307 } |
2384 |
2308 |
2385 /** Writes a bit to the glyph buffer. |
2309 /** Writes a bit to the glyph buffer. |
2386 |
2310 |
2387 Before calling this function you should first call StartGlyph(). |
2311 Before calling this function you should first call StartGlyph(). |
2388 |
2312 |
2389 @param aBit The bit to be added to the buffer. */ |
2313 @param aBit The bit to be added to the buffer. */ |
2390 inline void COpenFontRasterizerContext::WriteGlyphBit(TInt aBit) |
2314 inline void COpenFontRasterizerContext::WriteGlyphBit(TInt aBit) |
2391 { |
2315 { |
2392 if (aBit && !iOverflow) |
2316 if (aBit && !iOverflow) |
2393 *iGlyphDataPtr |= iGlyphBit; |
2317 *iGlyphDataPtr |= iGlyphBit; |
2414 *iGlyphDataPtr++ = (TUint8)aByte; |
2338 *iGlyphDataPtr++ = (TUint8)aByte; |
2415 else |
2339 else |
2416 iOverflow = TRUE; |
2340 iOverflow = TRUE; |
2417 iBytesNeeded++; |
2341 iBytesNeeded++; |
2418 } |
2342 } |
2419 |
2343 |
2420 /** Completes writing glyph data. |
2344 /** Completes writing glyph data. |
2421 |
2345 |
2422 Use this function to complete writing the glyph bitmap to the buffer. Call |
2346 Use this function to complete writing the glyph bitmap to the buffer. Call |
2423 it after adding all necessary bits using WriteGlyphBit(). */ |
2347 it after adding all necessary bits using WriteGlyphBit(). */ |
2424 inline void COpenFontRasterizerContext::EndGlyph() |
2348 inline void COpenFontRasterizerContext::EndGlyph() |
2425 { |
2349 { |
2426 // Add 4 bytes to the data size; some BITGDI functions require this. |
2350 // Add 4 bytes to the data size; some BITGDI functions require this. |
2427 iGlyphData->SetBytesNeeded(iBytesNeeded + 4); |
2351 iGlyphData->SetBytesNeeded(iBytesNeeded + 4); |
2428 iGlyphData = NULL; |
2352 iGlyphData = NULL; |
2429 } |
2353 } |
2430 |
2354 |
2431 /** Tests whether the bitmap buffer is large enough to hold the bitmap. |
2355 /** Tests whether the bitmap buffer is large enough to hold the bitmap. |
2432 |
2356 |
2433 @return ETrue if the bitmap will overflow its buffer, otherwise EFalse. */ |
2357 @return ETrue if the bitmap will overflow its buffer, otherwise EFalse. */ |
2434 inline TBool TOpenFontGlyphData::Overflow() const |
2358 inline TBool TOpenFontGlyphData::Overflow() const |
2435 { |
2359 { |
2436 return iBytesNeeded > iBitmapBufferSize; |
2360 return iBytesNeeded > iBitmapBufferSize; |
2437 } |
2361 } |
2438 |
2362 |
2439 /** Gets the number of bytes needed to store the glyph bitmap. |
2363 /** Gets the number of bytes needed to store the glyph bitmap. |
2440 |
2364 |
2441 @return The number of bytes needed to store the glyph bitmap. |
2365 @return The number of bytes needed to store the glyph bitmap. |
2442 @see SetBytesNeeded() */ |
2366 @see SetBytesNeeded() */ |
2443 inline TInt TOpenFontGlyphData::BytesNeeded() const |
2367 inline TInt TOpenFontGlyphData::BytesNeeded() const |
2444 { |
2368 { |
2445 return iBytesNeeded; |
2369 return iBytesNeeded; |
2446 } |
2370 } |
2447 |
2371 |
2448 /** Gets a constant pointer descriptor containing the bitmap this object |
2372 /** Gets a constant pointer descriptor containing the bitmap this object |
2449 represents. |
2373 represents. |
2450 |
2374 |
2451 @return Pointer descriptor for the glyph. */ |
2375 @return Pointer descriptor for the glyph. */ |
2452 inline TPtrC8 TOpenFontGlyphData::Bitmap() const |
2376 inline TPtrC8 TOpenFontGlyphData::Bitmap() const |
2453 { |
2377 { |
2454 return TPtrC8(iBitmap,iBytesNeeded); |
2378 return TPtrC8(iBitmap,iBytesNeeded); |
2455 } |
2379 } |
2456 |
2380 |
2457 /** Gets a pointer to the bitmap. |
2381 /** Gets a pointer to the bitmap. |
2458 |
2382 |
2459 This points either to the buffer used to write the bitmap when it is first |
2383 This points either to the buffer used to write the bitmap when it is first |
2460 rasterized, or to the cache if the character was already rasterized. |
2384 rasterized, or to the cache if the character was already rasterized. |
2461 |
2385 |
2462 @return A pointer to the bitmap. */ |
2386 @return A pointer to the bitmap. */ |
2463 inline const TUint8* TOpenFontGlyphData::BitmapPointer() const |
2387 inline const TUint8* TOpenFontGlyphData::BitmapPointer() const |
2464 { |
2388 { |
2465 return iBitmap; |
2389 return iBitmap; |
2466 } |
2390 } |
2467 |
2391 |
2468 /** Gets the character's metrics. |
2392 /** Gets the character's metrics. |
2469 |
2393 |
2470 @return The character's open font metrics. */ |
2394 @return The character's open font metrics. */ |
2471 inline const TOpenFontCharMetrics* TOpenFontGlyphData::Metrics() const |
2395 inline const TOpenFontCharMetrics* TOpenFontGlyphData::Metrics() const |
2472 { |
2396 { |
2473 return iMetrics; |
2397 return iMetrics; |
2474 } |
2398 } |
2475 |
2399 |
2476 /** Gets a pointer to the start of the bitmap buffer. |
2400 /** Gets a pointer to the start of the bitmap buffer. |
2477 |
2401 |
2478 @return A pointer to the start of the bitmap buffer. */ |
2402 @return A pointer to the start of the bitmap buffer. */ |
2479 inline TUint8* TOpenFontGlyphData::BufferStart() |
2403 inline TUint8* TOpenFontGlyphData::BufferStart() |
2480 { |
2404 { |
2481 return iBitmapBuffer; |
2405 return iBitmapBuffer; |
2482 } |
2406 } |
2483 |
2407 |
2484 /** Gets a pointer to the end of the bitmap buffer. |
2408 /** Gets a pointer to the end of the bitmap buffer. |
2485 |
2409 |
2486 @return A pointer to the end of the bitmap buffer. */ |
2410 @return A pointer to the end of the bitmap buffer. */ |
2487 inline TUint8* TOpenFontGlyphData::BufferEnd() |
2411 inline TUint8* TOpenFontGlyphData::BufferEnd() |
2488 { |
2412 { |
2489 return iBitmapBuffer + iBitmapBufferSize; |
2413 return iBitmapBuffer + iBitmapBufferSize; |
2490 } |
2414 } |
2491 |
2415 |
2492 /** Sets the number of bytes needed to store the glyph bitmap. |
2416 /** Sets the number of bytes needed to store the glyph bitmap. |
2493 |
2417 |
2494 @param aBytes The number of bytes needed to store the glyph bitmap. |
2418 @param aBytes The number of bytes needed to store the glyph bitmap. |
2495 @see BytesNeeded() */ |
2419 @see BytesNeeded() */ |
2496 inline void TOpenFontGlyphData::SetBytesNeeded(TInt aBytes) |
2420 inline void TOpenFontGlyphData::SetBytesNeeded(TInt aBytes) |
2497 { |
2421 { |
2498 iBytesNeeded = aBytes; |
2422 iBytesNeeded = aBytes; |
2499 } |
2423 } |
2500 |
2424 |
2501 /** Sets the pointer to the bitmap buffer. |
2425 /** Sets the pointer to the bitmap buffer. |
2502 |
2426 |
2503 @param aBitmap The pointer to the bitmap buffer. */ |
2427 @param aBitmap The pointer to the bitmap buffer. */ |
2504 inline void TOpenFontGlyphData::SetBitmapPointer(const TUint8* aBitmap) |
2428 inline void TOpenFontGlyphData::SetBitmapPointer(const TUint8* aBitmap) |
2505 { |
2429 { |
2506 iBitmap = aBitmap; |
2430 iBitmap = aBitmap; |
2507 } |
2431 } |
2508 |
2432 |
2509 /** Sets the character's metrics, passing a pointer to a TOpenFontCharMetrics object. |
2433 /** Sets the character's metrics, passing a pointer to a TOpenFontCharMetrics object. |
2510 |
2434 |
2511 @param aMetrics A pointer to the character's open font character metrics. */ |
2435 @param aMetrics A pointer to the character's open font character metrics. */ |
2512 inline void TOpenFontGlyphData::SetMetricsPointer(const TOpenFontCharMetrics* aMetrics) |
2436 inline void TOpenFontGlyphData::SetMetricsPointer(const TOpenFontCharMetrics* aMetrics) |
2513 { |
2437 { |
2514 iMetrics = aMetrics; |
2438 iMetrics = aMetrics; |
2515 } |
2439 } |
2516 |
2440 |
2517 /** Sets the bitmap and metrics pointers to point to the internal buffers. |
2441 /** Sets the bitmap and metrics pointers to point to the internal buffers. |
2518 |
2442 |
2519 The alternative is that the pointers point to the cache of metrics and bitmaps |
2443 The alternative is that the pointers point to the cache of metrics and bitmaps |
2520 that have already been rasterized. */ |
2444 that have already been rasterized. */ |
2521 inline void TOpenFontGlyphData::SetPointersToInternalBuffers() |
2445 inline void TOpenFontGlyphData::SetPointersToInternalBuffers() |
2522 { |
2446 { |
2523 iBitmap = iBitmapBuffer; |
2447 iBitmap = iBitmapBuffer; |
2524 iMetrics = &iMetricsBuffer; |
2448 iMetrics = &iMetricsBuffer; |
2525 } |
2449 } |
2526 |
2450 |
2527 /** Sets the character's metrics, passing a reference to a TOpenFontCharMetrics |
2451 /** Sets the character's metrics, passing a reference to a TOpenFontCharMetrics |
2528 object. |
2452 object. |
2529 |
2453 |
2530 @param aMetrics The character's open font character metrics. */ |
2454 @param aMetrics The character's open font character metrics. */ |
2531 inline void TOpenFontGlyphData::SetMetrics(TOpenFontCharMetrics& aMetrics) |
2455 inline void TOpenFontGlyphData::SetMetrics(TOpenFontCharMetrics& aMetrics) |
2532 { |
2456 { |
2533 iMetricsBuffer = aMetrics; |
2457 iMetricsBuffer = aMetrics; |
2534 iMetrics = &iMetricsBuffer; |
2458 iMetrics = &iMetricsBuffer; |
2535 } |
2459 } |
2536 |
2460 |
2537 /** Sets the glyph index. |
2461 /** Sets the glyph index. |
2538 |
2462 |
2539 @param aGlyphIndex The glyph index. */ |
2463 @param aGlyphIndex The glyph index. */ |
2540 inline void TOpenFontGlyphData::SetGlyphIndex(TInt aGlyphIndex) |
2464 inline void TOpenFontGlyphData::SetGlyphIndex(TInt aGlyphIndex) |
2541 { |
2465 { |
2542 iGlyphIndex = aGlyphIndex; |
2466 iGlyphIndex = aGlyphIndex; |
2543 } |
2467 } |
2544 |
|
2545 /** Uses ECOM plug-in framework to instantiate the Open Font rasterizer interface |
|
2546 implementation given its implementation UID. |
|
2547 |
|
2548 @param "TUid aInterfaceImplUid" |
|
2549 The UID of the interface implementation required |
|
2550 |
|
2551 @return "COpenFontRasterizer*" |
|
2552 A pointer to a COpenFontRasterizer object. */ |
|
2553 inline COpenFontRasterizer* COpenFontRasterizer::NewL(TUid aInterfaceImplUid) |
|
2554 { |
|
2555 return reinterpret_cast <COpenFontRasterizer*> ( |
|
2556 REComSession::CreateImplementationL( |
|
2557 aInterfaceImplUid, |
|
2558 _FOFF(COpenFontRasterizer, iDtor_ID_Key))); |
|
2559 } |
|
2560 |
|
2561 /** Default destructor */ |
|
2562 inline COpenFontRasterizer::~COpenFontRasterizer() |
|
2563 { |
|
2564 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
2565 } |
|
2566 |
2468 |
2567 /** Uses ECOM plug-in framework to instantiate the shaper factory interface |
2469 /** Uses ECOM plug-in framework to instantiate the shaper factory interface |
2568 implementation given its implementation UID. |
2470 implementation given its implementation UID. |
2569 |
2471 |
2570 @param "TUid aInterfaceImplUid" |
2472 @param aInterfaceImplUid The UID of the interface implementation required |
2571 The UID of the interface implementation required |
2473 |
2572 |
2474 @return CShaperFactory* A pointer to a CShaperFactory object. */ |
2573 @return "CShaperFactory*" |
|
2574 A pointer to a CShaperFactory object. */ |
|
2575 inline CShaperFactory* CShaperFactory::NewL(TUid aInterfaceImplUid) |
2475 inline CShaperFactory* CShaperFactory::NewL(TUid aInterfaceImplUid) |
2576 { |
2476 { |
2577 return reinterpret_cast <CShaperFactory*> ( |
2477 return reinterpret_cast <CShaperFactory*> ( |
2578 REComSession::CreateImplementationL( |
2478 REComSession::CreateImplementationL( |
2579 aInterfaceImplUid, |
2479 aInterfaceImplUid, |
2584 inline CShaperFactory::~CShaperFactory() |
2484 inline CShaperFactory::~CShaperFactory() |
2585 { |
2485 { |
2586 REComSession::DestroyedImplementation(iDtor_ID_Key); |
2486 REComSession::DestroyedImplementation(iDtor_ID_Key); |
2587 } |
2487 } |
2588 |
2488 |
2589 #endif // OPENFONT_H__ |
2489 #endif // __OPENFONT_H__ |