45
|
1 |
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// This file is a subset of original gdi.h.
|
|
15 |
//
|
|
16 |
// IMPORTANT NOTE to maintainer:
|
|
17 |
// If you add new exports, to make sure they are exported by GDI.DLL,
|
|
18 |
// remember to update /graphics/graphicsdeviceinterface/gdi/sgdi/TextBaseStub.cpp.
|
|
19 |
//
|
|
20 |
// Text related types/consts are moved from gdi.h to this file, as listed below.
|
|
21 |
//
|
|
22 |
// enum TFontPosture
|
|
23 |
// enum TFontStrokeWeight
|
|
24 |
// enum TFontPrintPosition
|
|
25 |
//
|
|
26 |
// const KMaxTypefaceNameLength
|
|
27 |
// class TTypeface
|
|
28 |
// enum TGlyphBitmapType
|
|
29 |
// class FontEffect
|
|
30 |
// class TFontStyle
|
|
31 |
// class TFontSpec
|
|
32 |
// class TTypefaceSupport
|
|
33 |
// const KSuperSubScalingPercentage
|
|
34 |
// const KSuperscriptOffsetPercentage
|
|
35 |
// const KSubscriptOffsetPercentage
|
|
36 |
// class CTypefaceStore
|
|
37 |
// const KMaxFontCacheEntries
|
|
38 |
// class CFontCache
|
|
39 |
//
|
|
40 |
// const KFontCapitalAscent
|
|
41 |
// const KFontMaxAscent
|
|
42 |
// const KFontStandardDescent
|
|
43 |
// const KFontMaxDescent
|
|
44 |
// const KFontLineGap
|
|
45 |
// const KFontGetFontTable
|
|
46 |
// const KFontGetGlyphOutline
|
|
47 |
// const KFontReleaseGlyphOutline
|
|
48 |
// const KFontReleaseFontTable
|
|
49 |
// class CFont
|
|
50 |
|
|
51 |
|
|
52 |
#ifndef __TEXTBASE_H__
|
|
53 |
#define __TEXTBASE_H__
|
|
54 |
|
|
55 |
#include <e32base.h>
|
|
56 |
#include <f32file.h>
|
|
57 |
#include <s32std.h>
|
|
58 |
|
|
59 |
class TOpenFontCharMetrics;
|
|
60 |
class RShapeInfo;
|
|
61 |
|
|
62 |
|
|
63 |
#ifndef __GLYPHSEL_TEXTBASE_H__
|
|
64 |
#define __GLYPHSEL_TEXTBASE_H__
|
|
65 |
/**
|
|
66 |
This enumeration holds the possible panic codes that may be raised
|
|
67 |
by the TextBase API on detecting an unrecoverable error. */
|
|
68 |
enum TTextBasePanic
|
|
69 |
{
|
|
70 |
/** Not used */
|
|
71 |
ETextBasePanic_Unknown = 0,
|
|
72 |
/** One or more of the input parameters to the interface were invalid */
|
|
73 |
ETextBasePanic_InvalidInputParam = 1,
|
|
74 |
/** Insufficient text for successful completion of the method */
|
|
75 |
ETextBasePanic_OutOfText = 2,
|
|
76 |
/** Internal failure. */
|
|
77 |
ETextBasePanic_Invariant = 3,
|
|
78 |
/** Reserved panic codes. Not to be used. */
|
|
79 |
ETextBasePanic_Reserved1 = 4,
|
|
80 |
ETextBasePanic_Reserved2 = 5,
|
|
81 |
/** Setting a typeface name that is too long */
|
|
82 |
ETextBasePanic_TypefaceNameOverflow = 6,
|
|
83 |
};
|
|
84 |
#endif
|
|
85 |
|
|
86 |
|
|
87 |
/**
|
|
88 |
Font posture flags.
|
|
89 |
Fonts can be either upright or italic.
|
|
90 |
@publishedAll
|
|
91 |
@released
|
|
92 |
*/
|
|
93 |
enum TFontPosture
|
|
94 |
{
|
|
95 |
/** Font posture is normal (upright). */
|
|
96 |
EPostureUpright,
|
|
97 |
/** Font posture is italic. */
|
|
98 |
EPostureItalic
|
|
99 |
};
|
|
100 |
|
|
101 |
|
|
102 |
/**
|
|
103 |
Font stroke weight flags.
|
|
104 |
@publishedAll
|
|
105 |
@released
|
|
106 |
*/
|
|
107 |
enum TFontStrokeWeight
|
|
108 |
{
|
|
109 |
/** Font stroke weight is normal. */
|
|
110 |
EStrokeWeightNormal,
|
|
111 |
/** Font stroke weight is bold. */
|
|
112 |
EStrokeWeightBold
|
|
113 |
};
|
|
114 |
|
|
115 |
/**
|
|
116 |
Font print position flags.
|
|
117 |
Fonts can be normal, superscript or subscript.
|
|
118 |
@publishedAll
|
|
119 |
@released
|
|
120 |
*/
|
|
121 |
enum TFontPrintPosition
|
|
122 |
{
|
|
123 |
/** Font is normal. */
|
|
124 |
EPrintPosNormal,
|
|
125 |
/** Font is superscript. */
|
|
126 |
EPrintPosSuperscript,
|
|
127 |
/** Font is subscript. */
|
|
128 |
EPrintPosSubscript
|
|
129 |
};
|
|
130 |
|
|
131 |
|
|
132 |
/**
|
|
133 |
The maximum length of a typeface name (in characters).
|
|
134 |
@publishedAll
|
|
135 |
@released
|
|
136 |
*/
|
|
137 |
const TInt KMaxTypefaceNameLength=0x18;
|
|
138 |
|
|
139 |
|
|
140 |
/** Typeface name and attributes.
|
|
141 |
|
|
142 |
This class identifies a typeface by name, and contains the combination of
|
|
143 |
attributes of the typeface. These attributes define whether it is a symbol
|
|
144 |
typeface, whether the typeface is proportional, and whether it is serif or
|
|
145 |
sans-serif.
|
|
146 |
|
|
147 |
The combination of attributes for a typeface are stored in a bitmask, with
|
|
148 |
the various bits indicating different attributes. The bitmask is calculated
|
|
149 |
for any particular attribute combination by ORing the enumerated value for
|
|
150 |
each individual attribute.
|
|
151 |
@publishedAll
|
|
152 |
@released
|
|
153 |
*/
|
|
154 |
class TTypeface
|
|
155 |
{
|
|
156 |
public:
|
|
157 |
enum
|
|
158 |
{
|
|
159 |
/** Typeface is a proportional typeface (e.g. Swiss)
|
|
160 |
*/
|
|
161 |
EProportional = 1,
|
|
162 |
/** Typeface is a serif typeface (e.g. Times)
|
|
163 |
*/
|
|
164 |
ESerif = 2,
|
|
165 |
/** Typeface is a symbol typeface (e.g. Symbol)
|
|
166 |
*/
|
|
167 |
ESymbol = 4,
|
|
168 |
};
|
|
169 |
public:
|
|
170 |
IMPORT_C TTypeface();
|
|
171 |
IMPORT_C TBool operator==(const TTypeface& aTypeface) const;
|
|
172 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
|
173 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
|
174 |
IMPORT_C void SetAttributes(TInt aAttributes);
|
|
175 |
IMPORT_C void SetIsProportional(TBool aIsProportional);
|
|
176 |
IMPORT_C void SetIsSerif(TBool aIsSerif);
|
|
177 |
IMPORT_C void SetIsSymbol(TBool aIsSymbol);
|
|
178 |
IMPORT_C TInt Attributes() const;
|
|
179 |
IMPORT_C TBool IsProportional() const;
|
|
180 |
IMPORT_C TBool IsSerif() const;
|
|
181 |
IMPORT_C TBool IsSymbol() const;
|
|
182 |
IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
|
|
183 |
IMPORT_C void SetScriptTypeForMetrics(TInt aScript);
|
|
184 |
IMPORT_C TInt ScriptTypeForMetrics() const;
|
|
185 |
IMPORT_C void SetName(const TDesC& aName);
|
|
186 |
IMPORT_C const TDesC& Name() const;
|
|
187 |
private:
|
|
188 |
void ResetAttributes();
|
|
189 |
void ResetScriptType();
|
|
190 |
public:
|
|
191 |
/** The typeface name. */
|
|
192 |
TBufC<KMaxTypefaceNameLength> iName;
|
|
193 |
private:
|
|
194 |
TUint32 iFlags;
|
|
195 |
};
|
|
196 |
|
|
197 |
|
|
198 |
/**
|
|
199 |
An enumerated type for the format of a glyph bitmap. This type is currently
|
|
200 |
used to indicate whether glyph bitmaps for scalable fonts are drawn anti-aliased.
|
|
201 |
Additional values may be defined in the future.
|
|
202 |
|
|
203 |
@see TFontStyle::SetBitmapType()
|
|
204 |
@see CFbsTypefaceStore::SetDefaultBitmapType()
|
|
205 |
@publishedAll
|
|
206 |
@released
|
|
207 |
*/
|
|
208 |
enum TGlyphBitmapType
|
|
209 |
{
|
|
210 |
/** The font store's default glyph bitmap format is used. */
|
|
211 |
EDefaultGlyphBitmap = 0,
|
|
212 |
/** The standard monochrome format: no anti-aliasing, 1 bit per pixel,
|
|
213 |
run-length encoded. */
|
|
214 |
EMonochromeGlyphBitmap,
|
|
215 |
/** Standard 8-bits-per-pixel with anti-aliasing. */
|
|
216 |
EAntiAliasedGlyphBitmap,
|
|
217 |
/** The format used when sub-pixel font rendering is used. */
|
|
218 |
ESubPixelGlyphBitmap,
|
|
219 |
/** The format used when outline and shadow font rendering is used.
|
|
220 |
|
|
221 |
If the raterizer supports the outline and shadow fonts, it will set the bitmaptype as
|
|
222 |
EFourColourBlendGlyphBitmap but only when glyph bitmap type is set as EAntiAliasedGlyphBitmap and
|
|
223 |
when any of the EDropShadow or EOutline effect is on. Only rasterizer providers can use this enum.
|
|
224 |
*/
|
|
225 |
EFourColourBlendGlyphBitmap,
|
|
226 |
/**
|
|
227 |
This is used for glyphs, and not fonts, and is needed to inform the font drawing routines
|
|
228 |
that the character should be drawn using the overall font setting.
|
|
229 |
For Internal Use Only.
|
|
230 |
*/
|
|
231 |
EGlyphBitmapTypeNotDefined,
|
|
232 |
/**
|
|
233 |
This is used to inform the rasterizer that the best match should be
|
|
234 |
found for the bitmap type based upon its knowledge.
|
|
235 |
For Internal Use Only.
|
|
236 |
*/
|
|
237 |
EAntiAliasedOrMonochromeGlyphBitmap,
|
71
|
238 |
/** The format used when outline and shadow font rendering is used.
|
|
239 |
If the raterizer supports the outline and shadow fonts and EFourColourBlendGlyphBitmapMono is set, it will get regular monochrome
|
|
240 |
bitmap.
|
|
241 |
*/
|
|
242 |
EFourColourBlendGlyphBitmapMono,
|
45
|
243 |
};
|
|
244 |
|
|
245 |
/**
|
|
246 |
Defines a set of font effects flags.
|
|
247 |
|
|
248 |
@publishedAll
|
|
249 |
@released
|
|
250 |
WARNING: This Class is for use by system/UI software ONLY.
|
|
251 |
*/
|
|
252 |
NONSHARABLE_CLASS(FontEffect)
|
|
253 |
{
|
|
254 |
public:
|
|
255 |
enum TEffect
|
|
256 |
{
|
|
257 |
ENone = 0x0, // No effects.
|
|
258 |
EAlgorithmicBold= 0x10, // Font is algorithmic bold (a.k.a pseudo bold.)
|
|
259 |
EDropShadow = 0x20, // Font has a drop shadow.
|
|
260 |
EOutline = 0x40, // Font is an outline font.
|
|
261 |
EEmbossed = 0x80, // Font is embossed.
|
|
262 |
EEngraved = 0x100, // Font is engraved.
|
|
263 |
ESoftEdge = 0x200, // Font is soft edged.
|
|
264 |
EReserved1 = 0x400, // Reserved for Symbian use.
|
|
265 |
EReserved2 = 0x800, // Reserved for Symbian use.
|
|
266 |
EReserved3 = 0x1000, // Reserved for Symbian use.
|
|
267 |
EReserved4 = 0x2000, // Reserved for Symbian use.
|
|
268 |
EReserved5 = 0x4000, // Reserved for Symbian use.
|
|
269 |
EReserved6 = 0x8000, // Reserved for Symbian use.
|
|
270 |
};
|
|
271 |
public:
|
|
272 |
IMPORT_C static TBool IsEffectOn(TEffect aEffect, TUint32 aFontEffect);
|
|
273 |
IMPORT_C static void SetEffect(TEffect aEffect, TBool aOn, TUint32& aFontEffect);
|
|
274 |
};
|
|
275 |
|
|
276 |
/** Encapsulates a font style.
|
|
277 |
|
|
278 |
The font style information is comprised of:
|
|
279 |
|
|
280 |
the posture of the font upright or italic
|
|
281 |
|
|
282 |
the stroke weight of the font normal or bold
|
|
283 |
|
|
284 |
the print position of the font normal, subscript or superscript
|
|
285 |
|
|
286 |
Note that the underline and strike-through attributes are not included in
|
|
287 |
this class, but are set in the graphics context.
|
|
288 |
|
|
289 |
@see CGraphicsContext::SetUnderlineStyle()
|
|
290 |
@see CGraphicsContext::SetStrikethroughStyle()
|
|
291 |
@publishedAll
|
|
292 |
@released
|
|
293 |
*/
|
|
294 |
class TFontStyle
|
|
295 |
{
|
|
296 |
public:
|
|
297 |
IMPORT_C TFontStyle();
|
|
298 |
IMPORT_C TFontStyle(TFontPosture aPost,TFontStrokeWeight aStrWgt,TFontPrintPosition aPrintPos);
|
|
299 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
|
300 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
|
301 |
IMPORT_C TFontPosture Posture() const;
|
|
302 |
IMPORT_C TFontStrokeWeight StrokeWeight() const;
|
|
303 |
IMPORT_C TFontPrintPosition PrintPosition() const;
|
|
304 |
IMPORT_C void SetPosture(TFontPosture aPosture);
|
|
305 |
IMPORT_C void SetStrokeWeight(TFontStrokeWeight aStrokeWeight);
|
|
306 |
IMPORT_C void SetPrintPosition(TFontPrintPosition aPrintPosition);
|
|
307 |
inline TGlyphBitmapType BitmapType() const;
|
|
308 |
inline void SetBitmapType(TGlyphBitmapType aBitmapType);
|
|
309 |
IMPORT_C TBool operator==(const TFontStyle& aFontStyle) const;
|
|
310 |
IMPORT_C TUint32 Effects() const;
|
|
311 |
IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const;
|
|
312 |
IMPORT_C void SetEffects(TUint32 aEffects);
|
|
313 |
IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn);
|
|
314 |
private:
|
|
315 |
enum
|
|
316 |
{
|
|
317 |
EItalic=0x1,
|
|
318 |
EBold=0x2,
|
|
319 |
ESuper=0x4,
|
|
320 |
ESub=0x8
|
|
321 |
};
|
|
322 |
private:
|
|
323 |
TUint32 iFlags; // bitmap type - 16 bits (high), font effects - 12 bits (middle), style - 4 bits (low)
|
|
324 |
TAny* iReserved1;
|
|
325 |
TAny* iReserved2;
|
|
326 |
};
|
|
327 |
|
|
328 |
|
|
329 |
|
|
330 |
/**
|
|
331 |
Specifies the font specification in device independent terms.
|
|
332 |
@publishedAll
|
|
333 |
@released
|
|
334 |
*/
|
|
335 |
class TFontSpec
|
|
336 |
{
|
|
337 |
public:
|
|
338 |
IMPORT_C TFontSpec();
|
|
339 |
IMPORT_C TFontSpec(const TDesC& aTypefaceName,TInt aHeight);
|
|
340 |
IMPORT_C TBool operator==(const TFontSpec& aFontSpec) const;
|
|
341 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
|
342 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
|
343 |
IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
|
|
344 |
IMPORT_C TInt ScriptTypeForMetrics() const;
|
|
345 |
public:
|
|
346 |
/** The typeface. */
|
|
347 |
TTypeface iTypeface;
|
|
348 |
/** The height of the typeface (in twips). */
|
|
349 |
TInt iHeight;
|
|
350 |
/** The font style of the typeface. */
|
|
351 |
TFontStyle iFontStyle;
|
|
352 |
};
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
/** Typeface family support information.
|
|
357 |
|
|
358 |
This data-only class includes the name and attributes of a typeface, how many
|
|
359 |
font heights are available, its minimum and maximum heights, and whether or
|
|
360 |
not it is scaleable a typeface is scaleable if it supports heights at
|
|
361 |
fixed intervals between the minimum and maximum heights.
|
|
362 |
@publishedAll
|
|
363 |
@released
|
|
364 |
*/
|
|
365 |
class TTypefaceSupport
|
|
366 |
{
|
|
367 |
public:
|
|
368 |
/** The name and attributes of the typeface. */
|
|
369 |
TTypeface iTypeface;
|
|
370 |
/** The number of distinct font heights available in the typeface. */
|
|
371 |
TInt iNumHeights;
|
|
372 |
/** The typeface's minimum font height, in twips. */
|
|
373 |
TInt iMinHeightInTwips;
|
|
374 |
/** The typeface's maximum font height, in twips. */
|
|
375 |
TInt iMaxHeightInTwips;
|
|
376 |
/** Whether the typeface is scaleable. ETrue if it is scaleable, otherwise
|
|
377 |
EFalse. */
|
|
378 |
TBool iIsScalable; // supports heights from min to max at fixed interval
|
|
379 |
};
|
|
380 |
|
|
381 |
/**
|
|
382 |
The percentage used to multiply a normal font height when calculating its
|
|
383 |
superscript or subscript height.
|
|
384 |
@publishedAll
|
|
385 |
@released
|
|
386 |
*/
|
|
387 |
const TInt KSuperSubScalingPercentage=67;
|
|
388 |
|
|
389 |
/**
|
|
390 |
The percentage of a font height used to calculate its baseline offset for a
|
|
391 |
superscript print position.
|
|
392 |
@publishedAll
|
|
393 |
@released
|
|
394 |
*/
|
|
395 |
const TInt KSuperscriptOffsetPercentage=-28;
|
|
396 |
|
|
397 |
/**
|
|
398 |
The percentage of a font height used to calculate its baseline offset for a
|
|
399 |
subscript print position.
|
|
400 |
@publishedAll
|
|
401 |
@released
|
|
402 |
*/
|
|
403 |
const TInt KSubscriptOffsetPercentage=14;
|
|
404 |
|
|
405 |
class CFont;
|
|
406 |
|
|
407 |
/** Typeface store abstract base interface.
|
|
408 |
|
|
409 |
This class provides the interface to a store for typefaces.
|
|
410 |
|
|
411 |
See also CFontStore.
|
|
412 |
@publishedAll
|
|
413 |
@released
|
|
414 |
*/
|
|
415 |
class CTypefaceStore : public CBase
|
|
416 |
{
|
|
417 |
public:
|
|
418 |
IMPORT_C ~CTypefaceStore();
|
|
419 |
|
|
420 |
/**
|
|
421 |
Gets the font which is the nearest to the given font specification.
|
|
422 |
|
|
423 |
When the font is no longer needed, call @c ReleaseFont().
|
|
424 |
|
|
425 |
Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInTwips()
|
|
426 |
yielding (virtually) the same result. However clients are strongly encouraged to use the new
|
|
427 |
@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every
|
|
428 |
character within any given text string will fit within the given amount of twips, whereas the design
|
|
429 |
height is an aesthetic unit decided by the font designer without strict physical meaning, which
|
|
430 |
may result in cropped characters.
|
|
431 |
|
|
432 |
@param aFont On return, contains a pointer to the nearest font.
|
|
433 |
@param aFontSpec The specification of the font to be matched.
|
|
434 |
@return KErrNone if successful; a system-wide error code otherwise.
|
|
435 |
@publishedAll
|
|
436 |
@deprecated Use GetNearestFontToDesignHeightInTwips
|
|
437 |
*/
|
|
438 |
virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
|
|
439 |
|
|
440 |
/**
|
|
441 |
Gets the font which is the nearest to the given font specification.
|
|
442 |
|
|
443 |
When the font is no longer needed, call @c ReleaseFont().
|
|
444 |
|
|
445 |
This new function replaces the deprecated @c GetNearestFontInTwips() yielding (virtually) the
|
|
446 |
same result. However clients are strongly encouraged to use the new
|
|
447 |
@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every
|
|
448 |
character within any given text string will fit within the given amount of twips, whereas the design
|
|
449 |
height is an aesthetic unit decided by the font designer without strict physical meaning, which
|
|
450 |
may result in cropped characters.
|
|
451 |
|
|
452 |
@param aFont On return, contains a pointer to the nearest font.
|
|
453 |
@param aFontSpec The specification of the font to be matched.
|
|
454 |
@return KErrNone if successful; a system-wide error code otherwise.
|
|
455 |
@publishedAll
|
|
456 |
@released
|
|
457 |
*/
|
|
458 |
virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
|
|
459 |
|
|
460 |
/**
|
|
461 |
Gets the font which is the nearest to the given font specification.
|
|
462 |
|
|
463 |
When the font is no longer needed, call @c ReleaseFont().
|
|
464 |
|
|
465 |
The font and bitmap server returns a pointer to the nearest matching font
|
|
466 |
from those available. Matches to max height of font - this does its best
|
|
467 |
to return a font that will fit within the maximum height specified (but
|
|
468 |
note that variations due to hinting algorithms may rarely result in this
|
|
469 |
height being exceeded by up to one pixel). Problems can also be
|
|
470 |
encountered with bitmap fonts where the typeface exists but doesn't have
|
|
471 |
a font small enough.
|
|
472 |
|
|
473 |
@param aFont On return, contains a pointer to the nearest font.
|
|
474 |
@param aFontSpec The specification of the font to be matched.
|
|
475 |
@param aMaxHeight The maximum height within which the font must fit.
|
|
476 |
@return KErrNone if successful; a system-wide error code otherwise.
|
|
477 |
@publishedAll
|
|
478 |
@released
|
|
479 |
*/
|
|
480 |
virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) = 0;
|
|
481 |
|
|
482 |
/** Gets the number of typefaces supported by the typeface store.
|
|
483 |
|
|
484 |
@return The number of supported typefaces. */
|
|
485 |
virtual TInt NumTypefaces() const=0;
|
|
486 |
|
|
487 |
/** Gets typeface information for a specified typeface index.
|
|
488 |
|
|
489 |
This information is returned in aTypefaceSupport, and
|
|
490 |
includes the typeface name and typeface attributes, the number of font
|
|
491 |
heights, the maximum and minimum font heights, and whether it is a
|
|
492 |
scaleable typeface.
|
|
493 |
|
|
494 |
@param aTypefaceSupport On return, if the function executed successfully,
|
|
495 |
this object contains the typeface information.
|
|
496 |
@param aTypefaceIndex A typeface index number, in the range: zero to
|
|
497 |
(NumTypefaces() - 1). */
|
|
498 |
virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const=0;
|
|
499 |
|
|
500 |
/** Gets the height of the font with specified height and typeface indices,
|
|
501 |
in twips.
|
|
502 |
|
|
503 |
The value returned is rounded up or down to the nearest font height in twips.
|
|
504 |
|
|
505 |
@param aTypefaceIndex A typeface index number, in the range: 0 to
|
|
506 |
(NumTypefaces() - 1).
|
|
507 |
@param aHeightIndex A font height index number.
|
|
508 |
@return The height of the font, in twips. */
|
|
509 |
virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
|
|
510 |
IMPORT_C void ReleaseFont(CFont* aFont);
|
|
511 |
IMPORT_C static TInt BaselineOffset(TInt aHeight,TFontPrintPosition aPos);
|
|
512 |
IMPORT_C static TInt SuperSubHeight(TInt aHeight,TFontPrintPosition aPos);
|
|
513 |
protected:
|
|
514 |
IMPORT_C CTypefaceStore();
|
|
515 |
IMPORT_C void ConstructL();
|
|
516 |
IMPORT_C void AddFontL(CFont* aFont);
|
|
517 |
IMPORT_C TBool IncrementFontCount(const CFont* aFont);
|
|
518 |
private:
|
|
519 |
TBool FindFont(const CFont* aFont, TInt& aIdx) const;
|
|
520 |
NONSHARABLE_CLASS(TFontAccess)
|
|
521 |
/**
|
|
522 |
Pairs a font with a count of how many clients of the typeface store
|
|
523 |
are accessing that font.
|
|
524 |
*/
|
|
525 |
{
|
|
526 |
public:
|
|
527 |
/** A device specific font. */
|
|
528 |
CFont* iFont;
|
|
529 |
/** The number of clients accessing the font. */
|
|
530 |
TInt iAccessCount;
|
|
531 |
};
|
|
532 |
protected:
|
|
533 |
/** A list of fonts accessed by clients of the typeface store, which pairs
|
|
534 |
a font with a count of the number of clients accessing the font.
|
|
535 |
|
|
536 |
Implemented as an array of TFontAccess objects.
|
|
537 |
|
|
538 |
An object is added to this array for every font accessed. If the font is
|
|
539 |
released by all clients, and the access count drops to zero, the font is
|
|
540 |
removed from the list. */
|
|
541 |
CArrayFixFlat<TFontAccess>* iFontAccess;
|
|
542 |
};
|
|
543 |
|
|
544 |
/** The maximum number of entries in the font cache.
|
|
545 |
|
|
546 |
@see CFontCache */
|
|
547 |
const TInt KMaxFontCacheEntries=32;
|
|
548 |
|
|
549 |
/** Font cache.
|
|
550 |
|
|
551 |
When a CFont* needs to be found for a particular TFontSpec, the cache can
|
|
552 |
be searched to see if the TFontSpec is already in the cache. If the TFontSpec
|
|
553 |
is in the cache, its corresponding CFont* can be returned. Otherwise
|
|
554 |
GetNearestFontInTwips() must be used to search all of the available fonts for
|
|
555 |
the nearest CFont- a procedure which takes much longer than a simple cache
|
|
556 |
search.
|
|
557 |
|
|
558 |
The current font cache should be destroyed and a new cache created whenever
|
|
559 |
the zoom factor or device map changes, as these changes break the relation
|
|
560 |
between CFont and TFontSpec.
|
|
561 |
@publishedAll
|
|
562 |
@released
|
|
563 |
*/
|
|
564 |
class CFontCache : public CBase
|
|
565 |
{
|
|
566 |
public:
|
|
567 |
IMPORT_C CFontCache();
|
|
568 |
IMPORT_C CFontCache(TInt aMaxEntries);
|
|
569 |
IMPORT_C ~CFontCache();
|
|
570 |
IMPORT_C CFont* Search(const TFontSpec& aFontSpec);
|
|
571 |
IMPORT_C CFont* AddEntryL(CFont* aFont,const TFontSpec& aFontSpec);
|
|
572 |
IMPORT_C CFont* RemoveFirstEntry();
|
|
573 |
public:
|
|
574 |
/** The number of cache hits since the font cache was created i.e.
|
|
575 |
successful results from CFontCache::Search(). */
|
|
576 |
TInt iNumHits;
|
|
577 |
/** The number of cache misses since the font cache was created i.e.
|
|
578 |
unsuccessful results from CFontCache::Search(). */
|
|
579 |
TInt iNumMisses;
|
|
580 |
private:
|
|
581 |
class CFontCacheEntry : public CBase
|
|
582 |
{
|
|
583 |
public:
|
|
584 |
CFontCacheEntry(CFont* aFont,const TFontSpec& aFontSpec,CFontCacheEntry* aNext);
|
|
585 |
public:
|
|
586 |
CFont* iFont;
|
|
587 |
TFontSpec iSpec;
|
|
588 |
CFontCacheEntry* iNext;
|
|
589 |
};
|
|
590 |
private:
|
|
591 |
TInt iNumEntries;
|
|
592 |
TInt iMaxEntries;
|
|
593 |
CFontCacheEntry* iFirst;
|
|
594 |
};
|
|
595 |
|
|
596 |
/**
|
|
597 |
WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases.
|
|
598 |
UIDs corresponding to the CFont API extension functions
|
|
599 |
@internalTechnology
|
|
600 |
*/
|
|
601 |
const TUid KFontCapitalAscent = {0x1020498E};
|
|
602 |
const TUid KFontMaxAscent = {0x10204B10};
|
|
603 |
const TUid KFontStandardDescent = {0x10204B11};
|
|
604 |
const TUid KFontMaxDescent = {0x10205AFC};
|
|
605 |
const TUid KFontLineGap = {0x10204B12};
|
|
606 |
const TUid KFontGetFontTable = {0x102872C1};
|
|
607 |
const TUid KFontGetGlyphOutline = {0x102872C2};
|
|
608 |
const TUid KFontReleaseGlyphOutline = {0x2002A1FD};
|
|
609 |
const TUid KFontReleaseFontTable = {0x2002AC24};
|
|
610 |
|
|
611 |
|
|
612 |
/** Abstract font interface.
|
|
613 |
|
|
614 |
The CFont class provides a device-independent interface to a device-dependent
|
|
615 |
font usually obtained from a call to GetNearestFont...() on a graphics device.
|
|
616 |
It is used as a handle in CGraphicsContext::UseFont() and to obtain
|
|
617 |
device-dependent information about the font - notably the pixel width of a text
|
|
618 |
string.
|
|
619 |
|
|
620 |
@see CFbsFont
|
|
621 |
@see CGraphicsContext::UseFont()
|
|
622 |
@publishedAll
|
|
623 |
@released
|
|
624 |
*/
|
|
625 |
class CFont : public CBase
|
|
626 |
{
|
|
627 |
friend class CTypefaceStore;
|
|
628 |
public:
|
|
629 |
|
|
630 |
/** Text direction flags.
|
|
631 |
|
|
632 |
This enum is used in TMeasureTextInput and determines whether the text is
|
|
633 |
drawn horizontally or vertically. Note: text is drawn vertically in some
|
|
634 |
styles of Japanese, etc.
|
|
635 |
|
|
636 |
@see TMeasureTextInput */
|
|
637 |
enum TTextDirection
|
|
638 |
{
|
|
639 |
/** Text is drawn horizontally. */
|
|
640 |
/** Text is drawn horizontally. */
|
|
641 |
EHorizontal,
|
|
642 |
/** Text is drawn vertically. */
|
|
643 |
EVertical
|
|
644 |
};
|
|
645 |
|
|
646 |
/** Complicated parameter block used for contextual glyph selection,
|
|
647 |
ligature creation and diacritic placement when drawing text in complex
|
|
648 |
scripts
|
|
649 |
|
|
650 |
This class declares a constructor, another scoped class, and several other
|
|
651 |
enums. However this class is unlikely to be useful to third party developers.
|
|
652 |
|
|
653 |
@see CFont::GetCharacterPosition()
|
|
654 |
@see CFont::GetCharacterPosition2()
|
|
655 |
@publishedAll
|
|
656 |
@released
|
|
657 |
*/
|
|
658 |
class TPositionParam
|
|
659 |
{
|
|
660 |
public:
|
|
661 |
/** Standard constructor. */
|
|
662 |
TPositionParam():
|
|
663 |
iDirection(EHorizontal),
|
|
664 |
iFlags(0),
|
|
665 |
iPosInText(0),
|
|
666 |
iOutputGlyphs(0)
|
|
667 |
{
|
|
668 |
}
|
|
669 |
|
|
670 |
enum
|
|
671 |
{
|
|
672 |
EMaxInputChars = 18, // ligatures cannot be made from more than 18 components
|
|
673 |
EMaxOutputGlyphs = 8 // output can consist of up to 8 characters (one base and 7 combining characters)
|
|
674 |
};
|
|
675 |
|
|
676 |
/**Flags for TPositionParam::iFlags. */
|
|
677 |
enum TFlags
|
|
678 |
{
|
|
679 |
/** Input text is logically ordered not visually ordered. */
|
|
680 |
EFLogicalOrder = 1
|
|
681 |
};
|
|
682 |
|
|
683 |
/** Input: Orientation (EHorizontal or EVertical) in which to draw
|
|
684 |
the text. */
|
|
685 |
TInt16 iDirection;
|
|
686 |
/** Input: Flags from TFlags. */
|
|
687 |
TUint16 iFlags;
|
|
688 |
/** Input: Text containing the characters to be positioned. */
|
|
689 |
TPtrC iText;
|
|
690 |
|
|
691 |
/** Input and output: Position within iText to shape. On exit
|
|
692 |
it will index the first character not positioned */
|
|
693 |
TInt iPosInText;
|
|
694 |
/** Input and output: Pen position. */
|
|
695 |
TPoint iPen;
|
|
696 |
|
|
697 |
/** Output of GetCharacterPosition and GetCharacterPosition2.
|
|
698 |
@see CFont::GetCharacterPosition
|
|
699 |
@see CFont::GetCharacterPosition2
|
|
700 |
@publishedAll
|
|
701 |
@released */
|
|
702 |
class TOutput
|
|
703 |
{
|
|
704 |
public:
|
|
705 |
/** Standard constructor. */
|
|
706 |
TOutput() : iBitmapSize(TSize::EUninitialized),
|
|
707 |
iBounds(TRect::EUninitialized) {}
|
|
708 |
/** Character or glyph code. */
|
|
709 |
TUint iCode;
|
|
710 |
/** Bitmap data for the glyph, if available */
|
|
711 |
const TUint8* iBitmap;
|
|
712 |
/** Size of the bitmap before algorithmic bolding, size
|
|
713 |
multiplication, etc. */
|
|
714 |
TSize iBitmapSize;
|
|
715 |
/** Bitmap bounds relative to the original pen position. */
|
|
716 |
TRect iBounds;
|
|
717 |
};
|
|
718 |
|
|
719 |
/** Information about the glyphs that were output. */
|
|
720 |
TOutput iOutput[EMaxOutputGlyphs];
|
|
721 |
/** Number of glyphs actually output. */
|
|
722 |
TInt iOutputGlyphs;
|
|
723 |
};
|
|
724 |
|
|
725 |
|
|
726 |
/** Input parameter block.
|
|
727 |
|
|
728 |
This is optionally used by CFont::MeasureText(), which is the powerful text
|
|
729 |
measurement function underlying all the other text measurement functions.
|
|
730 |
|
|
731 |
@see CFont::MeasureText()
|
|
732 |
@publishedAll
|
|
733 |
@released
|
|
734 |
*/
|
|
735 |
class TMeasureTextInput
|
|
736 |
{
|
|
737 |
public:
|
|
738 |
TMeasureTextInput():
|
|
739 |
iStartInputChar(0),
|
|
740 |
iEndInputChar(KMaxTInt),
|
|
741 |
iDirection(EHorizontal),
|
|
742 |
iFlags(0),
|
|
743 |
iMaxAdvance(KMaxTInt),
|
|
744 |
iMaxBounds(KMaxTInt),
|
|
745 |
iCharJustNum(0),
|
|
746 |
iCharJustExcess(0),
|
|
747 |
iWordJustNum(0),
|
|
748 |
iWordJustExcess(0)
|
|
749 |
{
|
|
750 |
}
|
|
751 |
|
|
752 |
/**Flags for TMeasureTextInput::iFlags. */
|
|
753 |
enum TFlags
|
|
754 |
{
|
|
755 |
/** Input text is visually ordered left-to-right. */
|
|
756 |
EFVisualOrder = 1,
|
|
757 |
/** Input text is visually ordered right-to-left.
|
|
758 |
Overrides EFVisualOrder. */
|
|
759 |
EFVisualOrderRightToLeft = 2,
|
|
760 |
/** Flag to consider side bearings when checking bounds for line-break */
|
|
761 |
EFIncludePenPositionInBoundsCheck = 4
|
|
762 |
};
|
|
763 |
|
|
764 |
/** Starting index specifying first input character in iText.
|
|
765 |
|
|
766 |
Together with iEndInputChar, this allows some context before and
|
|
767 |
after the measured text to be supplied so that shaping can work
|
|
768 |
properly. */
|
|
769 |
TInt iStartInputChar;
|
|
770 |
|
|
771 |
/** Index specifying the final input character.
|
|
772 |
|
|
773 |
Together with iStartInputChar, this allows some context before and
|
|
774 |
after the measured text to be supplied so that shaping can work
|
|
775 |
properly. */
|
|
776 |
TInt iEndInputChar;
|
|
777 |
|
|
778 |
/** The direction in which to draw the text. */
|
|
779 |
TUint16 iDirection;
|
|
780 |
|
|
781 |
/** Flags from TFlags. */
|
|
782 |
TUint16 iFlags;
|
|
783 |
|
|
784 |
/** The maximum advance. */
|
|
785 |
TInt iMaxAdvance;
|
|
786 |
|
|
787 |
/** The maximum width (or height if drawing vertically) of bounds. */
|
|
788 |
TInt iMaxBounds;
|
|
789 |
|
|
790 |
/** The number of glyph groups to be letter-spaced. */
|
|
791 |
TInt iCharJustNum;
|
|
792 |
|
|
793 |
/** The amount of space to be used for letter spacing. */
|
|
794 |
TInt iCharJustExcess;
|
|
795 |
|
|
796 |
/** The number of spaces to be used for word spacing. */
|
|
797 |
TInt iWordJustNum;
|
|
798 |
|
|
799 |
/** The amount of space to be used for word spacing. */
|
|
800 |
TInt iWordJustExcess;
|
|
801 |
};
|
|
802 |
|
|
803 |
/** Output parameter block.
|
|
804 |
|
|
805 |
This is optionally used by CFont::MeasureText(), which is the powerful text
|
|
806 |
measurement function underlying all the other text measurement functions.
|
|
807 |
|
|
808 |
@see CFont::MeasureText()
|
|
809 |
@publishedAll
|
|
810 |
@released
|
|
811 |
*/
|
|
812 |
class TMeasureTextOutput
|
|
813 |
{
|
|
814 |
public:
|
|
815 |
/** The number of input characters that would be drawn.
|
|
816 |
|
|
817 |
This may be less than the length of the text if a maximum advance or bounding
|
|
818 |
box size is specified. */
|
|
819 |
TInt iChars;
|
|
820 |
/** The number of glyphs that would be drawn. */
|
|
821 |
TInt iGlyphs;
|
|
822 |
/** The number of groups that would be drawn.
|
|
823 |
|
|
824 |
A group is a base glyph plus one or more combining characters. */
|
|
825 |
TInt iGroups;
|
|
826 |
/** The number of word spaces (U+0020) that would be drawn. */
|
|
827 |
TInt iSpaces;
|
|
828 |
/** The bounding box of all the glyphs that would be drawn. */
|
|
829 |
TRect iBounds;
|
|
830 |
/** The maximum width and height of any glyph. */
|
|
831 |
TSize iMaxGlyphSize;
|
|
832 |
};
|
|
833 |
|
|
834 |
/**
|
|
835 |
Data availability flags.
|
|
836 |
|
|
837 |
Some fonts like printer fonts may only have width information and can return
|
|
838 |
ECharacterWidthOnly to show this: the text drawing routines in CFont synthesize
|
|
839 |
the rest of the data if necessary.
|
|
840 |
|
|
841 |
@see GetCharacterData()
|
|
842 |
@publishedAll
|
|
843 |
@released
|
|
844 |
*/
|
|
845 |
enum TCharacterDataAvailability
|
|
846 |
{
|
|
847 |
/** No font information available. */
|
|
848 |
ENoCharacterData,
|
|
849 |
/** Width information only is available. */
|
|
850 |
ECharacterWidthOnly,
|
|
851 |
/** All character data is available. */
|
|
852 |
EAllCharacterData
|
|
853 |
};
|
|
854 |
|
|
855 |
private:
|
|
856 |
// virtual functions have been made protected and public non-virtual ones
|
|
857 |
// added to convert CFont to a handle-body pattern. SC is kept throught the
|
|
858 |
// new functions and BC is kept by keeping the protected functions in the
|
|
859 |
// same place in the class, and therefore in the same place in the vtable
|
|
860 |
/**
|
|
861 |
@publishedAll
|
|
862 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
863 |
*/
|
|
864 |
virtual TUid DoTypeUid() const=0;
|
|
865 |
/**
|
|
866 |
@publishedAll
|
|
867 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
868 |
*/
|
|
869 |
virtual TInt DoHeightInPixels() const=0;
|
|
870 |
/**
|
|
871 |
@publishedAll
|
|
872 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
873 |
*/
|
|
874 |
virtual TInt DoAscentInPixels() const=0;
|
|
875 |
IMPORT_C virtual TInt DoDescentInPixels() const;
|
|
876 |
/**
|
|
877 |
@publishedAll
|
|
878 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
879 |
*/
|
|
880 |
virtual TInt DoCharWidthInPixels(TChar aChar) const=0;
|
|
881 |
/**
|
|
882 |
@publishedAll
|
|
883 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
884 |
*/
|
|
885 |
virtual TInt DoTextWidthInPixels(const TDesC& aText) const=0;
|
|
886 |
/**
|
|
887 |
@publishedAll
|
|
888 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
889 |
*/
|
|
890 |
virtual TInt DoBaselineOffsetInPixels() const=0;
|
|
891 |
/**
|
|
892 |
@publishedAll
|
|
893 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
894 |
*/
|
|
895 |
virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const=0;
|
|
896 |
/**
|
|
897 |
@publishedAll
|
|
898 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
899 |
*/
|
|
900 |
virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const=0;
|
|
901 |
/**
|
|
902 |
@publishedAll
|
|
903 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
904 |
*/
|
|
905 |
virtual TInt DoMaxCharWidthInPixels() const=0;
|
|
906 |
/**
|
|
907 |
@publishedAll
|
|
908 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
909 |
*/
|
|
910 |
virtual TInt DoMaxNormalCharWidthInPixels() const=0;
|
|
911 |
/**
|
|
912 |
@publishedAll
|
|
913 |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
|
|
914 |
*/
|
|
915 |
virtual TFontSpec DoFontSpecInTwips() const=0;
|
|
916 |
|
|
917 |
protected:
|
|
918 |
IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
|
|
919 |
IMPORT_C virtual TBool DoGetCharacterPosition(TPositionParam& aParam) const;
|
|
920 |
IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
|
|
921 |
|
|
922 |
protected:
|
|
923 |
IMPORT_C virtual ~CFont();
|
|
924 |
|
|
925 |
public:
|
|
926 |
inline TInt FontCapitalAscent() const;
|
|
927 |
inline TInt FontMaxAscent() const;
|
|
928 |
inline TInt FontStandardDescent() const;
|
|
929 |
inline TInt FontMaxDescent() const;
|
|
930 |
inline TInt FontLineGap() const;
|
|
931 |
inline TInt FontMaxHeight() const;
|
|
932 |
|
|
933 |
public:
|
|
934 |
/** Gets run-time identity of the actual font type. This enables safe casting to
|
|
935 |
a derived type.
|
|
936 |
|
|
937 |
For example, if the derived type is a CFbsFont, the return value is KCFbsFontUid.
|
|
938 |
You would need to cast to a CFbsFont to get a character bounding box. Similarly,
|
|
939 |
a CBitmapFont returns KCBitmapFontUidVal.
|
|
940 |
|
|
941 |
@return The font-type identifier. */
|
|
942 |
IMPORT_C TUid TypeUid() const;
|
|
943 |
|
|
944 |
/** Gets the font height in pixels.
|
|
945 |
Note that this deprecated function is replaced by the new @c FontMaxHeight().
|
|
946 |
|
|
947 |
@return The font height in pixels.
|
|
948 |
@see FontMaxHeight()
|
|
949 |
@deprecated */
|
|
950 |
IMPORT_C TInt HeightInPixels() const;
|
|
951 |
|
|
952 |
/** Gets the font ascent in pixels.
|
|
953 |
Note that this deprecated function is replaced by the new @c FontMaxAscent()
|
|
954 |
or in some cases @c FontCapitalAscent().
|
|
955 |
|
|
956 |
@return The font ascent in pixels.
|
|
957 |
@see FontCapitalAscent()
|
|
958 |
@see FontMaxAscent()
|
|
959 |
@deprecated */
|
|
960 |
IMPORT_C TInt AscentInPixels() const;
|
|
961 |
|
|
962 |
/** Gets the font descent in pixels.
|
|
963 |
Note that this deprecated function is replaced by the new @c FontMaxDescent()
|
|
964 |
or in some cases @c FontStandardDescent().
|
|
965 |
|
|
966 |
@return The font descent in pixels.
|
|
967 |
@see FontStandardDescent()
|
|
968 |
@see FontMaxDescent()
|
|
969 |
@deprecated */
|
|
970 |
IMPORT_C TInt DescentInPixels() const;
|
|
971 |
|
|
972 |
/** Gets the width in pixels in this font of the specified character.
|
|
973 |
|
|
974 |
Note: For OpenType fonts this function returns the horizontal advance of
|
|
975 |
the character, which may be different from the actual width.
|
|
976 |
|
|
977 |
@param aChar The character whose width should be determined.
|
|
978 |
@return The width in pixels of the specified character in this font. */
|
|
979 |
IMPORT_C TInt CharWidthInPixels(TChar aChar) const;
|
|
980 |
|
|
981 |
/** Gets the width in pixels of the specified descriptor when displayed in this
|
|
982 |
font.
|
|
983 |
|
|
984 |
@param aText The descriptor whose width should be determined.
|
|
985 |
@return The width of the specified descriptor when displayed in this font,
|
|
986 |
in pixels. */
|
|
987 |
IMPORT_C TInt TextWidthInPixels(const TDesC& aText) const;
|
|
988 |
|
|
989 |
/** Gets the baseline offset in pixels.
|
|
990 |
|
|
991 |
The baseline offset is how far a font is raised or lowered from its normal
|
|
992 |
baseline.
|
|
993 |
|
|
994 |
@return Offset from normal baseline, in pixels. */
|
|
995 |
IMPORT_C TInt BaselineOffsetInPixels() const;
|
|
996 |
|
|
997 |
/** Gets how much of the specified descriptor can be displayed in this font without
|
|
998 |
exceeding the specified width.
|
|
999 |
|
|
1000 |
Note:
|
|
1001 |
|
|
1002 |
This function does not display any of the descriptor itself - it is used
|
|
1003 |
before display, to test whether the whole descriptor can be displayed.
|
|
1004 |
|
|
1005 |
@param aText The descriptor.
|
|
1006 |
@param aWidthInPixels The available width for character display.
|
|
1007 |
@return The number of characters which will be able to be displayed without
|
|
1008 |
exceeding the specified width. The count starts from the beginning of the
|
|
1009 |
descriptor. */
|
|
1010 |
IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels) const;
|
|
1011 |
|
|
1012 |
/** Gets how much of the specified descriptor can be displayed in this font without
|
|
1013 |
exceeding the specified width.
|
|
1014 |
|
|
1015 |
It also returns the excess width - defined as the specified available width
|
|
1016 |
minus the width of the portion of the descriptor which can be displayed without
|
|
1017 |
exceeding the available width.
|
|
1018 |
|
|
1019 |
@param aText The descriptor.
|
|
1020 |
@param aWidthInPixels The available width for character display.
|
|
1021 |
@param aExcessWidthInPixels The excess width after displaying the portion of
|
|
1022 |
the descriptor, in pixels.
|
|
1023 |
@return The number of characters which will be able to be displayed without
|
|
1024 |
exceeding the specified width. The count starts from the beginning of the
|
|
1025 |
descriptor. */
|
|
1026 |
IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const;
|
|
1027 |
|
|
1028 |
/** Gets the width in pixels of the widest character in this font.
|
|
1029 |
|
|
1030 |
@return The width of the maximum width character, in pixels. */
|
|
1031 |
IMPORT_C TInt MaxCharWidthInPixels() const;
|
|
1032 |
|
|
1033 |
/** Gets the width in pixels of the widest normal character in this font.
|
|
1034 |
|
|
1035 |
Normal characters include all character in a character set except non-alphabetic
|
|
1036 |
characters (e.g. the copyright symbol, or a block graphics symbol, for example).
|
|
1037 |
|
|
1038 |
@return The width of the maximum width normal character, in pixels. */
|
|
1039 |
IMPORT_C TInt MaxNormalCharWidthInPixels() const;
|
|
1040 |
|
|
1041 |
/** Gets the font specification of this font in twips.
|
|
1042 |
|
|
1043 |
@return The font specification of this font (in twips). */
|
|
1044 |
IMPORT_C TFontSpec FontSpecInTwips() const;
|
|
1045 |
IMPORT_C TCharacterDataAvailability GetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
|
|
1046 |
IMPORT_C TBool GetCharacterPosition(TPositionParam& aParam) const;
|
|
1047 |
IMPORT_C TInt WidthZeroInPixels() const;
|
|
1048 |
IMPORT_C TInt MeasureText(const TDesC& aText, const TMeasureTextInput* aInput = NULL, TMeasureTextOutput* aOutput = NULL) const;
|
|
1049 |
IMPORT_C static TBool CharactersJoin(TInt aLeftCharacter, TInt aRightCharacter);
|
|
1050 |
IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
|
|
1051 |
IMPORT_C TBool GetCharacterPosition2(TPositionParam& aParam, RShapeInfo& aShapeInfo) const;
|
|
1052 |
|
|
1053 |
/** Gets the width in pixels of the specified descriptor when displayed in this
|
|
1054 |
font.
|
|
1055 |
|
|
1056 |
@param aText The descriptor whose width should be determined.
|
|
1057 |
@param aParam Parameter block that controls how much of aText is measured
|
|
1058 |
@return The width of the specified descriptor when displayed in this font,
|
|
1059 |
in pixels. */
|
|
1060 |
IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
|
|
1061 |
};
|
|
1062 |
|
|
1063 |
|
|
1064 |
// inline functions from original gdi.inl
|
|
1065 |
/** Gets the ascent of an ANSI capital letter in the font whether or not
|
|
1066 |
there are any ANSI capitals in the font.
|
|
1067 |
@return The positive distance from the font baseline to the top of a
|
|
1068 |
standard ANSI capital letter
|
|
1069 |
@publishedAll
|
|
1070 |
@released
|
|
1071 |
*/
|
|
1072 |
inline TInt CFont::FontCapitalAscent() const
|
|
1073 |
{
|
|
1074 |
return ExtendedFunction(KFontCapitalAscent);
|
|
1075 |
}
|
|
1076 |
|
|
1077 |
/** Gets the max ascent of any pre-composed glyph in the font. This will
|
|
1078 |
include accents or diacritics that form part of pre-composed glyphs. It is
|
|
1079 |
not guaranteed to cover the max ascent of composite glyphs that have to be
|
|
1080 |
created by a layout engine. This is also the recommended distance between
|
|
1081 |
the top of a text box and the baseline of the first line of text.
|
|
1082 |
@return The positive distance from the font baseline to the top of the
|
|
1083 |
highest pre-composed glyph (including accents) above the baseline
|
|
1084 |
@publishedAll
|
|
1085 |
@released
|
|
1086 |
*/
|
|
1087 |
inline TInt CFont::FontMaxAscent() const
|
|
1088 |
{
|
|
1089 |
return ExtendedFunction(KFontMaxAscent);
|
|
1090 |
}
|
|
1091 |
|
|
1092 |
/** Gets the descent of an ANSI descending character in the font.
|
|
1093 |
Whether or not there are any ANSI descenders in the font.
|
|
1094 |
@return The positive distance from the font baseline to the bottom of the
|
|
1095 |
lowest ANSI descender
|
|
1096 |
@publishedAll
|
|
1097 |
@released
|
|
1098 |
*/
|
|
1099 |
inline TInt CFont::FontStandardDescent() const
|
|
1100 |
{
|
|
1101 |
return ExtendedFunction(KFontStandardDescent);
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
/** Gets the max descent of any pre-composed glyph in the font. This will
|
|
1105 |
include accents or diacritics that form part of pre-composed glyphs. It is
|
|
1106 |
not guaranteed to cover the max descent of composite glyphs that have to be
|
|
1107 |
created by a layout engine.
|
|
1108 |
@return The positive distance from the font baseline to the bottom of the
|
|
1109 |
lowest pre-composed glyph (including accents) below the baseline
|
|
1110 |
@publishedAll
|
|
1111 |
@released
|
|
1112 |
*/
|
|
1113 |
inline TInt CFont::FontMaxDescent() const
|
|
1114 |
{
|
|
1115 |
return ExtendedFunction(KFontMaxDescent);
|
|
1116 |
}
|
|
1117 |
|
|
1118 |
/** Gets the suggested line gap for the font. This is the recommended
|
|
1119 |
baseline to baseline distance between successive lines of text in the font.
|
|
1120 |
@return The positive recommended gap between successive lines
|
|
1121 |
@publishedAll
|
|
1122 |
@released
|
|
1123 |
*/
|
|
1124 |
inline TInt CFont::FontLineGap() const
|
|
1125 |
{
|
|
1126 |
return ExtendedFunction(KFontLineGap);
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
/**
|
|
1130 |
Gets the (positive) maximum height in pixels of the font.
|
|
1131 |
This may differ from the design height.
|
|
1132 |
|
|
1133 |
@return The maximum height of the font.
|
|
1134 |
@publishedAll
|
|
1135 |
@released
|
|
1136 |
*/
|
|
1137 |
inline TInt CFont::FontMaxHeight() const
|
|
1138 |
{
|
|
1139 |
return FontMaxAscent() + FontMaxDescent();
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
|
|
1143 |
// from original gdistruct.h
|
|
1144 |
/*
|
|
1145 |
Structure used to pass input/output parameters between RFontTable and CFbsFont.
|
|
1146 |
@internalTechnology
|
|
1147 |
*/
|
|
1148 |
class TGetFontTableParam
|
|
1149 |
{
|
|
1150 |
public:
|
|
1151 |
TUint32 iTag;
|
|
1152 |
TAny *iContent;
|
|
1153 |
TInt iLength;
|
|
1154 |
};
|
|
1155 |
|
|
1156 |
/*
|
|
1157 |
Structure used to pass input/output parameters between RGlyphOutlineIterator and CFbsFont.
|
|
1158 |
Used when opening an outline iterator.
|
|
1159 |
@internalTechnology
|
|
1160 |
*/
|
|
1161 |
class TGetGlyphOutlineParam
|
|
1162 |
{
|
|
1163 |
public:
|
|
1164 |
TInt iCount;
|
|
1165 |
const TUint *iCodes;
|
|
1166 |
TBool iHinted;
|
|
1167 |
TAny **iOutlines;
|
|
1168 |
TInt *iLengths;
|
|
1169 |
};
|
|
1170 |
|
|
1171 |
/*
|
|
1172 |
Structure used to pass input/output parameters between RGlyphOutlineIterator and CFbsFont.
|
|
1173 |
Used when closing an outline iterator.
|
|
1174 |
@internalTechnology
|
|
1175 |
*/
|
|
1176 |
class TReleaseGlyphOutlineParam
|
|
1177 |
{
|
|
1178 |
public:
|
|
1179 |
TInt iCount;
|
|
1180 |
const TUint *iCodes;
|
|
1181 |
TBool iHinted;
|
|
1182 |
};
|
|
1183 |
|
|
1184 |
|
|
1185 |
#endif // __TEXTBASE_H__
|