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