epoc32/include/fntstore.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 /*
     2 // All rights reserved.
     2 * Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 // This component and the accompanying materials are made available
     3 * All rights reserved.
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 * This component and the accompanying materials are made available
     5 // which accompanies this distribution, and is available
     5 * under the terms of "Eclipse Public License v1.0"
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 * which accompanies this distribution, and is available
     7 //
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 // Initial Contributors:
     8 *
     9 // Nokia Corporation - initial contribution.
     9 * Initial Contributors:
    10 //
    10 * Nokia Corporation - initial contribution.
    11 // Contributors:
    11 *
    12 //
    12 * Contributors:
    13 // Description:
    13 *
    14 //
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
    15 
    18 
    16 #ifndef FNTSTORE_H__
    19 #ifndef FNTSTORE_H__
    17 #define FNTSTORE_H__
    20 #define FNTSTORE_H__
    18 
    21 
    19 #include <e32std.h>
    22 #include <e32std.h>
    20 #include <f32file.h>
    23 #include <f32file.h>
    21 #include <gdi.h>
    24 #include <gdi.h>
    22 #include <openfont.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");
    23 
    54 
    24 class CLinkedTypefaceSpecification;
    55 class CLinkedTypefaceSpecification;
    25 class CLinkedFontSpecification;
    56 class TLinkedTypefaceSpecificationArgs;
    26 class TLinkedTypefaceSpecArgs;
       
    27 class CFbClient;
    57 class CFbClient;
    28 class CFontStoreFile;
    58 class CFontStoreFile;
    29 class CFontBitmap;
    59 class CFontBitmap;
    30 class RReadStream;
    60 class RReadStream;
    31 class TTypefaceFontBitmap;
    61 class TTypefaceFontBitmap;
    32 class TShapeHeader;
    62 class TShapeHeader;
    33 class TShapeMessageParameters;
    63 class TShapeMessageParameters;
    34 class CTypefaceSupportInfo;
    64 class CTypefaceSupportInfo;
    35 
    65 class COpenFontRasterizer;
       
    66 class CLinkedTypefaceGroup;
       
    67 IMPORT_C extern const TInt8 KLinkedFontDrive;
       
    68 IMPORT_C extern const TUint32 KFontTable_GlyphOutline_CacheMaxMem;
    36 
    69 
    37 /**
    70 /**
    38 @internalTechnology
    71 WARNING: Class for internal use ONLY.  Compatibility is not guaranteed in future releases.
    39 */
    72 @publishedAll
       
    73 @released
       
    74  */
    40 class TCharacterMetrics
    75 class TCharacterMetrics
    41 	{
    76 	{
    42 	public:
    77 public:
    43 	IMPORT_C TCharacterMetrics();
    78 	IMPORT_C TCharacterMetrics();
    44 
    79 
       
    80 public:
    45 	TInt16 iAscentInPixels;
    81 	TInt16 iAscentInPixels;
    46 	TInt16 iHeightInPixels;
    82 	TInt16 iHeightInPixels;
    47 	TInt16 iLeftAdjustInPixels;
    83 	TInt16 iLeftAdjustInPixels;
    48 	TInt16 iMoveInPixels;
    84 	TInt16 iMoveInPixels;
    49 	TInt16 iRightAdjustInPixels;
    85 	TInt16 iRightAdjustInPixels;
    50 	};
    86 	};
    51 
    87 
    52 class TAlgStyle
       
    53 /** 
    88 /** 
    54 An algorithmic style for how a font is drawn.
    89 An algorithmic style for how a font is drawn.
    55 
    90 
    56 Holds attributes such as whether the font is bold or italic, and the width 
    91 Holds attributes such as whether the font is bold or italic, and the width 
    57 and height factors. This is used as an input parameter for the GetFontById() method
    92 and height factors. This is used as an input parameter for the GetFontById() method
    60 @released
    95 @released
    61 @see CWsScreenDevice::GetFontById()
    96 @see CWsScreenDevice::GetFontById()
    62 @see CFbsTypefaceStore::GetFontById()
    97 @see CFbsTypefaceStore::GetFontById()
    63 @see CFbsDevice::GetFontById()
    98 @see CFbsDevice::GetFontById()
    64 */
    99 */
       
   100 class TAlgStyle
    65 	{
   101 	{
    66 public:
   102 public:
    67 	IMPORT_C TAlgStyle();
   103 	IMPORT_C TAlgStyle();
    68 	IMPORT_C void SetIsBold(TBool aIsBold);
   104 	IMPORT_C void SetIsBold(TBool aIsBold);
    69 	IMPORT_C void SetIsItalic(TBool aIsItalic);
   105 	IMPORT_C void SetIsItalic(TBool aIsItalic);
    93 	TInt8 iWidthFactor;
   129 	TInt8 iWidthFactor;
    94 	/** This member is private and not intended for use. */
   130 	/** This member is private and not intended for use. */
    95 	TInt8 iHeightFactor;
   131 	TInt8 iHeightFactor;
    96 	};
   132 	};
    97 
   133 
    98 class CLinkedFontInformation;
       
    99 
       
   100 /** 
   134 /** 
   101 Bitmap font class.
   135 Bitmap font class.
   102 An object of this class may either access and use a bitmap font (a CFontBitmap)
   136 An object of this class may either access and use a bitmap font (a CFontBitmap)
   103 or an open font (a COpenFont).
   137 or an open font (a COpenFont).
   104 Stored in a CFontStore.
   138 Stored in a CFontStore.
   105 @publishedAll
   139 @publishedAll
   106 @released
   140 @released
   107 */
   141 */
   108 class CBitmapFont : public CFont
   142 class CBitmapFont : public CFont
   109 	{
   143 	{
       
   144 	friend class CFbsFont;
   110 	friend class CFontStore;
   145 	friend class CFontStore;
   111 	friend class CLinkedFontSpecification;
   146 	friend class CFbsBitGc;
   112 	friend class CLinkedFontInformation;
       
   113 public:
   147 public:
   114 	// New functions
   148 	// New functions
   115 	TUid Uid() const;
   149 	TUid Uid() const;
   116 	IMPORT_C TCharacterMetrics CharacterMetrics(TInt aCode,const TUint8*& aBytes) const;
   150 	IMPORT_C TCharacterMetrics CharacterMetrics(TInt aCode,const TUint8*& aBytes) const;
   117 	IMPORT_C TBool GetCharacterData(TInt aSessionHandle, TInt aCode, TOpenFontCharMetrics& aMetrics, const TUint8*& aBitmap) const;
   151 	IMPORT_C TBool GetCharacterData(TInt aSessionHandle, TInt aCode, TOpenFontCharMetrics& aMetrics, const TUint8*& aBitmap) const;
   126 	IMPORT_C void DeleteShape(TInt aSessionHandle,TShapeHeader* aHeader);
   160 	IMPORT_C void DeleteShape(TInt aSessionHandle,TShapeHeader* aHeader);
   127 	IMPORT_C void operator delete(TAny*);
   161 	IMPORT_C void operator delete(TAny*);
   128 	inline TBool IsOpenFont() const;
   162 	inline TBool IsOpenFont() const;
   129 	inline COpenFont* OpenFont() const;
   163 	inline COpenFont* OpenFont() const;
   130 	inline TGlyphBitmapType GlyphBitmapType() const;
   164 	inline TGlyphBitmapType GlyphBitmapType() const;
   131 	IMPORT_C CLinkedFontInformation* LinkedFontInformation() const;
   165 	IMPORT_C TUint32 UniqueFontId();
   132 	IMPORT_C CBitmapFont* NextFontClientSpace() const;
   166 	IMPORT_C TInt GetFontTable(TUint32 aTag, TAny*& aTableContent, 
   133 	IMPORT_C TBool IsLinkedFont()const;
   167 	        TInt& aLength, TInt aSessionHandle);
   134 	IMPORT_C CBitmapFont* FontWithCharacter(TInt aCode, CLinkedFontInformation *&aInfo, TBool aSearchAllFonts, TBool aGetCanonicalDefault) const;
   168     IMPORT_C TInt GetGlyphOutline(TUint aCode,  
   135 	
   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     
   136 private:
   174 private:
   137 	// From CFont
   175 	// From CFont
   138 	IMPORT_C virtual TUid DoTypeUid() const;
   176 	IMPORT_C virtual TUid DoTypeUid() const;
   139 	IMPORT_C virtual TInt DoHeightInPixels() const;
   177 	IMPORT_C virtual TInt DoHeightInPixels() const;
   140 	IMPORT_C virtual TInt DoAscentInPixels() const;
   178 	IMPORT_C virtual TInt DoAscentInPixels() const;
   158 	inline void operator delete(TAny*, TAny*) {}
   196 	inline void operator delete(TAny*, TAny*) {}
   159 	TInt Width(TInt aNum) const;
   197 	TInt Width(TInt aNum) const;
   160 	TInt Height(TInt aNum) const;
   198 	TInt Height(TInt aNum) const;
   161 	CFontBitmap* FontBitmap() const;
   199 	CFontBitmap* FontBitmap() const;
   162 	void InstallOpenFontShaper(COpenFont* aOpenFont, CShaper::TInput& aShaperInput);
   200 	void InstallOpenFontShaper(COpenFont* aOpenFont, CShaper::TInput& aShaperInput);
       
   201 	TInt DoTextWidthInPixels(const TDesC &aText, const TMeasureTextInput* aParam) const;
       
   202 	void SetUniqueFontId(TUint32 aUniqueFontId);
   163 
   203 
   164 private:
   204 private:
   165 	TFontSpec iFontSpecInTwips;
   205 	TFontSpec iFontSpecInTwips;
   166 
   206 
   167 public:
   207 public:
   168 	/** The algorithmic font style. */
   208 	/** The algorithmic font style. */
   169 	TAlgStyle iAlgStyle;	// must not move this member
   209 	TAlgStyle iAlgStyle;	// must not move this member
   170 
   210 
   171 private:
   211 private:
   172 	// Binary Compatibility warning - data member iOpenFont is referenced by inline methods
   212     // Binary Compatibility warning - data member iOpenFont is referenced by inline methods
   173 	RHeap* iHeap;
   213     RHeap* iHeap;
   174 	TInt iFontBitmapOffset;
   214     TInt iFontBitmapOffset;
   175 	COpenFont* iOpenFont;	// if iOpenFont is non-null this is an open font and many functions are forwarded to it
   215     
   176 
   216     // In order to be able to work with the flexible memory model, iOpenFont is
   177 #ifdef SYMBIAN_SUPPORT_LINKED_FONTS	
   217     // actually an offset from the address of this class.
   178 	CLinkedFontInformation *iFontLinkage;
   218     // iOpenFont's type remains unchanged.
   179 #endif	
   219     // As Qt code that uses OpenFont() must be able to run on new and old versions
   180 	};
   220     // of Symbian OS, it must be able to determine whether iOpenFont is a pointer or
   181 	
   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 
   182 class CFontStore : public CTypefaceStore
   295 class CFontStore : public CTypefaceStore
   183 /** 
   296 /** 
   184 A store for fonts.
   297 A store for fonts.
   185 
   298 
   186 Stores and handles both open and fixed-size fonts. Open fonts are made from 
   299 Stores and handles both open and fixed-size fonts. Open fonts are made from 
   191 via a rasterizer.
   304 via a rasterizer.
   192 @publishedAll
   305 @publishedAll
   193 @released
   306 @released
   194 */
   307 */
   195     {
   308     {
   196 #ifdef SYMBIAN_SUPPORT_LINKED_FONTS    
       
   197 friend class CLinkedFonts;
   309 friend class CLinkedFonts;
   198 friend class CLinkedFontSpecification;
       
   199 friend class CLinkedTypefaceSpecification; 
   310 friend class CLinkedTypefaceSpecification; 
   200 #endif
       
   201 
   311 
   202 public:
   312 public:
   203 	IMPORT_C static CFontStore* NewL(RHeap* aHeap);
   313 	IMPORT_C static CFontStore* NewL(RHeap* aHeap);
   204 	IMPORT_C ~CFontStore();
   314 	IMPORT_C ~CFontStore();
   205 	IMPORT_C TUid AddFileL(const TDesC& aName);
   315 	IMPORT_C TUid AddFileL(const TDesC& aName);
   232 	void SetShaperCacheMemUsage(TInt aUsage);
   342 	void SetShaperCacheMemUsage(TInt aUsage);
   233 	CArrayPtrFlat<COpenFontFile>* GetOpenFontFileList();
   343 	CArrayPtrFlat<COpenFontFile>* GetOpenFontFileList();
   234 	void IncNumShaperCaches();
   344 	void IncNumShaperCaches();
   235 	void DecNumShaperCaches();
   345 	void DecNumShaperCaches();
   236 	TInt GetNumShaperCaches();
   346 	TInt GetNumShaperCaches();
   237 	IMPORT_C TInt CreateLinkedTypeface(const TLinkedTypefaceSpecArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId);
   347 	IMPORT_C TInt CreateLinkedTypeface(const TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId);
   238 	IMPORT_C void RemoveLinkedFont(CBitmapFont *aFont);		
   348 	IMPORT_C void GetLinkedTypefaceL(TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec);
   239 	IMPORT_C TBool IsValidLinkedFontSpecification(TInt aHandle);
       
   240 	IMPORT_C TBool HaveTypefaceFamilyName(const TDesC& aName);
   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 
   241 private:
   374 private:
   242 	CFontStore(RHeap* aHeap);
   375 	CFontStore(RHeap* aHeap);
   243 	void ConstructL();
   376 	void ConstructL();
   244 	void InternalizeFontStoreFileL(CFontStoreFile* aFontStoreFile, TInt aFontVersion);
   377 	void InternalizeFontStoreFileL(CFontStoreFile* aFontStoreFile, TInt aFontVersion);
   245 	TTypeface* GetNearestTypeface(const TTypeface& aTypeface) const;
   378 	TTypeface* GetNearestTypeface(const TTypeface& aTypeface) const;
   252 	TInt VerticalPixelsToTwips(TInt aPixelHeight) const;
   385 	TInt VerticalPixelsToTwips(TInt aPixelHeight) const;
   253 	TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
   386 	TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
   254 	void GetNearestBitmapFontInPixelsL(CFont*& aFont, TFontSpec& aFontSpec, TInt aMaxHeight);
   387 	void GetNearestBitmapFontInPixelsL(CFont*& aFont, TFontSpec& aFontSpec, TInt aMaxHeight);
   255 	void GetNearestOpenFontInPixelsL(
   388 	void GetNearestOpenFontInPixelsL(
   256 	CFont*& aFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
   389 	CFont*& aFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
   257 #ifdef SYMBIAN_SUPPORT_LINKED_FONTS	
       
   258 	TInt GetNearestRealFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
   390 	TInt GetNearestRealFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
   259 	TInt GetNearestFontInPixelsL(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
   391 	TInt GetNearestFontInPixelsL(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
   260 	TInt CreateLinkedTypefaceL(const TLinkedTypefaceSpecArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId);
   392 	TInt CreateLinkedTypefaceL(const TLinkedTypefaceSpecificationArgs &aLinkedTypefaceSpec, TInt aSession, TInt& aId);
   261 	TInt GetCanonicalIndex(TInt aTypefaceIndex) const;
   393 	TInt GetCanonicalIndex(TInt aTypefaceIndex) const;
   262 	void TypefaceSupportLinked(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
   394 	void TypefaceSupportLinked(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
   263 #endif	
       
   264 	TInt GetNearestFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
   395 	TInt GetNearestFontInPixels(CFont*& aFont, const TOpenFontSpec& aFontSpec, TInt aMaxHeight);
   265 	void SanityCheckForTtfL(RFile& aFile, TUint aFontFileSize, TBool aStrictChecking);
   396 	void SanityCheckForTtfL(RFile& aFile, TUint aFontFileSize, TBool aStrictChecking);
   266 	void SanityCheckFontFileL(TParse& aParse);
   397 	void SanityCheckFontFileL(TParse& aParse);
   267 	TInt GetNearestOpenFontInPixelsByFontName(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
   398 	TInt GetNearestOpenFontInPixelsByFontName(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
   268 	TInt GetNearestOpenFontInPixelsBySimilarity(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
   399 	TInt GetNearestOpenFontInPixelsBySimilarity(COpenFont*& aNearestOpenFont, TOpenFontSpec& aActualFontSpec, const TOpenFontSpec& aDesiredFontSpec, TInt aMaxHeight);
   269 	TInt AddTypefacesToSupportList(COpenFontFile* aOpenFontFile);
   400 	TInt AddTypefacesToSupportList(COpenFontFile* aOpenFontFile);
   270 	void RemoveTypefacesFromSupportList(COpenFontFile* aOpenFontFile);
   401 	void RemoveTypefacesFromSupportList(COpenFontFile* aOpenFontFile);
   271 	TInt FindBitmapFontFileIndexByUid(TUid aUid);
   402 	TInt FindBitmapFontFileIndexByUid(TUid aUid);
   272 	TBool IncRefCountOfLoadedFont(const TDesC& aFullName, TUid& aFontUid);
   403 	TBool IncRefCountOfLoadedFont(const TParse& aFileName, TUid& aFontUid);
   273 	TBool LoadFileAsOpenFontL(const TDesC& aFullName, TUid& aFontUid);
   404 	TBool LoadFileAsOpenFontL(const TParse& aFileName, TUid& aFontUid);
   274 	TUid LoadFileAsBitmapFontL(TParse& aParse);
   405 	TUid LoadFileAsBitmapFontL(const TParse& aParse);
   275 	static void CleanupRemoveFontFile(TAny* aCleanupInfo);
   406 	static void CleanupRemoveFontFile(TAny* aCleanupInfo);
   276 
   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);
   277 public:
   412 public:
   278 	/** The width of 1000 pixels in twips.
   413 	/** The width of 1000 pixels in twips.
   279 	
   414 	
   280 	This is set in the constructor. If the appropriate HALData attributes are 
   415 	This is set in the constructor. If the appropriate HALData attributes are 
   281 	set (EDisplayXPixels and EDisplayXTwips) then the value is calculated using 
   416 	set (EDisplayXPixels and EDisplayXTwips) then the value is calculated using 
   296 	CArrayPtrFlat<CFontStoreFile> iFontStoreFileList;
   431 	CArrayPtrFlat<CFontStoreFile> iFontStoreFileList;
   297 	CArrayPtrFlat<TTypeface> iTypefaceList;
   432 	CArrayPtrFlat<TTypeface> iTypefaceList;
   298 	CArrayPtrFlat<CFontBitmap> iFontBitmapList;
   433 	CArrayPtrFlat<CFontBitmap> iFontBitmapList;
   299 	CArrayFixFlat<TTypefaceFontBitmap> iTypefaceFontBitmapList;
   434 	CArrayFixFlat<TTypefaceFontBitmap> iTypefaceFontBitmapList;
   300 	CArrayPtrFlat<COpenFontFile> iOpenFontFileList;
   435 	CArrayPtrFlat<COpenFontFile> iOpenFontFileList;
   301 	TInt iReserved[6];		// keep iDefaultBitmapType at the correct offset
   436 	TInt iReserved[2];		// keep iDefaultBitmapType at the correct offset
       
   437     CFontTableCache *iFontTableCache;
       
   438     CUnhintedOutlineCache *iUnhintedOutlineCache;
       
   439     CHintedOutlineCache *iHintedOutlineCache;
       
   440     TFontTableGlyphOutlineCacheMemMonitor *iCacheMemMon;
   302 	CArrayPtrFlat<COpenFontRasterizer> iOpenFontRasterizerList;
   441 	CArrayPtrFlat<COpenFontRasterizer> iOpenFontRasterizerList;
   303 	COpenFontSessionCacheList* iOpenFontSessionCacheList;
   442 	COpenFontSessionCacheList* iOpenFontSessionCacheList;
   304 	TInt iOpenFontUid;
   443 	TInt iOpenFontUid;
   305 	TGlyphBitmapType iDefaultBitmapType;
   444 	TGlyphBitmapType iDefaultBitmapType;
   306 	CArrayPtrFlat<CShaperFactory> iShaperFactoryList;
   445 	CArrayPtrFlat<CShaperFactory> iShaperFactoryList;
   307 	TInt iOpenFontShaperCacheMemUsage;
   446 	TInt iOpenFontShaperCacheMemUsage;
   308 	TInt iNumberOfShaperCaches;
   447 	TInt iNumberOfShaperCaches;
   309 	RPointerArray<CTypefaceSupportInfo> iOpenFontTypefaceSupportList;
   448 	RPointerArray<CTypefaceSupportInfo> iOpenFontTypefaceSupportList;
   310 #ifdef SYMBIAN_SUPPORT_LINKED_FONTS	
   449 	RArray<RHandleBase> *iHandleArray;
   311 	RPointerArray<CLinkedTypefaceSpecification> *iLinkedTypefaceSpecificationList;
   450 	TAny* iUnused2;
   312 	RPointerArray<CLinkedFontSpecification> *iLinkedFontSpecificationList;
   451 	TUint32 iUniqueFontIdCount;
   313 #endif	
       
   314 	};
   452 	};
   315 
   453 
   316 // inline functions start here
   454 // inline functions start here
   317 
   455 
   318 /** Returns whether the bitmap font object is an open font (a COpenFont) rather 
   456 /** Returns whether the bitmap font object is an open font (a COpenFont) rather 
   325 inline TBool CBitmapFont::IsOpenFont() const
   463 inline TBool CBitmapFont::IsOpenFont() const
   326 	{
   464 	{
   327 	return iOpenFont != NULL;
   465 	return iOpenFont != NULL;
   328 	}
   466 	}
   329 
   467 
       
   468 
   330 /** Returns a pointer to the open font being used by the bitmap font object.
   469 /** Returns a pointer to the open font being used by the bitmap font object.
   331 
   470 
   332 @return A pointer to an open font.
   471 @return A pointer to an open font.
   333 @see IsOpenFont()
   472 @see IsOpenFont()
   334 */
   473 */
   335 inline COpenFont* CBitmapFont::OpenFont() const
   474 inline COpenFont* CBitmapFont::OpenFont() const
   336 	{ 
   475 	{ 
   337 	return iOpenFont;
   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         }
   338 	}
   484 	}
   339 
   485 
   340 /** Gets the anti-aliasing setting for the font, see TGlyphBitmapType for 
   486 /** Gets the anti-aliasing setting for the font, see TGlyphBitmapType for 
   341 the range of values.
   487 the range of values.
   342 
   488 
   375 	{
   521 	{
   376 	iDefaultBitmapType = aType;
   522 	iDefaultBitmapType = aType;
   377 	}
   523 	}
   378 
   524 
   379 #endif
   525 #endif
       
   526