author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 11:34:25 +0300 | |
changeset 51 | a7c938434754 |
parent 32 | 8b9155204a54 |
permissions | -rw-r--r-- |
32 | 1 |
/* |
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
2 |
* Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies). |
32 | 3 |
* All rights reserved. |
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef FNTSTORE_H__ |
|
20 |
#define FNTSTORE_H__ |
|
21 |
||
22 |
#include <e32std.h> |
|
23 |
#include <f32file.h> |
|
24 |
#include <gdi.h> |
|
25 |
#include <openfont.h> |
|
26 |
#include <linkedfonts.h> |
|
27 |
||
28 |
||
29 |
/** Defines the maximum number of linked typefaces that may be placed in a linked typeface specification |
|
30 |
WARNING: Constant for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
31 |
@publishedAll |
|
32 |
@released |
|
33 |
*/ |
|
34 |
const TInt KMaxLinkedTypefaces = 12; |
|
35 |
/** Defines the maximum number of linked typeface groups that may be placed in a linked typeface specification |
|
36 |
WARNING: Constant for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
37 |
@publishedAll |
|
38 |
@released |
|
39 |
*/ |
|
40 |
const TInt KMaxLinkedTypefaceGroups = 12; |
|
41 |
||
42 |
class CLinkedTypefaceSpecification; |
|
43 |
class TLinkedTypefaceSpecificationArgs; |
|
44 |
class CFbClient; |
|
45 |
class CFontStoreFile; |
|
46 |
class CFontBitmap; |
|
47 |
class RReadStream; |
|
48 |
class TTypefaceFontBitmap; |
|
49 |
class TShapeHeader; |
|
50 |
class TShapeMessageParameters; |
|
51 |
class CTypefaceSupportInfo; |
|
52 |
class COpenFontRasterizer; |
|
53 |
class CLinkedTypefaceGroup; |
|
54 |
IMPORT_C extern const TInt8 KLinkedFontDrive; |
|
55 |
IMPORT_C extern const TUint32 KFontTable_GlyphOutline_CacheMaxMem; |
|
56 |
||
57 |
/** |
|
58 |
WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
59 |
@publishedAll |
|
60 |
@released |
|
61 |
*/ |
|
62 |
class TCharacterMetrics |
|
63 |
{ |
|
64 |
public: |
|
65 |
IMPORT_C TCharacterMetrics(); |
|
66 |
||
67 |
public: |
|
68 |
TInt16 iAscentInPixels; |
|
69 |
TInt16 iHeightInPixels; |
|
70 |
TInt16 iLeftAdjustInPixels; |
|
71 |
TInt16 iMoveInPixels; |
|
72 |
TInt16 iRightAdjustInPixels; |
|
73 |
}; |
|
74 |
||
75 |
/** |
|
76 |
An algorithmic style for how a font is drawn. |
|
77 |
||
78 |
Holds attributes such as whether the font is bold or italic, and the width |
|
79 |
and height factors. This is used as an input parameter for the GetFontById() method |
|
80 |
of some font management classes. See CWsScreenDevice::GetFontById() for more information. |
|
81 |
@publishedAll |
|
82 |
@released |
|
83 |
@see CWsScreenDevice::GetFontById() |
|
84 |
@see CFbsTypefaceStore::GetFontById() |
|
85 |
@see CFbsDevice::GetFontById() |
|
86 |
*/ |
|
87 |
class TAlgStyle |
|
88 |
{ |
|
89 |
public: |
|
90 |
IMPORT_C TAlgStyle(); |
|
91 |
IMPORT_C void SetIsBold(TBool aIsBold); |
|
92 |
IMPORT_C void SetIsItalic(TBool aIsItalic); |
|
93 |
IMPORT_C void SetIsMono(TBool aIsMono); |
|
94 |
IMPORT_C void SetWidthFactor(TInt aWidthFactor); |
|
95 |
IMPORT_C void SetHeightFactor(TInt aHeightFactor); |
|
96 |
IMPORT_C TBool IsBold() const; |
|
97 |
IMPORT_C TBool IsItalic() const; |
|
98 |
IMPORT_C TBool IsMono() const; |
|
99 |
IMPORT_C TInt WidthFactor() const; |
|
100 |
IMPORT_C TInt HeightFactor() const; |
|
101 |
IMPORT_C TBool operator==(const TAlgStyle& aAlgStyle) const; |
|
102 |
TBool operator!=(const TAlgStyle& aAlgStyle) const; |
|
103 |
public: |
|
104 |
/** Baseline offset in pixels. */ |
|
105 |
TInt iBaselineOffsetInPixels; |
|
106 |
private: |
|
107 |
enum |
|
108 |
{ |
|
109 |
EBold=1, |
|
110 |
EItalic=2, |
|
111 |
EMono=4, |
|
112 |
}; |
|
113 |
/** This member is private and not intended for use. */ |
|
114 |
TInt8 iFlags; |
|
115 |
/** This member is private and not intended for use. */ |
|
116 |
TInt8 iWidthFactor; |
|
117 |
/** This member is private and not intended for use. */ |
|
118 |
TInt8 iHeightFactor; |
|
119 |
}; |
|
120 |
||
121 |
/** |
|
122 |
Bitmap font class. |
|
123 |
An object of this class may either access and use a bitmap font (a CFontBitmap) |
|
124 |
or an open font (a COpenFont). |
|
125 |
Stored in a CFontStore. |
|
126 |
@publishedAll |
|
127 |
@released |
|
128 |
*/ |
|
129 |
class CBitmapFont : public CFont |
|
130 |
{ |
|
131 |
friend class CFbsFont; |
|
132 |
friend class CFontStore; |
|
133 |
friend class CFbsBitGc; |
|
134 |
public: |
|
135 |
// New functions |
|
136 |
TUid Uid() const; |
|
137 |
IMPORT_C TCharacterMetrics CharacterMetrics(TInt aCode,const TUint8*& aBytes) const; |
|
138 |
IMPORT_C TBool GetCharacterData(TInt aSessionHandle, TInt aCode, TOpenFontCharMetrics& aMetrics, const TUint8*& aBitmap) const; |
|
139 |
IMPORT_C TBool Rasterize(TInt aSessionHandle,TInt aCode,TOpenFontGlyphData* aGlyphData) const; |
|
140 |
IMPORT_C void GetFontMetrics(TOpenFontMetrics& aMetrics) const; |
|
141 |
IMPORT_C TBool GetFaceAttrib(TOpenFontFaceAttrib& aAttrib) const; |
|
142 |
IMPORT_C TInt BitmapEncoding() const; |
|
143 |
IMPORT_C TBool HasCharacterL(TInt aCode) const; |
|
144 |
IMPORT_C TBool CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const; |
|
145 |
IMPORT_C TShapeHeader* ShapeTextL(const TDesC16& aText, |
|
146 |
TInt aSessionHandle, const TShapeMessageParameters& aParams); |
|
147 |
IMPORT_C void DeleteShape(TInt aSessionHandle,TShapeHeader* aHeader); |
|
148 |
IMPORT_C void operator delete(TAny*); |
|
149 |
inline TBool IsOpenFont() const; |
|
150 |
inline COpenFont* OpenFont() const; |
|
151 |
inline TGlyphBitmapType GlyphBitmapType() const; |
|
152 |
IMPORT_C TUint32 UniqueFontId(); |
|
153 |
IMPORT_C TInt GetFontTable(TUint32 aTag, TAny*& aTableContent, |
|
154 |
TInt& aLength, TInt aSessionHandle); |
|
155 |
IMPORT_C TInt GetGlyphOutline(TUint aCode, |
|
156 |
TBool aHinted, TAny*& aOutline, TInt& aLength, TInt aSessionHandle); |
|
157 |
IMPORT_C void ReleaseGlyphOutlines(TInt aCount, const TUint* aCodes, |
|
158 |
TBool aHinted, TInt aSessionHandle); |
|
159 |
IMPORT_C void ReleaseFontTable(TUint32 aTag, TInt aSessionHandle); |
|
160 |
||
161 |
private: |
|
162 |
// From CFont |
|
163 |
IMPORT_C virtual TUid DoTypeUid() const; |
|
164 |
IMPORT_C virtual TInt DoHeightInPixels() const; |
|
165 |
IMPORT_C virtual TInt DoAscentInPixels() const; |
|
166 |
IMPORT_C virtual TInt DoCharWidthInPixels(TChar aChar) const; |
|
167 |
IMPORT_C virtual TInt DoTextWidthInPixels(const TDesC &aText) const; |
|
168 |
IMPORT_C virtual TInt DoBaselineOffsetInPixels() const; |
|
169 |
IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels) const; |
|
170 |
IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels, TInt &aExcessWidthInPixels) const; |
|
171 |
IMPORT_C virtual TInt DoMaxCharWidthInPixels() const; |
|
172 |
IMPORT_C virtual TInt DoMaxNormalCharWidthInPixels() const; |
|
173 |
IMPORT_C virtual TFontSpec DoFontSpecInTwips() const; |
|
174 |
IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const; |
|
175 |
||
176 |
private: |
|
177 |
CBitmapFont(RHeap* aHeap,const TFontSpec& aFontSpecInTwips, const TAlgStyle& aAlgStyle, CFontBitmap* aFontBitmap); |
|
178 |
CBitmapFont(RHeap* aHeap,const TFontSpec& aFontSpecInTwips, const TAlgStyle& aAlgStyle, COpenFont* aOpenFont); |
|
179 |
void ConstructL(); |
|
180 |
~CBitmapFont(); |
|
181 |
static CBitmapFont* NewL(RHeap* aHeap, const TFontSpec& aFontSpecInTwips, const TAlgStyle& aAlgStyle, CFontBitmap* aFontBitmap); |
|
182 |
static CBitmapFont* NewL(RHeap* aHeap, const TFontSpec& aFontSpecInTwips, const TAlgStyle& aAlgStyle, COpenFont* aOpenFont); |
|
183 |
inline void operator delete(TAny*, TAny*) {} |
|
184 |
TInt Width(TInt aNum) const; |
|
185 |
TInt Height(TInt aNum) const; |
|
186 |
CFontBitmap* FontBitmap() const; |
|
187 |
void InstallOpenFontShaper(COpenFont* aOpenFont, CShaper::TInput& aShaperInput); |
|
188 |
TInt DoTextWidthInPixels(const TDesC &aText, const TMeasureTextInput* aParam) const; |
|
189 |
void SetUniqueFontId(TUint32 aUniqueFontId); |
|
190 |
||
191 |
private: |
|
192 |
TFontSpec iFontSpecInTwips; |
|
193 |
||
194 |
public: |
|
195 |
/** The algorithmic font style. */ |
|
196 |
TAlgStyle iAlgStyle; // must not move this member |
|
197 |
||
198 |
private: |
|
199 |
// Binary Compatibility warning - data member iOpenFont is referenced by inline methods |
|
200 |
RHeap* iHeap; |
|
201 |
TInt iFontBitmapOffset; |
|
202 |
||
203 |
// In order to be able to work with the flexible memory model, iOpenFont is |
|
204 |
// actually an offset from the address of this class. |
|
205 |
// iOpenFont's type remains unchanged. |
|
206 |
// As Qt code that uses OpenFont() must be able to run on new and old versions |
|
207 |
// of Symbian OS, it must be able to determine whether iOpenFont is a pointer or |
|
208 |
// an offset at run-time. Therefore an offset will have its lowest significant bit set to 1. |
|
209 |
// If iOpenFont is null, this object is not an open font. |
|
210 |
// Assumption: a pointer always has least significant bit value of zero. |
|
211 |
COpenFont* iOpenFont; // if iOpenFont is non-null this is an open font and many functions are forwarded to it |
|
212 |
||
213 |
TUint32 iReserved; |
|
214 |
TUint32 iUniqueFontId; // unique id for this instance of this font |
|
215 |
}; |
|
216 |
||
217 |
/** |
|
218 |
WARNING: Class for internal and partner use ONLY. Compatibility is not guaranteed in future releases. |
|
219 |
@publishedAll |
|
220 |
@released |
|
221 |
*/ |
|
222 |
class TLinkedTypefaceGroupArgs |
|
223 |
{ |
|
224 |
public: |
|
225 |
TInt iGroupId; |
|
226 |
CLinkedTypefaceGroup::TScalingOption iScalingOption; |
|
227 |
CLinkedTypefaceGroup::TBaselineShift iBaselineShift; |
|
228 |
TInt iAntialiasingThreshold; |
|
229 |
TInt iBoldnessPercentage; |
|
230 |
TInt iItalicAngle; |
|
231 |
public: |
|
232 |
void operator =(const CLinkedTypefaceGroup* aRhs); |
|
233 |
}; |
|
234 |
||
235 |
class COpenFontLinkedTypefaceElementSpec; |
|
236 |
class COpenFontLinkedTypefaceSpecification; |
|
237 |
||
238 |
/** |
|
239 |
WARNING: Class for internal and partner use ONLY. Compatibility is not guaranteed in future releases. |
|
240 |
@publishedAll |
|
241 |
@released |
|
242 |
*/ |
|
243 |
class TLinkedTypefaceElementSpecArgs |
|
244 |
{ |
|
245 |
public: |
|
246 |
TBufC<KMaxTypefaceNameLength> iName; |
|
247 |
TBool iIsCanonical; |
|
248 |
TInt iGroupId; |
|
249 |
||
250 |
void operator = (const CLinkedTypefaceElementSpec* aRhs); |
|
251 |
void operator = (const COpenFontLinkedTypefaceElementSpec* aRhs); |
|
252 |
}; |
|
253 |
||
254 |
/** |
|
255 |
WARNING: Class for internal and partner use ONLY. Compatibility is not guaranteed in future releases. |
|
256 |
@publishedAll |
|
257 |
@released |
|
258 |
*/ |
|
259 |
class TLinkedTypefaceSpecificationArgs |
|
260 |
{ |
|
261 |
public: |
|
262 |
TBufC<KMaxTypefaceNameLength> iName; |
|
263 |
TLinkedTypefaceElementSpecArgs iTypefaces[KMaxLinkedTypefaces]; |
|
264 |
TLinkedTypefaceGroupArgs iGroups[KMaxLinkedTypefaceGroups]; |
|
265 |
TInt iSize; |
|
266 |
TInt iGroupSize; |
|
267 |
TInt iCanonicalIndex; |
|
268 |
||
269 |
IMPORT_C void operator = (const CLinkedTypefaceSpecification& aRhs); |
|
270 |
IMPORT_C void operator = (const COpenFontLinkedTypefaceSpecification& aRhs); |
|
271 |
}; |
|
272 |
||
273 |
||
274 |
||
275 |
class TUnhintedOutlineId; |
|
276 |
class THintedOutlineId; |
|
277 |
class CFontTableCache; |
|
278 |
class CUnhintedOutlineCache; |
|
279 |
class CHintedOutlineCache; |
|
280 |
class TFontTableGlyphOutlineCacheMemMonitor; |
|
281 |
||
282 |
class CFontStore : public CTypefaceStore |
|
283 |
/** |
|
284 |
A store for fonts. |
|
285 |
||
286 |
Stores and handles both open and fixed-size fonts. Open fonts are made from |
|
287 |
open (scalable) typefaces by Open Font plug-in rasterizers. Fonts of other |
|
288 |
typefaces are stored in a limited number of fixed sizes. However, which is |
|
289 |
being used is transparent to the user of this class. For example the GetNearestFont...() |
|
290 |
functions get a bitmap font which may be retrieved from memory or generated |
|
291 |
via a rasterizer. |
|
292 |
@publishedAll |
|
293 |
@released |
|
294 |
*/ |
|
295 |
{ |
|
296 |
friend class CLinkedFonts; |
|
297 |
friend class CLinkedTypefaceSpecification; |
|
298 |
||
299 |
public: |
|
300 |
IMPORT_C static CFontStore* NewL(RHeap* aHeap); |
|
301 |
IMPORT_C ~CFontStore(); |
|
302 |
IMPORT_C TUid AddFileL(const TDesC& aName); |
|
303 |
IMPORT_C void RemoveFile(TUid aFileUid); |
|
304 |
IMPORT_C TInt GetNearestFontInTwips(CFont *&aFont, const TFontSpec& aFontSpec); |
|
305 |
IMPORT_C TInt GetNearestFontInPixels(CFont *&aFont, const TFontSpec &aFontSpec); |
|
306 |
IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec& aFontSpec); |
|
307 |
IMPORT_C TInt GetNearestFontToDesignHeightInPixels(CFont *&aFont, const TFontSpec& aFontSpec); |
|
308 |
IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight); |
|
309 |
IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight); |
|
310 |
IMPORT_C TInt GetNearestFontInTwips(CFont *&aFont, const TOpenFontSpec& aFontSpec); |
|
311 |
IMPORT_C TInt GetNearestFontInPixels(CFont *&aFont, const TOpenFontSpec &aFontSpec); |
|
312 |
IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TOpenFontSpec& aFontSpec); |
|
313 |
IMPORT_C TInt GetNearestFontToDesignHeightInPixels(CFont *&aFont, const TOpenFontSpec& aFontSpec); |
|
314 |
IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight); |
|
315 |
IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight); |
|
316 |
IMPORT_C TInt GetFontById(CFont *&aFont,TUid aUid,const TAlgStyle& aAlgStyle); |
|
317 |
IMPORT_C TInt NumTypefaces() const; |
|
318 |
IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport,TInt aTypefaceIndex) const; |
|
319 |
IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const; |
|
320 |
IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const; |
|
321 |
IMPORT_C void InstallRasterizerL(COpenFontRasterizer* aRasterizer); |
|
322 |
IMPORT_C void DeleteSessionCache(TInt aSessionHandle); |
|
323 |
inline TGlyphBitmapType DefaultBitmapType() const; |
|
324 |
inline void SetDefaultBitmapType(TGlyphBitmapType aType); |
|
325 |
IMPORT_C void InstallShaperFactoryL(CShaperFactory* aShaperFactory); |
|
326 |
const CArrayPtrFlat<CShaperFactory>* ShaperFactoryList() const; |
|
327 |
COpenFontSessionCacheList* GetSessionCacheList(); |
|
328 |
TInt GetShaperCacheMemUsage(); |
|
329 |
void SetShaperCacheMemUsage(TInt aUsage); |
|
330 |
CArrayPtrFlat<COpenFontFile>* GetOpenFontFileList(); |
|
331 |
void IncNumShaperCaches(); |
|
332 |
void DecNumShaperCaches(); |
|
333 |
TInt GetNumShaperCaches(); |
|
334 |
IMPORT_C TInt CreateLinkedTypeface(const TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId); |
|
335 |
IMPORT_C void GetLinkedTypefaceL(TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec); |
|
336 |
IMPORT_C TBool HaveTypefaceFamilyName(const TDesC& aName); |
|
337 |
IMPORT_C void UpdateLinkedTypefaceL(const TLinkedTypefaceSpecificationArgs& aLinkedTypefaceSpec); |
|
338 |
IMPORT_C void LoadFontsAtStartupL(); |
|
339 |
IMPORT_C TBool GetFontFilePath(const TDesC& aFontName, TFileName& aFilePath) const; |
|
340 |
IMPORT_C void CleanupCacheOnFbsSessionTermination(TInt aSessionHandle); |
|
341 |
||
342 |
TInt CacheFontTable(TUid aFileUid, TUint32 aTag, TAny*& aContent, TInt aLength); |
|
343 |
TInt ReleaseFontTable(TUid aFileUid, TUint32 aTag, TInt aSessionHandle); |
|
344 |
TInt FindFontTableInCache(TUid aFileUid, TUint32 aTag, TAny*& aContent, TInt& aLength); |
|
345 |
TInt IncFontTableRefCount(TUid aFileUid, TUint32 aTag, TInt aSessionHandle); |
|
346 |
TInt DecFontTableRefCount(TUid aFileUid, TUint32 aTag, TInt aSessionHandle); |
|
347 |
TInt CacheUnhintedOutline(const TUnhintedOutlineId& aOutlineId, TAny* aData, |
|
348 |
TInt aLength, TAny*& aOutline, TInt& aLen); |
|
349 |
TInt CacheHintedOutline(const THintedOutlineId& aOutlineId, TAny* aData, TInt aLength, |
|
350 |
TAny*& aOutline, TInt& aLen); |
|
351 |
TInt ReleaseUnhintedOutline(const TUnhintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
352 |
TInt ReleaseHintedOutline(const THintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
353 |
TInt IncreaseUnhintedOutlineRefCount(const TUnhintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
354 |
TInt IncreaseHintedOutlineRefCount(const THintedOutlineId& aOutlineId, TInt aSessionHandle); |
|
355 |
TInt FindUnhintedOutlineInCache(const TUnhintedOutlineId& aOutlineId, TAny*& aData, |
|
356 |
TInt &aLength); |
|
357 |
TInt FindHintedOutlineInCache(const THintedOutlineId& aOutlineId, TAny*& aData, TInt& aLength); |
|
358 |
void CleanupCacheOnOpenFontRemoval(COpenFont* aFont); |
|
359 |
void CleanupCacheOnOpenFontFileRemoval(COpenFontFile* aFontFile); |
|
360 |
||
361 |
private: |
|
362 |
CFontStore(RHeap* aHeap); |
|
363 |
void ConstructL(); |
|
364 |
void InternalizeFontStoreFileL(CFontStoreFile* aFontStoreFile, TInt aFontVersion); |
|
365 |
TTypeface* GetNearestTypeface(const TTypeface& aTypeface) const; |
|
366 |
TTypefaceFontBitmap GetNearestTypefaceFontBitmap(const TFontSpec& aFontSpecInPixels, TInt aMaxHeight); |
|
367 |
CFontBitmap* GetFontBitmapById(TUid aUid); |
|
368 |
TBool IsFontLoaded(CFont*& aFont, const TAlgStyle& aAlgStyle, const TFontSpec& aFontSpecInPixels, TUid aUid, TInt aMaxHeight = 0) const; |
|
369 |
TBool IsFontLoaded(CFont*& aFont, const TAlgStyle& aAlgStyle, const TOpenFontSpec& aFontSpecInPixels, TInt aMaxHeight) const; |
|
370 |
CBitmapFont* NewFontL(const TFontSpec& aFontSpecInTwips,const TAlgStyle& aAlgStyle,CFontBitmap* aFontBitmap); |
|
371 |
CBitmapFont* NewFontL(const TOpenFontSpec& aFontSpecInTwips,const TAlgStyle& aAlgStyle,COpenFont* aOpenFont); |
|
372 |
TInt VerticalPixelsToTwips(TInt aPixelHeight) const; |
|
373 |
TInt VerticalTwipsToPixels(TInt aTwipsHeight) const; |
|
374 |
void GetNearestBitmapFontInPixelsL(CFont*& aFont, TFontSpec& aFontSpec, TInt aMaxHeight); |
|
375 |
void GetNearestOpenFontInPixelsL( |
|
376 |
CFont*& aFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight); |
|
377 |
TInt GetNearestRealFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight); |
|
378 |
TInt GetNearestFontInPixelsL(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight); |
|
379 |
TInt CreateLinkedTypefaceL(const TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId); |
|
380 |
TInt GetCanonicalIndex(TInt aTypefaceIndex) const; |
|
381 |
void TypefaceSupportLinked(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const; |
|
382 |
TInt GetNearestFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight); |
|
383 |
void SanityCheckForTtfL(RFile& aFile, TUint aFontFileSize, TBool aStrictChecking); |
|
384 |
void SanityCheckFontFileL(TParse& aParse); |
|
385 |
TInt GetNearestOpenFontInPixelsByFontName(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight); |
|
386 |
TInt GetNearestOpenFontInPixelsBySimilarity(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight); |
|
387 |
TInt AddTypefacesToSupportList(COpenFontFile* aOpenFontFile); |
|
388 |
void RemoveTypefacesFromSupportList(COpenFontFile* aOpenFontFile); |
|
389 |
TInt FindBitmapFontFileIndexByUid(TUid aUid); |
|
390 |
TBool IncRefCountOfLoadedFont(const TParse& aFileName, TUid& aFontUid); |
|
391 |
TBool LoadFileAsOpenFontL(const TParse& aFileName, TUid& aFontUid); |
|
392 |
TUid LoadFileAsBitmapFontL(const TParse& aParse); |
|
393 |
static void CleanupRemoveFontFile(TAny* aCleanupInfo); |
|
394 |
const TAny* FontLinkingInterface() const; |
|
395 |
TInt ValidateLinkedFontSpecificationL(COpenFontLinkedTypefaceSpecification& aSpec, TBool aOverwrite) const; |
|
396 |
void GenerateLinkedFontFileL(COpenFontLinkedTypefaceSpecification& aSpec, const TAny* aExtension, TBool aUpdate); |
|
397 |
void LoadFontsL(const TDesC& aFontsDir); |
|
398 |
void AddSanityCheckedFontL(const TParse& aFileName, TUid& aUid); |
|
399 |
public: |
|
400 |
/** The width of 1000 pixels in twips. |
|
401 |
||
402 |
This is set in the constructor. If the appropriate HALData attributes are |
|
403 |
set (EDisplayXPixels and EDisplayXTwips) then the value is calculated using |
|
404 |
these; otherwise the value is set to 11860. */ |
|
405 |
TInt iKPixelWidthInTwips; |
|
406 |
||
407 |
/** The height of 1000 pixels in twips. |
|
408 |
||
409 |
This is set in the constructor. If the appropriate HALData attributes are |
|
410 |
set (EDisplayYPixels and EDisplayYTwips) then the value is calculated using |
|
411 |
these; otherwise the value is set to 11860. */ |
|
412 |
TInt iKPixelHeightInTwips; |
|
413 |
||
414 |
private: |
|
415 |
// Binary Compatibility warning - data member iDefaultBitmapType is referenced by inline methods |
|
416 |
RFs iFs; |
|
417 |
RHeap* iHeap; |
|
418 |
CArrayPtrFlat<CFontStoreFile> iFontStoreFileList; |
|
419 |
CArrayPtrFlat<TTypeface> iTypefaceList; |
|
420 |
CArrayPtrFlat<CFontBitmap> iFontBitmapList; |
|
421 |
CArrayFixFlat<TTypefaceFontBitmap> iTypefaceFontBitmapList; |
|
422 |
CArrayPtrFlat<COpenFontFile> iOpenFontFileList; |
|
423 |
TInt iReserved[2]; // keep iDefaultBitmapType at the correct offset |
|
424 |
CFontTableCache *iFontTableCache; |
|
425 |
CUnhintedOutlineCache *iUnhintedOutlineCache; |
|
426 |
CHintedOutlineCache *iHintedOutlineCache; |
|
427 |
TFontTableGlyphOutlineCacheMemMonitor *iCacheMemMon; |
|
428 |
CArrayPtrFlat<COpenFontRasterizer> iOpenFontRasterizerList; |
|
429 |
COpenFontSessionCacheList* iOpenFontSessionCacheList; |
|
430 |
TInt iOpenFontUid; |
|
431 |
TGlyphBitmapType iDefaultBitmapType; |
|
432 |
CArrayPtrFlat<CShaperFactory> iShaperFactoryList; |
|
433 |
TInt iOpenFontShaperCacheMemUsage; |
|
434 |
TInt iNumberOfShaperCaches; |
|
435 |
RPointerArray<CTypefaceSupportInfo> iOpenFontTypefaceSupportList; |
|
51
a7c938434754
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
436 |
TAny* iUnused; |
32 | 437 |
TAny* iUnused2; |
438 |
TUint32 iUniqueFontIdCount; |
|
439 |
}; |
|
440 |
||
441 |
// inline functions start here |
|
442 |
||
443 |
/** Returns whether the bitmap font object is an open font (a COpenFont) rather |
|
444 |
than a bitmap font (a CFontBitmap). |
|
445 |
||
446 |
@return ETrue if the bitmap font object is using an open font (a COpenFont); |
|
447 |
EFalse if it is using a bitmap font (a CFontBitmap). |
|
448 |
@see OpenFont() |
|
449 |
*/ |
|
450 |
inline TBool CBitmapFont::IsOpenFont() const |
|
451 |
{ |
|
452 |
return iOpenFont != NULL; |
|
453 |
} |
|
454 |
||
455 |
||
456 |
/** Returns a pointer to the open font being used by the bitmap font object. |
|
457 |
||
458 |
@return A pointer to an open font. |
|
459 |
@see IsOpenFont() |
|
460 |
*/ |
|
461 |
inline COpenFont* CBitmapFont::OpenFont() const |
|
462 |
{ |
|
463 |
if (reinterpret_cast<TInt>(iOpenFont) & 1) |
|
464 |
{ |
|
465 |
return reinterpret_cast<COpenFont*>(const_cast<CBitmapFont*>(PtrAdd(this, reinterpret_cast<TInt>(iOpenFont) & ~1))); |
|
466 |
} |
|
467 |
else |
|
468 |
{ |
|
469 |
return iOpenFont; |
|
470 |
} |
|
471 |
} |
|
472 |
||
473 |
/** Gets the anti-aliasing setting for the font, see TGlyphBitmapType for |
|
474 |
the range of values. |
|
475 |
||
476 |
This is only applicable to open fonts (COpenFonts) not bitmap fonts (CBitmapFonts). |
|
477 |
||
478 |
Note that this setting is stored in the device-independent font specification |
|
479 |
which is set when the bitmap font object is constructed. |
|
480 |
||
481 |
@return The anti-aliasing setting for the font. |
|
482 |
@see IsOpenFont() |
|
483 |
@see TGlyphBitmapType |
|
484 |
@see COpenFont |
|
485 |
@see CBitmapFont |
|
486 |
*/ |
|
487 |
inline TGlyphBitmapType CBitmapFont::GlyphBitmapType() const |
|
488 |
{ |
|
489 |
return iFontSpecInTwips.iFontStyle.BitmapType(); |
|
490 |
} |
|
491 |
||
492 |
/** Returns a default bitmap type. |
|
493 |
||
494 |
@return A default bitmap type. |
|
495 |
@see TGlyphBitmapType |
|
496 |
*/ |
|
497 |
inline TGlyphBitmapType CFontStore::DefaultBitmapType() const |
|
498 |
{ |
|
499 |
return iDefaultBitmapType; |
|
500 |
} |
|
501 |
||
502 |
/** Sets a default bitmap type. |
|
503 |
||
504 |
@param aType A default bitmap type. |
|
505 |
@see TGlyphBitmapType |
|
506 |
*/ |
|
507 |
inline void CFontStore::SetDefaultBitmapType(TGlyphBitmapType aType) |
|
508 |
{ |
|
509 |
iDefaultBitmapType = aType; |
|
510 |
} |
|
511 |
||
512 |
#endif |
|
513 |