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