fontservices/fontstore/inc/FNTSTORE.h
changeset 0 1fb32624e06b
child 5 e96e8a131979
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     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 	COpenFont* iOpenFont; // if iOpenFont is non-null this is an open font and many functions are forwarded to it
       
   216 						
       
   217 #ifdef FNTSTORE_SUPPORT_FMM	
       
   218 	// If iOpenFontOffet is non-zero this is an open font
       
   219 	TInt iOpenFontOffset;
       
   220 #else
       
   221 	TUint32 iReserved;
       
   222 #endif // FNTSTORE_SUPPORT_FMM
       
   223 
       
   224 	TUint32 iUniqueFontId;	// unique id for this instance of this font
       
   225 	};
       
   226 
       
   227 /**
       
   228 WARNING: Class for internal and partner use ONLY.  Compatibility is not guaranteed in future releases.
       
   229 @publishedAll
       
   230 @released
       
   231  */
       
   232 class TLinkedTypefaceGroupArgs
       
   233 	{
       
   234 public:
       
   235 	TInt iGroupId;
       
   236 	CLinkedTypefaceGroup::TScalingOption iScalingOption;
       
   237 	CLinkedTypefaceGroup::TBaselineShift iBaselineShift;
       
   238 	TInt iAntialiasingThreshold;
       
   239 	TInt iBoldnessPercentage;
       
   240 	TInt iItalicAngle;
       
   241 public:
       
   242 	void operator =(const CLinkedTypefaceGroup* aRhs);
       
   243 	};
       
   244 
       
   245 class COpenFontLinkedTypefaceElementSpec;
       
   246 class COpenFontLinkedTypefaceSpecification;
       
   247 
       
   248 /**
       
   249 WARNING: Class for internal and partner use ONLY.  Compatibility is not guaranteed in future releases.
       
   250 @publishedAll
       
   251 @released
       
   252  */
       
   253 class TLinkedTypefaceElementSpecArgs
       
   254 	{
       
   255 public:
       
   256 	TBufC<KMaxTypefaceNameLength> iName;
       
   257 	TBool iIsCanonical;
       
   258 	TInt iGroupId;
       
   259 	
       
   260 	void operator = (const CLinkedTypefaceElementSpec* aRhs);
       
   261 	void operator = (const COpenFontLinkedTypefaceElementSpec* aRhs);
       
   262 	};
       
   263 
       
   264 /**
       
   265 WARNING: Class for internal and partner use ONLY.  Compatibility is not guaranteed in future releases.
       
   266 @publishedAll
       
   267 @released
       
   268  */
       
   269 class TLinkedTypefaceSpecificationArgs
       
   270 	{
       
   271 public:
       
   272 	TBufC<KMaxTypefaceNameLength> iName;
       
   273 	TLinkedTypefaceElementSpecArgs iTypefaces[KMaxLinkedTypefaces];
       
   274 	TLinkedTypefaceGroupArgs iGroups[KMaxLinkedTypefaceGroups];
       
   275 	TInt	iSize;
       
   276 	TInt	iGroupSize;
       
   277 	TInt	iCanonicalIndex;
       
   278 	
       
   279 	IMPORT_C void operator = (const CLinkedTypefaceSpecification& aRhs);
       
   280 	IMPORT_C void operator = (const COpenFontLinkedTypefaceSpecification& aRhs);
       
   281 	};
       
   282 	
       
   283 
       
   284 
       
   285 class TUnhintedOutlineId;
       
   286 class THintedOutlineId;
       
   287 class CFontTableCache;
       
   288 class CUnhintedOutlineCache;
       
   289 class CHintedOutlineCache;
       
   290 class TFontTableGlyphOutlineCacheMemMonitor;
       
   291 
       
   292 class CFontStore : public CTypefaceStore
       
   293 /** 
       
   294 A store for fonts.
       
   295 
       
   296 Stores and handles both open and fixed-size fonts. Open fonts are made from 
       
   297 open (scalable) typefaces by Open Font plug-in rasterizers. Fonts of other 
       
   298 typefaces are stored in a limited number of fixed sizes. However, which is 
       
   299 being used is transparent to the user of this class. For example the GetNearestFont...() 
       
   300 functions get a bitmap font which may be retrieved from memory or generated 
       
   301 via a rasterizer.
       
   302 @publishedAll
       
   303 @released
       
   304 */
       
   305     {
       
   306 friend class CLinkedFonts;
       
   307 friend class CLinkedTypefaceSpecification; 
       
   308 
       
   309 public:
       
   310 	IMPORT_C static CFontStore* NewL(RHeap* aHeap);
       
   311 	IMPORT_C ~CFontStore();
       
   312 	IMPORT_C TUid AddFileL(const TDesC& aName);
       
   313 	IMPORT_C void RemoveFile(TUid aFileUid);
       
   314 	IMPORT_C TInt GetNearestFontInTwips(CFont *&aFont, const TFontSpec& aFontSpec);
       
   315 	IMPORT_C TInt GetNearestFontInPixels(CFont *&aFont, const TFontSpec &aFontSpec);
       
   316 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec& aFontSpec);
       
   317 	IMPORT_C TInt GetNearestFontToDesignHeightInPixels(CFont *&aFont, const TFontSpec& aFontSpec);
       
   318 	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
       
   319 	IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
       
   320 	IMPORT_C TInt GetNearestFontInTwips(CFont *&aFont, const TOpenFontSpec& aFontSpec);
       
   321 	IMPORT_C TInt GetNearestFontInPixels(CFont *&aFont, const TOpenFontSpec &aFontSpec);
       
   322 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TOpenFontSpec& aFontSpec);
       
   323 	IMPORT_C TInt GetNearestFontToDesignHeightInPixels(CFont *&aFont, const TOpenFontSpec& aFontSpec);
       
   324 	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
       
   325 	IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
       
   326 	IMPORT_C TInt GetFontById(CFont *&aFont,TUid aUid,const TAlgStyle& aAlgStyle);
       
   327 	IMPORT_C TInt NumTypefaces() const;
       
   328 	IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport,TInt aTypefaceIndex) const;
       
   329 	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;
       
   330 	IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;
       
   331 	IMPORT_C void InstallRasterizerL(COpenFontRasterizer* aRasterizer);
       
   332 	IMPORT_C void DeleteSessionCache(TInt aSessionHandle);
       
   333 	inline TGlyphBitmapType DefaultBitmapType() const;
       
   334 	inline void SetDefaultBitmapType(TGlyphBitmapType aType);
       
   335 	IMPORT_C void InstallShaperFactoryL(CShaperFactory* aShaperFactory);
       
   336 	const CArrayPtrFlat<CShaperFactory>* ShaperFactoryList() const;
       
   337 	COpenFontSessionCacheList* GetSessionCacheList();
       
   338 	TInt GetShaperCacheMemUsage();
       
   339 	void SetShaperCacheMemUsage(TInt aUsage);
       
   340 	CArrayPtrFlat<COpenFontFile>* GetOpenFontFileList();
       
   341 	void IncNumShaperCaches();
       
   342 	void DecNumShaperCaches();
       
   343 	TInt GetNumShaperCaches();
       
   344 	IMPORT_C TInt CreateLinkedTypeface(const TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId);
       
   345 	IMPORT_C void GetLinkedTypefaceL(TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec);
       
   346 	IMPORT_C TBool HaveTypefaceFamilyName(const TDesC& aName);
       
   347 	IMPORT_C void UpdateLinkedTypefaceL(const TLinkedTypefaceSpecificationArgs& aLinkedTypefaceSpec);
       
   348 	IMPORT_C void LoadFontsAtStartupL();
       
   349 	IMPORT_C TBool GetFontFilePath(const TDesC& aFontName, TFileName& aFilePath) const;
       
   350     IMPORT_C void CleanupCacheOnFbsSessionTermination(TInt aSessionHandle);
       
   351 	
       
   352 	TInt CacheFontTable(TUid aFileUid, TUint32 aTag, TAny*& aContent, TInt aLength);
       
   353 	TInt ReleaseFontTable(TUid aFileUid, TUint32 aTag, TInt aSessionHandle);
       
   354 	TInt FindFontTableInCache(TUid aFileUid, TUint32 aTag, TAny*& aContent, TInt& aLength);
       
   355 	TInt IncFontTableRefCount(TUid aFileUid, TUint32 aTag, TInt aSessionHandle);
       
   356 	TInt DecFontTableRefCount(TUid aFileUid, TUint32 aTag, TInt aSessionHandle);
       
   357 	TInt CacheUnhintedOutline(const TUnhintedOutlineId& aOutlineId, TAny* aData, 
       
   358 	        TInt aLength, TAny*& aOutline, TInt& aLen);
       
   359 	TInt CacheHintedOutline(const THintedOutlineId& aOutlineId, TAny* aData, TInt aLength,
       
   360 	        TAny*& aOutline, TInt& aLen);
       
   361 	TInt ReleaseUnhintedOutline(const TUnhintedOutlineId& aOutlineId, TInt aSessionHandle);
       
   362 	TInt ReleaseHintedOutline(const THintedOutlineId& aOutlineId, TInt aSessionHandle);
       
   363 	TInt IncreaseUnhintedOutlineRefCount(const TUnhintedOutlineId& aOutlineId, TInt aSessionHandle);
       
   364 	TInt IncreaseHintedOutlineRefCount(const THintedOutlineId& aOutlineId, TInt aSessionHandle);
       
   365 	TInt FindUnhintedOutlineInCache(const TUnhintedOutlineId& aOutlineId, TAny*& aData, 
       
   366 	        TInt &aLength);
       
   367 	TInt FindHintedOutlineInCache(const THintedOutlineId& aOutlineId, TAny*& aData, TInt& aLength);
       
   368     void CleanupCacheOnOpenFontRemoval(COpenFont* aFont);
       
   369     void CleanupCacheOnOpenFontFileRemoval(COpenFontFile* aFontFile);
       
   370 
       
   371 private:
       
   372 	CFontStore(RHeap* aHeap);
       
   373 	void ConstructL();
       
   374 	void InternalizeFontStoreFileL(CFontStoreFile* aFontStoreFile, TInt aFontVersion);
       
   375 	TTypeface* GetNearestTypeface(const TTypeface& aTypeface) const;
       
   376 	TTypefaceFontBitmap GetNearestTypefaceFontBitmap(const TFontSpec& aFontSpecInPixels, TInt aMaxHeight);
       
   377 	CFontBitmap* GetFontBitmapById(TUid aUid);
       
   378 	TBool IsFontLoaded(CFont*& aFont, const TAlgStyle& aAlgStyle, const TFontSpec& aFontSpecInPixels, TUid aUid, TInt aMaxHeight = 0) const;
       
   379 	TBool IsFontLoaded(CFont*& aFont, const TAlgStyle& aAlgStyle, const TOpenFontSpec& aFontSpecInPixels, TInt aMaxHeight) const;
       
   380 	CBitmapFont* NewFontL(const TFontSpec& aFontSpecInTwips,const TAlgStyle& aAlgStyle,CFontBitmap* aFontBitmap);
       
   381 	CBitmapFont* NewFontL(const TOpenFontSpec& aFontSpecInTwips,const TAlgStyle& aAlgStyle,COpenFont* aOpenFont);
       
   382 	TInt VerticalPixelsToTwips(TInt aPixelHeight) const;
       
   383 	TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
       
   384 	void GetNearestBitmapFontInPixelsL(CFont*& aFont, TFontSpec& aFontSpec, TInt aMaxHeight);
       
   385 	void GetNearestOpenFontInPixelsL(
       
   386 	CFont*& aFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
       
   387 	TInt GetNearestRealFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
       
   388 	TInt GetNearestFontInPixelsL(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
       
   389 	TInt CreateLinkedTypefaceL(const TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId);
       
   390 	TInt GetCanonicalIndex(TInt aTypefaceIndex) const;
       
   391 	void TypefaceSupportLinked(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
       
   392 	TInt GetNearestFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
       
   393 	void SanityCheckForTtfL(RFile& aFile, TUint aFontFileSize, TBool aStrictChecking);
       
   394 	void SanityCheckFontFileL(TParse& aParse);
       
   395 	TInt GetNearestOpenFontInPixelsByFontName(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
       
   396 	TInt GetNearestOpenFontInPixelsBySimilarity(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
       
   397 	TInt AddTypefacesToSupportList(COpenFontFile* aOpenFontFile);
       
   398 	void RemoveTypefacesFromSupportList(COpenFontFile* aOpenFontFile);
       
   399 	TInt FindBitmapFontFileIndexByUid(TUid aUid);
       
   400 	TBool IncRefCountOfLoadedFont(const TParse& aFileName, TUid& aFontUid);
       
   401 	TBool LoadFileAsOpenFontL(const TParse& aFileName, TUid& aFontUid);
       
   402 	TUid LoadFileAsBitmapFontL(const TParse& aParse);
       
   403 	static void CleanupRemoveFontFile(TAny* aCleanupInfo);
       
   404 	const TAny* FontLinkingInterface() const;
       
   405 	TInt ValidateLinkedFontSpecificationL(COpenFontLinkedTypefaceSpecification& aSpec, TBool aOverwrite) const;
       
   406 	void GenerateLinkedFontFileL(COpenFontLinkedTypefaceSpecification& aSpec, const TAny* aExtension, TBool aUpdate);
       
   407 	void LoadFontsL(const TDesC& aFontsDir);
       
   408 	void AddSanityCheckedFontL(const TParse& aFileName, TUid& aUid);
       
   409 public:
       
   410 	/** The width of 1000 pixels in twips.
       
   411 	
       
   412 	This is set in the constructor. If the appropriate HALData attributes are 
       
   413 	set (EDisplayXPixels and EDisplayXTwips) then the value is calculated using 
       
   414 	these; otherwise the value is set to 11860. */
       
   415 	TInt iKPixelWidthInTwips;
       
   416 	
       
   417 	/** The height of 1000 pixels in twips.
       
   418 	
       
   419 	This is set in the constructor. If the appropriate HALData attributes are 
       
   420 	set (EDisplayYPixels and EDisplayYTwips) then the value is calculated using 
       
   421 	these; otherwise the value is set to 11860. */
       
   422 	TInt iKPixelHeightInTwips;
       
   423 
       
   424 private:
       
   425 	// Binary Compatibility warning - data member iDefaultBitmapType is referenced by inline methods
       
   426 	RFs iFs;
       
   427 	RHeap* iHeap;
       
   428 	CArrayPtrFlat<CFontStoreFile> iFontStoreFileList;
       
   429 	CArrayPtrFlat<TTypeface> iTypefaceList;
       
   430 	CArrayPtrFlat<CFontBitmap> iFontBitmapList;
       
   431 	CArrayFixFlat<TTypefaceFontBitmap> iTypefaceFontBitmapList;
       
   432 	CArrayPtrFlat<COpenFontFile> iOpenFontFileList;
       
   433 	TInt iReserved[2];		// keep iDefaultBitmapType at the correct offset
       
   434     CFontTableCache *iFontTableCache;
       
   435     CUnhintedOutlineCache *iUnhintedOutlineCache;
       
   436     CHintedOutlineCache *iHintedOutlineCache;
       
   437     TFontTableGlyphOutlineCacheMemMonitor *iCacheMemMon;
       
   438 	CArrayPtrFlat<COpenFontRasterizer> iOpenFontRasterizerList;
       
   439 	COpenFontSessionCacheList* iOpenFontSessionCacheList;
       
   440 	TInt iOpenFontUid;
       
   441 	TGlyphBitmapType iDefaultBitmapType;
       
   442 	CArrayPtrFlat<CShaperFactory> iShaperFactoryList;
       
   443 	TInt iOpenFontShaperCacheMemUsage;
       
   444 	TInt iNumberOfShaperCaches;
       
   445 	RPointerArray<CTypefaceSupportInfo> iOpenFontTypefaceSupportList;
       
   446 	RArray<RHandleBase> *iHandleArray;
       
   447 	TAny* iUnused2;
       
   448 	TUint32 iUniqueFontIdCount;
       
   449 	};
       
   450 
       
   451 // inline functions start here
       
   452 
       
   453 /** Returns whether the bitmap font object is an open font (a COpenFont) rather 
       
   454 than a bitmap font (a CFontBitmap).
       
   455 
       
   456 @return ETrue if the bitmap font object is using an open font (a COpenFont);
       
   457 EFalse if it is using a bitmap font (a CFontBitmap).
       
   458 @see OpenFont()
       
   459 */
       
   460 inline TBool CBitmapFont::IsOpenFont() const
       
   461 	{
       
   462 #ifdef FNTSTORE_SUPPORT_FMM
       
   463 	return iOpenFontOffset!=0;
       
   464 #else
       
   465 	return iOpenFont != NULL;
       
   466 #endif // FNTSTORE_SUPPORT_FMM
       
   467 	}
       
   468 
       
   469 #ifdef FNTSTORE_SUPPORT_FMM
       
   470 /** Returns a pointer to the open font being used by the bitmap font object.
       
   471 
       
   472 @return A pointer to an open font.
       
   473 @see IsOpenFont()
       
   474 */
       
   475 inline COpenFont* CBitmapFont::OpenFont() const
       
   476 	{ 
       
   477 	if (IsOpenFont())
       
   478 		{
       
   479 		return reinterpret_cast<COpenFont*>(reinterpret_cast<TInt>(this)+iOpenFontOffset);
       
   480 		}
       
   481 	return NULL;
       
   482 	}
       
   483 #else
       
   484 /** Returns a pointer to the open font being used by the bitmap font object.
       
   485 
       
   486 @return A pointer to an open font.
       
   487 @see IsOpenFont()
       
   488 */
       
   489 inline COpenFont* CBitmapFont::OpenFont() const
       
   490 	{ 
       
   491 	return iOpenFont;
       
   492 	}
       
   493 #endif // FNTSTORE_SUPPORT_FMM
       
   494 
       
   495 /** Gets the anti-aliasing setting for the font, see TGlyphBitmapType for 
       
   496 the range of values.
       
   497 
       
   498 This is only applicable to open fonts (COpenFonts) not bitmap fonts (CBitmapFonts).
       
   499 
       
   500 Note that this setting is stored in the device-independent font specification 
       
   501 which is set when the bitmap font object is constructed.
       
   502 
       
   503 @return The anti-aliasing setting for the font.
       
   504 @see IsOpenFont()
       
   505 @see TGlyphBitmapType
       
   506 @see COpenFont
       
   507 @see CBitmapFont
       
   508 */
       
   509 inline TGlyphBitmapType CBitmapFont::GlyphBitmapType() const
       
   510 	{
       
   511 	return iFontSpecInTwips.iFontStyle.BitmapType();
       
   512 	}
       
   513 
       
   514 /** Returns a default bitmap type.
       
   515 
       
   516 @return A default bitmap type.
       
   517 @see TGlyphBitmapType
       
   518 */
       
   519 inline TGlyphBitmapType CFontStore::DefaultBitmapType() const
       
   520 	{
       
   521 	return iDefaultBitmapType;
       
   522 	}
       
   523 
       
   524 /** Sets a default bitmap type.
       
   525 
       
   526 @param aType A default bitmap type.
       
   527 @see TGlyphBitmapType
       
   528 */
       
   529 inline void CFontStore::SetDefaultBitmapType(TGlyphBitmapType aType)
       
   530 	{
       
   531 	iDefaultBitmapType = aType;
       
   532 	}
       
   533 
       
   534 #endif
       
   535