epoc32/include/openfont.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/openfont.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/openfont.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,2589 @@
     1.4 -openfont.h
     1.5 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +// A header for the open font system, which allows
    1.19 +// EPOC32 to use fonts of arbitrary types, including TrueType
    1.20 +// and other outline font formats.
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +#ifndef OPENFONT_H__
    1.25 +#define OPENFONT_H__
    1.26 +
    1.27 +#include <e32base.h>
    1.28 +#include <gdi.h>
    1.29 +#include <ecom/ecom.h>
    1.30 +
    1.31 +
    1.32 +class CFont;
    1.33 +class COpenFontFile;
    1.34 +class COpenFontGlyph;
    1.35 +class COpenFontGlyphCache;
    1.36 +class COpenFontGlyphTreeEntry;
    1.37 +class COpenFontPositioner;
    1.38 +class COpenFontSessionCache;
    1.39 +class COpenFontSessionCacheList;
    1.40 +class RFs;
    1.41 +class TCharacterMetrics;
    1.42 +class TFontSpec;
    1.43 +class TOpenFontFaceAttrib;
    1.44 +class CFontStore;
    1.45 +class TOpenFontFileData;
    1.46 +class TShapeHeader;
    1.47 +class CBitmapFont;
    1.48 +class CShaperFactory;
    1.49 +class CShaper;
    1.50 +class TShapeHeader;
    1.51 +class TFontShapeFunctionParameters;
    1.52 +class TFontShapeDeleteFunctionParameters;
    1.53 +class RShapeInfo;
    1.54 +class TShapeMessageParameters;
    1.55 +/**
    1.56 +The OpenFont ECOM Plug-in Interface Definition UID. 
    1.57 +
    1.58 +@internalTechnology
    1.59 +*/
    1.60 +const TInt KUidOpenFontRasterizerPlunginInterface = 0x101F7F5D;
    1.61 +
    1.62 +/**
    1.63 +
    1.64 +The Shaper Factory ECOM Plug-in Interface Definition UID. 
    1.65 +
    1.66 +@internalTechnology
    1.67 +*/
    1.68 +const TInt KUidShaperFactoryPlunginInterface = 0x10279726;
    1.69 +
    1.70 +
    1.71 +/** 
    1.72 +Replacement character code. 
    1.73 +
    1.74 +This is a Unicode private use area codepoint, which is reserved in the Symbian 
    1.75 +OS to represent characters for which a glyph does not exist in a font (either 
    1.76 +a bitmap or scalable font). If a glyph exists in a font with this character 
    1.77 +code, it will be used for nonexistent characters, otherwise, the rasterizer's 
    1.78 +default replacement character glyph will be used. For example, TrueType fonts 
    1.79 +return glyph index 0 for nonexistent characters, and that is usually mapped 
    1.80 +to an empty rectangle.
    1.81 +@internalTechnology
    1.82 +*/
    1.83 +const TUint KReplacementCharacter = 0xF6DB;
    1.84 +
    1.85 +/** 
    1.86 +KFillCharacterOffset is a significant offset that is set when a character within a code section is 
    1.87 +not in the font. This means that for these fill characters nothing is stored within the binary
    1.88 +data part of the code section.
    1.89 +@internalTechnology
    1.90 +*/
    1.91 +const TInt KFillCharacterOffset = 0x7FFF;
    1.92 +
    1.93 +/**
    1.94 +Supplied to COpenFont::ExtendedInterface() to access the extended
    1.95 +API interface MOpenFontShapingExtension.
    1.96 +
    1.97 +@see COpenFont::ExtendedInterface()
    1.98 +@see MOpenFontShapingExtension
    1.99 +@publishedAll
   1.100 +@released
   1.101 +*/
   1.102 +const TUid KUidOpenFontShapingExtension = {0x10274DB9};
   1.103 +
   1.104 +/**
   1.105 +Supplied to COpenFont::ExtendedInterface() to access the extended
   1.106 +API interface MOpenFontTrueTypeExtension.
   1.107 +
   1.108 +@see COpenFont::ExtendedInterface()
   1.109 +@see MOpenFontTrueTypeExtension
   1.110 +@publishedAll
   1.111 +@released
   1.112 +*/
   1.113 +const TUid KUidOpenFontTrueTypeExtension = {0x1027553E};
   1.114 +
   1.115 +/**
   1.116 +Supplied to CShaper::ExtendedInterface() to get the language and script
   1.117 +code with which the current shaper is instatsiated.
   1.118 +@see CShaper::ExtendedInterface()
   1.119 +@publishedAll
   1.120 +@released
   1.121 +*/
   1.122 +const TUid KUidShaperGetScript = {0x20009966};
   1.123 +const TUid KUidShaperGetLang = {0x20009967};
   1.124 +
   1.125 +/** 
   1.126 +Font metrics.
   1.127 +
   1.128 +@see CFbsFont::GetFontMetrics()
   1.129 +@publishedAll
   1.130 +@released
   1.131 +*/
   1.132 +class TOpenFontMetrics
   1.133 +	{
   1.134 +public:
   1.135 +	inline TOpenFontMetrics();
   1.136 +	IMPORT_C TOpenFontMetrics(const CFont* aFont);
   1.137 +	inline TInt Size() const;
   1.138 +	inline TInt Ascent() const;
   1.139 +	inline TInt Descent() const;
   1.140 +	inline TInt MaxHeight() const;
   1.141 +	inline TInt MaxDepth() const;
   1.142 +	inline TInt MaxWidth() const;
   1.143 +	inline void SetSize(TInt aSize);
   1.144 +	inline void SetAscent(TInt aAscent);
   1.145 +	inline void SetDescent(TInt aDescent);
   1.146 +	inline void SetMaxHeight(TInt aMaxHeight);
   1.147 +	inline void SetMaxDepth(TInt aMaxDepth);
   1.148 +	inline void SetMaxWidth(TInt aMaxWidth);
   1.149 +private:
   1.150 +	TInt16 iDesignHeight;	// size of the font ('pointsize' in pixels)
   1.151 +	TInt16 iAscent;			// typographic ascent
   1.152 +	TInt16 iDescent;		// typographic descent
   1.153 +	TInt16 iMaxHeight;		// maximum height of a character; may be greater than iAscent
   1.154 +	TInt16 iMaxDepth;		// maximum depth of a character; may be greater than iDescent
   1.155 +	TInt16 iMaxWidth;		// maximum width of a character
   1.156 +	TInt32 iReserved;
   1.157 +	};
   1.158 +
   1.159 + 
   1.160 +/** 
   1.161 +Character metrics  includes more information than TCharacterMetrics.
   1.162 +
   1.163 +Character metrics allow characters to be placed horizontally or vertically. 
   1.164 +The character metrics encapsulated by this class are: Height, Width, Horizontal 
   1.165 +Bearing X, Horizontal Bearing Y, Horizontal Advance, Vertical Bearing X, 
   1.166 +Vertical Bearing Y, and Vertical Advance. Their meanings are described in the 
   1.167 +associated setter and getter functions.
   1.168 +
   1.169 +Note : 
   1.170 +
   1.171 +Vertical drawing (in the sense of characters drawn with horizontal baselines, 
   1.172 +but in a vertical line) is not yet supported by Symbian OS.
   1.173 +
   1.174 +@see CFont::GetCharacterData()
   1.175 +@see CFbsFont::GetCharacterData() 
   1.176 +@publishedAll
   1.177 +@released
   1.178 +*/
   1.179 +class TOpenFontCharMetrics
   1.180 +	{
   1.181 +public:
   1.182 +	enum TUninitialized { EUninitialized };
   1.183 +public:
   1.184 +	/** Default constructor initializes all members to 0. */ 
   1.185 +	inline TOpenFontCharMetrics();
   1.186 +
   1.187 +	/** Constructor that does not initialize any members. */ 
   1.188 +	TOpenFontCharMetrics(TUninitialized) {}
   1.189 +	IMPORT_C TOpenFontCharMetrics(const TCharacterMetrics& aMetrics);
   1.190 +	IMPORT_C TBool GetTCharacterMetrics(TCharacterMetrics& aMetrics) const;
   1.191 +	inline TInt Width() const;
   1.192 +	inline TInt Height() const;
   1.193 +	inline TInt HorizBearingX() const;
   1.194 +	inline TInt HorizBearingY() const;
   1.195 +	inline TInt HorizAdvance() const;
   1.196 +	inline TInt VertBearingX() const;
   1.197 +	inline TInt VertBearingY() const;
   1.198 +	inline TInt VertAdvance() const;
   1.199 +	inline void GetHorizBounds(TRect& aBounds) const;
   1.200 +	inline void GetVertBounds(TRect& aBounds) const;
   1.201 +	inline void SetWidth(TInt aWidth);
   1.202 +	inline void SetHeight(TInt aHeight);
   1.203 +	inline void SetHorizBearingX(TInt aHorizBearingX);
   1.204 +	inline void SetHorizBearingY(TInt aHorizBearingY);
   1.205 +	inline void SetHorizAdvance(TInt aHorizAdvance);
   1.206 +	inline void SetVertBearingX(TInt aVertBearingX);
   1.207 +	inline void SetVertBearingY(TInt aVertBearingY);
   1.208 +	inline void SetVertAdvance(TInt aVertAdvance);
   1.209 +private:
   1.210 +	TInt16 iWidth;			// width of the glyph
   1.211 +	TInt16 iHeight;			// height of the glyph
   1.212 +	TInt16 iHorizBearingX;	// x component of horizontal bearing
   1.213 +	TInt16 iHorizBearingY;	// y component of horizontal bearing
   1.214 +	TInt16 iHorizAdvance;	// horizontal advance
   1.215 +	TInt16 iVertBearingX;	// x component of vertical bearing
   1.216 +	TInt16 iVertBearingY;	// y component of vertical bearing
   1.217 +	TInt16 iVertAdvance;	// vertical advance
   1.218 +	TInt32 iReserved;
   1.219 +	};
   1.220 +
   1.221 + 
   1.222 +/** 
   1.223 +Font glyph data.
   1.224 +
   1.225 +Objects of this type are used by rasterizers to supply glyph data to font 
   1.226 +and bitmap server clients. Unless you are writing a rasterizer you will not 
   1.227 +need to use an object of this type.
   1.228 +
   1.229 +The object cannot be constructed and destroyed by normal means. It resides 
   1.230 +on a specified heap. It is created by New() and deleted by RHeap::Free().
   1.231 +
   1.232 +@see COpenFont::RasterizeL()
   1.233 +@publishedAll
   1.234 +@released
   1.235 +*/
   1.236 +class TOpenFontGlyphData
   1.237 +	{
   1.238 +public:
   1.239 +	IMPORT_C static TOpenFontGlyphData* New(RHeap* aHeap,TInt aBufferSize);
   1.240 +	inline TBool Overflow() const;
   1.241 +	inline TInt BytesNeeded() const;
   1.242 +	inline TPtrC8 Bitmap() const;
   1.243 +	inline const TUint8* BitmapPointer() const;
   1.244 +	inline const TOpenFontCharMetrics* Metrics() const;
   1.245 +	inline TInt GlyphIndex() const;
   1.246 +	inline TUint8* BufferStart();
   1.247 +	inline TUint8* BufferEnd();
   1.248 +	inline void SetBytesNeeded(TInt aBytes);
   1.249 +	inline void SetBitmapPointer(const TUint8* aBitmap);
   1.250 +	inline void SetMetricsPointer(const TOpenFontCharMetrics* aMetrics);
   1.251 +	inline void SetPointersToInternalBuffers();
   1.252 +	inline void SetMetrics(TOpenFontCharMetrics& aMetrics);
   1.253 +	inline void SetGlyphIndex(TInt aGlyphIndex);
   1.254 +private:
   1.255 +	/*
   1.256 +	Prevent construction and destruction by normal means; the object resides 
   1.257 +	on a specified heap and is created by New and deleted by RHeap::Free.
   1.258 +	*/
   1.259 +	TOpenFontGlyphData();
   1.260 +	~TOpenFontGlyphData();
   1.261 +private:
   1.262 +	TInt iBitmapBufferSize;					// size of the buffer in bytes
   1.263 +	TInt iBytesNeeded;						// bytes needed for the bitmap
   1.264 +	TOpenFontCharMetrics iMetricsBuffer;	// the metrics
   1.265 +	const TUint8* iBitmap;					// pointer to the bitmap; points either to iBitmapBuffer or to
   1.266 +											// the cache if the character was already rasterized
   1.267 +	const TOpenFontCharMetrics* iMetrics;	// pointer to the metrics; points either to iMetricsBuffer or to
   1.268 +											// the cache if the character was already rasterized
   1.269 +	TInt iGlyphIndex;						// the glyph index
   1.270 +	TAny* iReserved;						// unused; for future expansion
   1.271 +	TUint8 iBitmapBuffer[1];				// buffer used to write the bitmap when it is first rasterized; this
   1.272 +											// is actually of size iBitmapBufferSize.
   1.273 +	};
   1.274 +
   1.275 +class COpenFontGlyph;
   1.276 +class CLinkedFontInformation;
   1.277 +/** 
   1.278 +Open Font System font abstract base class.
   1.279 +
   1.280 +Derive a class from this class to represent an instance of a typeface at a 
   1.281 +particular size, provide bitmaps of the glyphs, and determine whether 
   1.282 +characters exist in the typeface.
   1.283 +
   1.284 +Writing derived classes construction: 
   1.285 +
   1.286 +You must call the constructor of this class when creating your derived object, 
   1.287 +passing the arguments aHeap and aSessionCacheList supplied to 
   1.288 +COpenFontFile::GetNearestFontInPixelsL(), and the address of the COpenFontFile 
   1.289 +object that creates the object as aFile.
   1.290 +
   1.291 +The derived object must be created on the shared heap aHeap because it is 
   1.292 +shared by several processes: the font and bitmap server and its clients. 
   1.293 +To do this, use aHeap->AllocL() to obtain memory, then construct in place 
   1.294 +using a placement argument to new.
   1.295 +
   1.296 +Derived classes must implement the pure virtual function RasterizeL(). 
   1.297 +Information about this function is provided in the function definition below. 
   1.298 +
   1.299 +Information about deriving from this class is also provided in the API guide.
   1.300 +
   1.301 +@see COpenFontFile::GetNearestFontInPixelsL()
   1.302 +@publishedAll
   1.303 +@released
   1.304 +*/
   1.305 +class COpenFont: public CBase
   1.306 +	{
   1.307 +public:
   1.308 +	/** Creates a bitmap for the specified Unicode character.
   1.309 +	
   1.310 +	Implementations of this function should put the bitmap in 
   1.311 +	aGlyphData->iBitmapBuffer, and the character metrics are placed in 
   1.312 +	aGlyphData->iMetricsBuffer. The other parts of aGlyphData should be left 
   1.313 +	alone. 
   1.314 +	
   1.315 +	There are a number of strategies for achieving this, e.g. pass the 
   1.316 +	rasterization task all the way up to the rasterizer engine. These are 
   1.317 +	discussed in the API guide.
   1.318 +	
   1.319 +	At present you must write the bitmap in the Symbian platform's 
   1.320 +	run-length-encoded format. This is a packed binary format starting on a 
   1.321 +	byte boundary and made up of a number of sections. Each section starts 
   1.322 +	with a five-bit header. If the first bit of the header is 0 the next four 
   1.323 +	bits are a repeat count, starting with the least significant bit, and a 
   1.324 +	single row of bits (the number of bits in a row is specified by 
   1.325 +	aGlyphData->iMetricsBuffer.Width()) follows. If the first bit of the header 
   1.326 +	is 1 the next four bits are a count of non-repeating rows, again starting 
   1.327 +	with the least significant bit, and that many rows of bits follow.
   1.328 +	
   1.329 +	@param aCode The character code of the Unicode character for which the 
   1.330 +	bitmap is required.
   1.331 +	@param aGlyphData On return, contains a pointer to a TOpenFontGlyphData 
   1.332 +	containing the character's bitmap and metrics. */
   1.333 +	virtual void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0;
   1.334 +	IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam);
   1.335 +	IMPORT_C COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,COpenFontFile* aFile);
   1.336 +	IMPORT_C COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,COpenFontFile* aFile,TInt aFaceIndex);
   1.337 +	IMPORT_C ~COpenFont();
   1.338 +	IMPORT_C void operator delete(TAny*);
   1.339 +	inline const TOpenFontMetrics& Metrics() const;
   1.340 +	inline const TOpenFontFaceAttrib* FaceAttrib() const;
   1.341 +	inline COpenFontFile* File() const;
   1.342 +	inline TInt FaceIndex() const;
   1.343 +	inline TBool CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const;
   1.344 +	void SetShaper(CShaper* aShaper);
   1.345 +	CShaper* GetShaper();
   1.346 +	TBool HasShaper() const;
   1.347 +	TShapeHeader* GetShapedData(TInt aSessionHandle,TFontShapeFunctionParameters* aParams);
   1.348 +	TShapeHeader* InsertShapedDataIntoCache(TInt aSessionHandle,TFontShapeFunctionParameters* aParams, TShapeHeader* aShapeHeader);
   1.349 +	TInt FreeShaperCacheMemory(TInt aBytesNeeded);
   1.350 +	TInt DecrementCachedRefCount(TInt aSessionHandle,TShapeHeader* aShapeHeader,TBool aResetAll=EFalse);
   1.351 +	TBool Rasterize(TInt aSessionHandle,TInt aCode,TOpenFontGlyphData* aGlyphData);
   1.352 +	TBool HasCharacterL(TInt aCode) const;
   1.353 +	TBool GetCharacterData(TInt aSessionHandle,TInt aCode,const TOpenFontCharMetrics*& aMetrics,const TUint8*& aBitmap) const;
   1.354 +	void OnFileDeleted();
   1.355 +	COpenFontGlyphCache* GetGlyphCache();
   1.356 +	inline TInt FontCapitalAscent() const;
   1.357 +	inline TInt FontMaxAscent() const;
   1.358 +	inline TInt FontStandardDescent() const;
   1.359 +	inline TInt FontMaxDescent() const;
   1.360 +	inline TInt FontLineGap() const;
   1.361 +	inline TInt FontMaxHeight() const;
   1.362 +	void DeleteShaper() const;
   1.363 +protected:
   1.364 +	RHeap* iHeap;
   1.365 +	TOpenFontMetrics iMetrics;
   1.366 +private:
   1.367 +	/** The shaper for performing complex character positioning and
   1.368 +	substitution, if available. Null otherwise.
   1.369 +	@internalComponent */
   1.370 +	CShaper* iShaper;
   1.371 +														
   1.372 +protected:
   1.373 +	/** The positive distance in pixels from the baseline to
   1.374 +		the top of an ANSI capital (whether or not there are
   1.375 +		ANSI capitals in the font) */
   1.376 +	TInt iFontCapitalAscent;								
   1.377 +	/** The positive distance in pixels from the baseline to
   1.378 +		the top of the highest pre-composed glyph in the font */
   1.379 +	TInt iFontMaxAscent;									
   1.380 +	/** The positive distance in pixels from the baseline to
   1.381 +		the bottom of the lowest ANSI descender (whether or
   1.382 +		not there are ANSI chars in the font)*/
   1.383 +	TInt iFontStandardDescent;								
   1.384 +	/** The positive distance in pixels from the baseline to
   1.385 +		the bottom of the lowest pre-composed glyph in the font */
   1.386 +	TInt iFontMaxDescent;									
   1.387 +	/** The recommended baseline to baseline gap for successive
   1.388 +		lines of text in the font */
   1.389 +	TInt iFontLineGap;										
   1.390 +private:
   1.391 +	const COpenFontGlyph* Glyph(TInt aSessionHandle,TInt aCode) const;
   1.392 +protected:
   1.393 +	/**
   1.394 +	@internalTechnology
   1.395 +	*/
   1.396 +	const COpenFontGlyph* FontCacheGlyph(TInt aCode,COpenFontGlyphTreeEntry**& aNode);
   1.397 +private:	
   1.398 +	const COpenFontGlyph* SessionCacheGlyph(RHeap* aHeap,TInt aSessionHandle,TInt aCode,
   1.399 +											COpenFontSessionCache*& aCache,TInt& aIndex,TBool aCreate) const;
   1.400 +	void RasterizeHelperL(TInt aCode,TOpenFontGlyphData* aGlyphData,TOpenFontGlyphData*& aTempGlyphData);
   1.401 +private:
   1.402 +	COpenFontFile* iFile;									// the file used by this font; null if it has been deleted
   1.403 +															// or cannot be used
   1.404 +	TInt iFaceIndex;										// index of the face in the font file
   1.405 +protected:
   1.406 +	/**
   1.407 +	@internalTechnology
   1.408 +	*/	
   1.409 +	COpenFontGlyphCache* iGlyphCache;						// the per-font glyph cache; owned by the font
   1.410 +private:	
   1.411 +	COpenFontSessionCacheList* iSessionCacheList;			// the list of per-session glyph caches; owned by CFontStore
   1.412 +	TAny* iReserved; // unused; for future expansion
   1.413 +	};
   1.414 +
   1.415 +/** Open Font System Extension Interface abstract base class.
   1.416 +
   1.417 +COpenFont derivers should also derive from this interface to enable complex
   1.418 +font "shaping".
   1.419 +
   1.420 +This interface should be returned by the overridden
   1.421 +COpenFont::ExtendedInterface function when KUidOpenFontShapingExtension is
   1.422 +supplied as the UID.
   1.423 +
   1.424 +@see COpenFont
   1.425 +@see KUidOpenFontShapingExtension 
   1.426 +@publishedAll
   1.427 +@released
   1.428 +*/
   1.429 +class MOpenFontShapingExtension
   1.430 +	{
   1.431 +public:
   1.432 +	/** Various font metrics. */
   1.433 +	class TExtensionFontMetrics
   1.434 +		{
   1.435 +	public:
   1.436 +		/** The number of font design units per em. */
   1.437 +		TInt iUnitsPerEm;
   1.438 +		/** The width of the font's em square in pixels. */
   1.439 +		TReal iXPixelsPerEm;
   1.440 +		/** The height of the font's em square in pixels. */
   1.441 +		TReal iYPixelsPerEm;
   1.442 +		/** The horizontal scaling factor from the font's transform;
   1.443 +		the number of horizontal pixels per font unit. */
   1.444 +		TReal iXScaleFactor;
   1.445 +		/** The vertical scaling factor from the font's transform;
   1.446 +		the number of vertical pixels per font unit. */
   1.447 +		TReal iYScaleFactor;
   1.448 +	private:
   1.449 +		/** Reserved for future expansion. */
   1.450 +		TInt iReserved[4];
   1.451 +		};
   1.452 +
   1.453 +	/** Creates a bitmap for the specified Glyph code.
   1.454 +
   1.455 +	Implementations of this function should put the bitmap in
   1.456 +	aGlyphData->iBitmapBuffer, and the character metrics are placed in
   1.457 +	aGlyphData->iMetricsBuffer. The other parts of aGlyphData should be left
   1.458 +	alone.
   1.459 +
   1.460 +	This function provides the same functionality as the
   1.461 +	COpenFont::RasterizeL() except that the glyph code is supplied rather than
   1.462 +	the unicode.
   1.463 +
   1.464 +	For more information:
   1.465 +	@see COpenFont::RasterizeL()
   1.466 +
   1.467 +	@param aCode
   1.468 +		The glyph code of the character for which the bitmap is required.
   1.469 +	@param aGlyphData
   1.470 +		The function puts its output here.
   1.471 +	*/
   1.472 +	virtual void RasterizeGlyphL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0;
   1.473 +
   1.474 +	/** Maps a character to a glyph index.
   1.475 +	@param aUnicodeCharacter Unicode character code to be mapped.
   1.476 +	@return Glyph code corresponding to aUnicodeCharacter. */
   1.477 +	virtual TInt GlyphIndex(TInt aUnicodeCharacter) const = 0;
   1.478 +
   1.479 +	/** Returns the hinted pixel coordinates of a particular point in the
   1.480 +	outline of the given glyph.
   1.481 +	@param aGlyphPoint The glyph index.
   1.482 +	@param aPointNumber The number of the point.
   1.483 +	@param aX Returns the point's X pixel value.
   1.484 +	@param aY Returns the point's Y pixel value.
   1.485 +	@return True on success, false otherwise. */
   1.486 +	virtual TBool GlyphPointInHintedPixels(TInt aGlyphIndex, TInt aPointNumber,
   1.487 +		TReal& aX, TReal& aY) const = 0;
   1.488 +
   1.489 +	/** Returns the coordinates of a particular (unhinted) point in the outline
   1.490 +	of the given glyph in font units.
   1.491 +	@param aGlyphPoint The glyph index.
   1.492 +	@param aPointNumber The number of the point.
   1.493 +	@param aX Returns the point's X co-ordinate in font units.
   1.494 +	@param aY Returns the point's Y co-ordinate in font units.
   1.495 +	@return True on success, false otherwise. */
   1.496 +	virtual TBool GlyphPointInFontUnits(TInt aGlyphIndex, TInt aPointNumber,
   1.497 +		TInt& aX, TInt& aY) const = 0;
   1.498 +
   1.499 +	/** Returns font metrics.
   1.500 +	@param aOut Font metrics returned. */
   1.501 +	virtual void GetExtensionFontMetrics(TExtensionFontMetrics& aOut) = 0;
   1.502 +	};
   1.503 +
   1.504 +/** TrueType extension for Open Fonts.
   1.505 +
   1.506 +If an open font is able to load TrueType or OpenType tables it should derive
   1.507 +from this class.
   1.508 +
   1.509 +This class will be used by 
   1.510 +
   1.511 +This interface should be returned by the overridden
   1.512 +COpenFont::ExtendedInterface function when KUidOpenFontTrueTypeExtension is
   1.513 +supplied as the UID.
   1.514 +@see KUidOpenFontTrueTypeExtension
   1.515 +@publishedAll
   1.516 +@released
   1.517 +*/
   1.518 +class MOpenFontTrueTypeExtension
   1.519 +	{
   1.520 +public:
   1.521 +	/** Returns the specified table. The table need not be released by the
   1.522 +	caller, so the deriver is responsible for ensuring that any memory
   1.523 +	allocated is ultimately cleaned up. The caller must not delete or modify
   1.524 +	the data returned.
   1.525 +	@param aError
   1.526 +		Returns KErrNone if successful or one of the system-wide error codes if
   1.527 +		unsuccessful. Returns KErrNotSupported if the table does not exist in
   1.528 +		the font file.
   1.529 +	@param aTag
   1.530 +		The tag of the table, with the first character in the most significant
   1.531 +		byte. For example, the "vhea" table is obtained by passing in 'v'<<24 |
   1.532 +		'h'<<16 | 'e'<<8 | 'a'.
   1.533 +	@param aLength
   1.534 +		The length of the table in bytes that has been returned or 0 if
   1.535 +		unsuccessful.
   1.536 +	@return The table, if successful.
   1.537 +	@see ReleaseTrueTypeTable */
   1.538 +	virtual TAny* GetTrueTypeTable(TInt& aError, TUint32 aTag, TInt* aLength) = 0;
   1.539 +	/** Releases a table obtained by GetTrueTypeTable. The caller must not
   1.540 +	use the table after this call.
   1.541 +	@param aTable The table to be released.
   1.542 +	@see GetTrueTypeTable */
   1.543 +	virtual TInt ReleaseTrueTypeTable(TAny* aTable) = 0;
   1.544 +	/** Determines if the font file has a particular table.
   1.545 +	@param aTag The tag of the table as for GetTrueTypeTable.
   1.546 +	@return True if the table exists in the font file, false otherwise.
   1.547 +	@see GetTrueTypeTable */
   1.548 +	virtual TBool HasTrueTypeTable(TUint32 aTag) = 0;
   1.549 +	};
   1.550 + 
   1.551 +/** 
   1.552 +Font attribute base class. 
   1.553 +
   1.554 +This class is not intended for user derivation.
   1.555 +
   1.556 +@see TOpenFontFaceAttrib
   1.557 +@see TOpenFontSpec
   1.558 +@publishedAll
   1.559 +@released
   1.560 +*/
   1.561 +class TOpenFontFaceAttribBase
   1.562 +	{
   1.563 +public:
   1.564 +	inline TOpenFontFaceAttribBase();
   1.565 +	inline TBool HasLatin() const;
   1.566 +	inline TBool HasGreek() const;
   1.567 +	inline TBool HasCyrillic() const;
   1.568 +	inline TBool HasKana() const;
   1.569 +	inline TBool HasHangul() const;
   1.570 +	inline TBool HasCJK() const;
   1.571 +	inline TBool IsSymbol() const;
   1.572 +	inline TBool IsBold() const;
   1.573 +	inline TBool IsItalic() const;
   1.574 +	inline TBool IsSerif() const;
   1.575 +	inline TBool IsMonoWidth() const;
   1.576 +	inline TPtrC Name() const;
   1.577 +	inline const TUint* Coverage() const;
   1.578 +	inline void SetName(const TDesC& aName);
   1.579 +	inline void SetCoverage(TUint aCoverage0,TUint aCoverage1 = 0,TUint aCoverage2 = 0,TUint aCoverage3 = 0);
   1.580 +	inline void SetBold(TBool aBold);
   1.581 +	inline void SetItalic(TBool aItalic);
   1.582 +	inline void SetSerif(TBool aSerif);
   1.583 +	inline void SetMonoWidth(TBool aMonoWidth);
   1.584 +	inline TBool operator==(const TOpenFontFaceAttribBase& aAttrib) const;
   1.585 +
   1.586 +	// Unicode ranges for iCoverage[0] (incomplete; see the TrueType documentation for other values)
   1.587 +	enum
   1.588 +		{
   1.589 +		ELatinSet = 0x1,			// 0000-007F
   1.590 +		EGreekSet = 0x80,			// 0370-03FF
   1.591 +		ECyrillicSet = 0x200,		// 0400-04FF
   1.592 +		EArmenianSet = 0x400,		// 0530-058F
   1.593 +		EHebrewSet = 0x800,			// 0590-05FF
   1.594 +		EArabicSet = 0x2000,		// 0600-06FF
   1.595 +		EDevanagariSet = 0x8000,	// 0900-097F
   1.596 +		EBengaliSet = 0x10000,		// 0980-09FF
   1.597 +		EGurmukhiSet = 0x20000,		// 0A00-0A7F
   1.598 +		EGujuratiSet = 0x40000,		// 0A80-0AFF
   1.599 +		EOriyaSet = 0x80000,		// 0B00-0B7F
   1.600 +		ETamilSet = 0x100000,		// 0B80-0BFF
   1.601 +		ETeluguSet = 0x200000,		// 0C00-0C7F
   1.602 +		EKannadaSet = 0x400000,		// 0C80-0CFF
   1.603 +		EMalayalamSet = 0x800000,	// 0D00-0D7F
   1.604 +		EThaiSet = 0x1000000,		// 0E00-0E7F
   1.605 +		ELaoSet = 0x2000000,		// 0E80-0EFF
   1.606 +		EGeorgianSet = 0x8000000,	// 10A0-10FF
   1.607 +		EHangulJamoSet = 0x10000000,// 1100-11FF
   1.608 +		};
   1.609 +
   1.610 +	// Unicode ranges for iCoverage[1]
   1.611 +	enum
   1.612 +		{
   1.613 +		ESymbolSets = 0xFFFE,
   1.614 +		EKanaSets = 0x60000,
   1.615 +		EHangulSet = 0x100000,
   1.616 +		ECJKSet = 0x8000000
   1.617 +		};
   1.618 +
   1.619 +	// Attribute flags
   1.620 +	enum
   1.621 +		{
   1.622 +		EBold = 0x1,			// weight > 500 in Windows terms
   1.623 +		EItalic = 0x2,			// italic or oblique - any forward slant counts
   1.624 +		ESerif = 0x4,			// characters have serifs
   1.625 +		EMonoWidth = 0x8		// all characters are the same width
   1.626 +		};
   1.627 +
   1.628 +	// Other constants
   1.629 +	enum
   1.630 +		{
   1.631 +		ENameLength = 32		// we allow 32 but names that are compatible with old-style fonts are limited to 24
   1.632 +		};
   1.633 +protected:
   1.634 +	TBufC<ENameLength> iName;				// the name of the typeface; whether this is the full name or family name
   1.635 +											// or is in English or another language depends on the context
   1.636 +	TUint iCoverage[4];						// bitmap of the character sets supported by the typeface;
   1.637 +											// these are the same as the fields ulUnicodeRange1 .. ulUnicodeRange4
   1.638 +											// in the OS/2 table in TrueType fonts
   1.639 +	TInt iStyle;							// bold, italic serif, and mono-width
   1.640 +	TInt32 iReserved;
   1.641 +	};
   1.642 +
   1.643 + 
   1.644 +/** 
   1.645 +Typeface attributes.
   1.646 +
   1.647 +These attributes include the name, family name, and supported scripts.
   1.648 +
   1.649 +@see CFbsFont::GetFaceAttrib()
   1.650 +@publishedAll
   1.651 +@released
   1.652 +*/
   1.653 +class TOpenFontFaceAttrib: public TOpenFontFaceAttribBase
   1.654 +	{
   1.655 +public:
   1.656 +	inline TOpenFontFaceAttrib();
   1.657 +	inline TBool operator==(const TOpenFontFaceAttrib& aAttrib) const;
   1.658 +	inline TPtrC FullName() const;
   1.659 +	inline TPtrC FamilyName() const;
   1.660 +	inline TPtrC LocalFullName() const;
   1.661 +	inline TPtrC LocalFamilyName() const;
   1.662 +	inline TPtrC ShortFullName() const;
   1.663 +	inline TPtrC ShortFamilyName() const;
   1.664 +	inline TPtrC ShortLocalFullName() const;
   1.665 +	inline TPtrC ShortLocalFamilyName() const;
   1.666 +	inline void SetFullName(const TDesC& aName);
   1.667 +	inline void SetFamilyName(const TDesC& aName);
   1.668 +	inline void SetLocalFullName(const TDesC& aName);
   1.669 +	inline void SetLocalFamilyName(const TDesC& aName);
   1.670 +	inline TInt MinSizeInPixels() const;
   1.671 +	inline void SetMinSizeInPixels(TInt aSize);
   1.672 +private:
   1.673 +	TBufC<ENameLength> iFamilyName;			// the name without any style suffixes; usually a truncation of iFullName
   1.674 +	TBufC<ENameLength> iLocalFullName;		// the full name in the language of the current locale
   1.675 +	TBufC<ENameLength> iLocalFamilyName;	// the family name in the language of the current locale
   1.676 +	TInt iMinSizeInPixels;					// minimum supported size, (or readable size if scalable) in pixels
   1.677 +	TInt32 iReserved2;
   1.678 +	};
   1.679 +
   1.680 + 
   1.681 +/** 
   1.682 +Font specification allowing more attributes to be specified than TFontSpec.
   1.683 +
   1.684 +In addition to the attributes specified by TFontSpec, this font specification 
   1.685 +allows stretching and slanting in the x dimension, and other algorithmic effects. 
   1.686 +This is used to correct for non-square pixels, and to allow algorithmic slanting 
   1.687 +and bold. The width factor and slant factor transform any point (x,y) to (x 
   1.688 +* iWidthFactor + y * iSlantFactor,y). The width and slant factors are 16.16 
   1.689 +fixed-point numbers.
   1.690 +
   1.691 +The font specification also provides access to information about the scripts 
   1.692 +which are supported by the font. This information is not always reliable, 
   1.693 +because it may be incorrectly specified, or not specified at all, by some 
   1.694 +font manufacturers. 
   1.695 +@publishedAll
   1.696 +@released
   1.697 +*/
   1.698 +class TOpenFontSpec : public TOpenFontFaceAttribBase
   1.699 +	{
   1.700 +public:
   1.701 +	IMPORT_C TOpenFontSpec();
   1.702 +	IMPORT_C TOpenFontSpec(const TFontSpec& aFontSpec);
   1.703 +	IMPORT_C void operator=(const TFontSpec& aFontSpec);
   1.704 +	inline TBool operator==(const TOpenFontSpec& aFontSpec) const;
   1.705 +	TBool operator!=(const TOpenFontSpec& aOpenFontSpec) const;
   1.706 +	IMPORT_C void SetAttrib(const TOpenFontFaceAttribBase& aAttrib);
   1.707 +	IMPORT_C void GetTFontSpec(TFontSpec& aFontSpec) const;
   1.708 +	IMPORT_C void CompensateForAspectRatio(TInt aPixelWidth,TInt aPixelHeight);
   1.709 +	IMPORT_C void CompensateForAspectRatio(const MGraphicsDeviceMap& aMap);
   1.710 +	inline TInt Height() const;
   1.711 +	inline TInt32 WidthFactor() const;
   1.712 +	inline TInt32 SlantFactor() const;
   1.713 +	inline TGlyphBitmapType BitmapType() const;
   1.714 +	inline TUint32 Effects() const;
   1.715 +	inline TFontPrintPosition PrintPosition() const;
   1.716 +	inline void SetHeight(TInt aHeight);
   1.717 +	inline void SetWidthFactor(TInt32 aWidthFactor);
   1.718 +	inline void SetSlantFactor(TInt32 aSlantFactor);
   1.719 +	inline void SetBitmapType(TGlyphBitmapType aBitmapType);
   1.720 +	inline void SetEffects(TUint32 aEffects);
   1.721 +	IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn);
   1.722 +	IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const;
   1.723 +	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
   1.724 +	IMPORT_C TInt ScriptTypeForMetrics() const;
   1.725 +	static TBool IsCompensationForAspectRatioNeeded(TInt aPixelWidth, TInt aPixelHeight, TReal& aRatio);
   1.726 +public:
   1.727 +	/** Algorithmic effects flags.
   1.728 +
   1.729 + 	These can be combined using an OR operation.
   1.730 +	@publishedPartner For use by system/UI software.
   1.731 +	@deprecated Use FontEffect::TEffect instead.
   1.732 +	*/
   1.733 +	enum
   1.734 +		{
   1.735 +		/** Font is algorithmic bold. */
   1.736 +		EAlgorithmicBold = 1,
   1.737 +		/** Font has a drop shadow. */
   1.738 +		EDropShadow = 2,
   1.739 +		/** Font is an outline font. */
   1.740 +		EOutline = 4
   1.741 +		};
   1.742 +private:
   1.743 +	void SetScriptTypeForMetrics(TInt aScript);
   1.744 +	void SetSymbol(TBool aSymbol);
   1.745 +	TBool Symbol() const;
   1.746 +	IMPORT_C TBool OperatorEquality(const TOpenFontSpec& aOpenFontSpec) const;
   1.747 +	IMPORT_C TUint32 DoEffects() const;
   1.748 +	IMPORT_C void DoSetEffects(TUint32 aEffects);
   1.749 +private:
   1.750 +	TInt iHeight;						// em height
   1.751 +	TInt32 iWidthFactor;				// algorithmic width factor as a 16.16 fixed-point number
   1.752 +	TInt32 iSlantFactor;				// algorithmic slant factor as a 16.16 fixed-point number
   1.753 +	TInt iBitmapType;					// non-anti-aliased, standard anti-aliased, etc.; zero means 'default'
   1.754 +	TUint32 iEffects;					// bit flags for font effects
   1.755 +	TInt iSymbol;						// a symbol font as understood by TFontSpec (bit 1), script type (bits 2-5)
   1.756 +	// The following data member exists only to allow round-trip conversion between TFontSpec and TOpenFontSpec
   1.757 +	TFontPrintPosition iPrintPosition;	// normal, superscript or subscript
   1.758 +
   1.759 +	TInt iReserved2;
   1.760 +	};
   1.761 +
   1.762 +/**
   1.763 +Constants for attachment points for diacritics.
   1.764 +@internalComponent
   1.765 +*/
   1.766 +enum TOpenFontAttachment
   1.767 +	{
   1.768 +	EBaselineLeft,
   1.769 +	EBaselineRight,
   1.770 +	ETopLeft,
   1.771 +	ETopCenter,
   1.772 +	ETopRight,
   1.773 +	EBottomLeft,
   1.774 +	EBottomCenter,
   1.775 +	EBottomRight
   1.776 +	};
   1.777 +
   1.778 +
   1.779 + 
   1.780 +/** 
   1.781 +Font file abstract base class.
   1.782 +
   1.783 +Write a class derived from COpenFontFile to manage a file with the font format 
   1.784 +supported by your DLL. The derived class must implement the virtual 
   1.785 +GetNearestFontInPixelsL() function. This function takes a font description 
   1.786 +and creates a COpenFont derived object if the description matches a typeface 
   1.787 +contained in the font file.
   1.788 +
   1.789 +Derived classes must also load typeface attributes from the file into the 
   1.790 +protected typeface attribute array during construction. This array is what 
   1.791 +is searched when getting font attribute information see AddFaceL(), 
   1.792 +GetNearestFontHelper().
   1.793 +
   1.794 +Writing derived classes  construction:
   1.795 +
   1.796 +Call the COpenFontFile constructor in the constructor for your derived object, 
   1.797 +passing it aUid and aFileName arguments. These values are the arguments passed 
   1.798 +when the constructor is called by COpenFontRasterizer::NewFontFileL().
   1.799 +
   1.800 +A file may contain one or more typefaces. During construction the derived 
   1.801 +object should extract the information for each typeface and add it to this 
   1.802 +object's protected typeface attribute array see AddFaceL(). This process 
   1.803 +will probably leave under some conditions. It should therefore be implemented 
   1.804 +in a second phase constructor.
   1.805 +
   1.806 +Writing derived classes  implement the pure virtual functions:
   1.807 +
   1.808 +Derived classes must also implement the two pure virtual functions 
   1.809 +GetNearestFontInPixelsL() and HasUnicodeCharacterL(). Information about 
   1.810 +these functions is provided in the definitions below. Information about 
   1.811 +deriving from this class is also provided in the API guide. 
   1.812 +
   1.813 +@see COpenFontRasterizer::NewFontFileL()
   1.814 +@see CWsScreenDevice::AddFile()
   1.815 +@publishedAll
   1.816 +@released
   1.817 +*/
   1.818 +class COpenFontFile : public CBase
   1.819 +	{
   1.820 +public:
   1.821 +	/**
   1.822 +	Gets the font which is the nearest to the given font specification.
   1.823 +
   1.824 +	Implementations of this pure virtual function should create the COpenFont 
   1.825 +	derived object that most closely matches aDesiredFontSpec, while fitting within
   1.826 +	aMaxHeight, and place a pointer to it in aFont. If this cannot be done,
   1.827 +	e.g. if the font name doesn't match, aFont should be set to NULL.
   1.828 +
   1.829 +	The other two arguments, aHeap and aSessionCacheList, should be passed to 
   1.830 +	the COpenFont constructor.
   1.831 +
   1.832 +	Implementations may use the utility function GetNearestFontHelper()
   1.833 +	to get the attributes of the closest matching font.
   1.834 +
   1.835 +	@param aHeap Shared heap. This value should be passed to the COpenFont derived 
   1.836 +	classes' constructor.
   1.837 +	@param aSessionCacheList The session cache list. This value should be passed 
   1.838 +	to the COpenFont derived classes' constructor.
   1.839 +	@param aDesiredFontSpec The desired font specification.
   1.840 +	@param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating 
   1.841 +	the algorithmic slant of the typeface.
   1.842 +	@param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating 
   1.843 +	the algorithmic slant of the typeface.
   1.844 +	@param aFont On return, contains a pointer to the newly created COpenFont 
   1.845 +	derived object, or NULL if no font matching aDesiredFontSpec exists.
   1.846 +	@param aActualFontSpec The actual font specification of the font retrieved 
   1.847 +	into aFont.
   1.848 +	@publishedAll
   1.849 +	@see GetNearestFontHelper()
   1.850 +	*/
   1.851 +	virtual void GetNearestFontInPixelsL(
   1.852 +		RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
   1.853 +		const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
   1.854 +		COpenFont*& aFont, TOpenFontSpec& aActualFontSpec) = 0;
   1.855 +
   1.856 +	/**
   1.857 +	Gets the font which is the nearest to the given font specification.
   1.858 +
   1.859 +	Implementations of this pure virtual function should create the COpenFont 
   1.860 +	derived object that most closely matches aDesiredFontSpec, while fitting within
   1.861 +	aMaxHeight, and place a pointer to it in aFont. If this cannot be done,
   1.862 +	e.g. if the font name doesn't match, aFont should be set to NULL.
   1.863 +
   1.864 +	The other two arguments, aHeap and aSessionCacheList, should be passed to 
   1.865 +	the COpenFont constructor.
   1.866 +
   1.867 +	Implementations may use the utility function GetNearestFontHelper()
   1.868 +	to get the attributes of the closest matching font.
   1.869 +
   1.870 +	@param aHeap Shared heap. This value should be passed to the COpenFont derived 
   1.871 +	classes' constructor.
   1.872 +	@param aSessionCacheList The session cache list. This value should be passed 
   1.873 +	to the COpenFont derived classes' constructor.
   1.874 +	@param aDesiredFontSpec The desired font specification.
   1.875 +	@param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating 
   1.876 +	the algorithmic slant of the typeface.
   1.877 +	@param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating 
   1.878 +	the algorithmic slant of the typeface.
   1.879 +	@param aFont On return, contains a pointer to the newly created COpenFont 
   1.880 +	derived object, or NULL if no font matching aDesiredFontSpec exists.
   1.881 +	@param aActualFontSpec The actual font specification of the font retrieved 
   1.882 +	into aFont.
   1.883 +	@publishedAll
   1.884 +	@see GetNearestFontHelper()
   1.885 +	*/
   1.886 +	virtual void GetNearestFontToDesignHeightInPixelsL(
   1.887 +		RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/,
   1.888 +		const TOpenFontSpec& /*aDesiredFontSpec*/, TInt /*aPixelWidth*/, TInt /*aPixelHeight*/,
   1.889 +		COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/) {}
   1.890 +	/**
   1.891 +	Gets the font which is the nearest to the given font specification.
   1.892 +
   1.893 +	Implementations of this pure virtual function should create the COpenFont 
   1.894 +	derived object that most closely matches aDesiredFontSpec, while fitting within
   1.895 +	aMaxHeight, and place a pointer to it in aFont. If this cannot be done,
   1.896 +	e.g. if the font name doesn't match, aFont should be set to NULL.
   1.897 +
   1.898 +	The other two arguments, aHeap and aSessionCacheList, should be passed to 
   1.899 +	the COpenFont constructor.
   1.900 +
   1.901 +	Implementations may use the utility function GetNearestFontHelper()
   1.902 +	to get the attributes of the closest matching font.
   1.903 +
   1.904 +	@param aHeap Shared heap. This value should be passed to the COpenFont derived 
   1.905 +	classes' constructor.
   1.906 +	@param aSessionCacheList The session cache list. This value should be passed 
   1.907 +	to the COpenFont derived classes' constructor.
   1.908 +	@param aDesiredFontSpec The desired font specification.
   1.909 +	@param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating 
   1.910 +	the algorithmic slant of the typeface.
   1.911 +	@param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating 
   1.912 +	the algorithmic slant of the typeface.
   1.913 +	@param aFont On return, contains a pointer to the newly created COpenFont 
   1.914 +	derived object, or NULL if no font matching aDesiredFontSpec exists.
   1.915 +	@param aActualFontSpec The actual font specification of the font retrieved 
   1.916 +	into aFont.
   1.917 +	@param aMaxHeight The maximum height within which the font must fit.
   1.918 +	@publishedAll
   1.919 +	@see GetNearestFontHelper()
   1.920 +	*/
   1.921 +	virtual void GetNearestFontToMaxHeightInPixelsL(
   1.922 +		RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/,
   1.923 +		const TOpenFontSpec& /*aDesiredFontSpec*/, TInt /*aPixelWidth*/, TInt /*aPixelHeight*/,
   1.924 +		COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/, TInt /*aMaxHeight*/) {}
   1.925 +
   1.926 +	/** Tests whether a specified typeface contains a particular character.
   1.927 +	
   1.928 +	@param aFaceIndex The index of the typeface to be tested.
   1.929 +	@param aCode The Unicode character code for the character to be tested. 
   1.930 +	@return ETrue if the typeface contains aCode, otherwise EFalse. */
   1.931 +	virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const = 0; 
   1.932 +	IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam);
   1.933 +	IMPORT_C COpenFontFile(TInt aUid,const TDesC& aFileName);
   1.934 +	IMPORT_C ~COpenFontFile();
   1.935 +	IMPORT_C TBool GetNearestFontHelper(const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
   1.936 +										TInt& aFaceIndex,TOpenFontSpec& aActualFontSpec) const;
   1.937 +	IMPORT_C void AddFaceL(const TOpenFontFaceAttrib& aAttrib);
   1.938 +	inline TUid Uid() const;
   1.939 +	inline const TDesC& FileName() const;
   1.940 +	inline const TOpenFontFaceAttrib& FaceAttrib(TInt aFaceIndex) const;
   1.941 +	inline TInt FaceCount() const;
   1.942 +	inline void IncRefCount();
   1.943 +	inline TBool DecRefCount();
   1.944 +	TInt GetNearestFontInPixels(
   1.945 +		RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
   1.946 +		const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
   1.947 +		COpenFont*& aFont, TOpenFontSpec& aActualFontSpec);
   1.948 +	TInt GetNearestFontToDesignHeightInPixels(
   1.949 +		RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
   1.950 +		const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
   1.951 +		COpenFont*& aFont, TOpenFontSpec& aActualFontSpec);
   1.952 +	TInt GetNearestFontToMaxHeightInPixels(
   1.953 +		RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
   1.954 +		const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
   1.955 +		COpenFont*& aFont, TOpenFontSpec& aActualFontSpec, TInt aMaxHeight);
   1.956 +	void RemoveFontFromList(const COpenFont* aFont);
   1.957 +	void SetFontStoreL(CFontStore* aFontStore);
   1.958 +	CFontStore* GetFontStore();
   1.959 +	CArrayPtrFlat<COpenFont>* GetOpenFontList();
   1.960 +protected:
   1.961 +	IMPORT_C TBool GetNearestFontHelperOld(const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
   1.962 +										TInt& aFaceIndex,TOpenFontSpec& aActualFontSpec) const;
   1.963 +private:
   1.964 +	// A class to contain the public font attributes and private positioning information (for kerning, ligatures, etc.)
   1.965 +	class TAttrib: public TOpenFontFaceAttrib
   1.966 +		{
   1.967 +		public:
   1.968 +		COpenFontPositioner* iPositioner;	// if non-null, positioning information for the typeface
   1.969 +		};
   1.970 +	static TInt ScoreByName(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib);
   1.971 +	static TInt ScoreByStyle(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib);
   1.972 +	void GetNearestFontToDesignHeightInPixelsAndAddToListL(
   1.973 +		RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
   1.974 +		const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
   1.975 +		COpenFont*& aFont, TOpenFontSpec& aActualFontSpec);
   1.976 +	void GetNearestFontToMaxHeightInPixelsAndAddToListL(
   1.977 +		RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
   1.978 +		const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
   1.979 +		COpenFont*& aFont, TOpenFontSpec& aActualFontSpec, TInt aMaxHeight);
   1.980 +
   1.981 +private:
   1.982 +	CArrayFixFlat<TAttrib> iFaceAttrib;
   1.983 +	TUid iUid;
   1.984 +	TBuf<KMaxFileName> iFileName;
   1.985 +	TInt iRefCount;
   1.986 +	CArrayPtrFlat<COpenFont> iFontList;
   1.987 +	TOpenFontFileData* iData;
   1.988 +	};
   1.989 +
   1.990 + 
   1.991 +/** 
   1.992 +The Open Font rasterizer plug-in Interface Definition class. 
   1.993 +
   1.994 +This interface allows the implementation of an Open Font rasterizer plug-in,
   1.995 +which can then be dynamically loaded at run time by the ECOM plug-in framework. 
   1.996 +The plug-in implementation is instantiated by calling NewL(), passing the implementation 
   1.997 +UID so that ECOM can instantiate the correct implementation. 
   1.998 +
   1.999 +The rasterizer interface declares a single pure virtual functions, which the 
  1.1000 +plug-in derived from this interface must implement. The function reads font files, and creates 
  1.1001 +a COpenFontFile object if the font file is of the right type.
  1.1002 +
  1.1003 +Writing derived classes:
  1.1004 +
  1.1005 +Open font rasterizers should derive from this class and implement the 
  1.1006 +NewFontFileL() function.
  1.1007 +
  1.1008 +Derived classes should also define the factory function. It is a static function 
  1.1009 +which takes no arguments. It creates a COpenFontRasterizer derived object on the heap, and returns it 
  1.1010 +to the caller. This factory function, together with the implementation UID will form 
  1.1011 +the TImplementationProxy used by the ECOM framework to instatiate the plug-in. 
  1.1012 +
  1.1013 +The rasterizer class may also need to store an 'engine context'. This is an 
  1.1014 +object derived from COpenFontRasterizerContext, which provides functions that 
  1.1015 +make it easier to write the glyph bitmap during rasterization.
  1.1016 +
  1.1017 +
  1.1018 +@publishedAll
  1.1019 +@released
  1.1020 +*/
  1.1021 +class COpenFontRasterizer: public CBase
  1.1022 +	{
  1.1023 +public:
  1.1024 + 	/** Creates a COpenFontFile derived object for loading font files in the 
  1.1025 + 	new format. 
  1.1026 +		
  1.1027 +	This function is called by the framework during font and bitmap server 
  1.1028 +	startup. It creates a font file object for font files in the \\resource\\fonts 
  1.1029 +	directory on all drives, using the default search path. The first font of 
  1.1030 +	a given name overrides subsequent ones. The directory search path is soft 
  1.1031 +	to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added 
  1.1032 +	dynamically after startup using CWsScreenDevice::AddFile(), which 
  1.1033 +	indirectly calls this function.
  1.1034 +	
  1.1035 +	Implementations of this function should examine the file aFileName, and if 
  1.1036 +	it is of the correct type attempt to create a COpenFontFile derived object 
  1.1037 +	to load it. The caller is responsible for deleting the object. The function 
  1.1038 +	must return NULL if it cannot recognise the file, and it may also leave if 
  1.1039 +	there is an error. 
  1.1040 +	
  1.1041 +	@param aUid An ID to be used for the file. UIDs are required by the font 
  1.1042 +	framework, so the font store allocates them for non Symbian OS-native font 
  1.1043 +	files. This ID persists until the font is unloaded, e.g. if the device is 
  1.1044 +	rebooted.
  1.1045 +	@param aFileName The full path and filename of the file from which the 
  1.1046 +	COpenFontFile object is created, if the file is the correct type.
  1.1047 +	@param aFileSession The file session owned by the Font and Bitmap server. 
  1.1048 +	This file session should be used for any file access. If COpenFontFile 
  1.1049 +	objects need to keep files open, aFileSession should be stored in a place 
  1.1050 +	that is accessible to them. 
  1.1051 +	@return A pointer to a new COpenFontFile derived object, or NULL if the 
  1.1052 +	file type is not recognised.
  1.1053 +	@see CWsScreenDevice::AddFile() */
  1.1054 +	virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession) = 0;
  1.1055 +	inline static COpenFontRasterizer* NewL(TUid aInterfaceImplUid);
  1.1056 +	inline virtual ~COpenFontRasterizer();
  1.1057 +	IMPORT_C virtual void Reserved(); // unused; for future expansion
  1.1058 +private:
  1.1059 +	TUid iDtor_ID_Key;//ECOM identifier used during destruction
  1.1060 +	};
  1.1061 +
  1.1062 + 
  1.1063 +/** 
  1.1064 +Convenience class from which rasterizer contexts may be derived.
  1.1065 +
  1.1066 +A rasterizer context object may (optionally) be created to provide the link 
  1.1067 +between the rasterizer DLL code supported by the Open Font System, and the 
  1.1068 +rasterizer engine code. A rasterizer context object class should get the 
  1.1069 +requested bitmap from the associated rasterizer engine. It should then convert 
  1.1070 +this into Symbian run-length-encoded format. This class contains convenience 
  1.1071 +functions to make the conversion easier.
  1.1072 +
  1.1073 +Deriving from this class is described in greater detail in the API guide.
  1.1074 +@publishedAll
  1.1075 +@released
  1.1076 +*/
  1.1077 +class COpenFontRasterizerContext: public CBase
  1.1078 +	{
  1.1079 +public:
  1.1080 +	inline COpenFontRasterizerContext();
  1.1081 +	inline void StartGlyph(TOpenFontGlyphData* aGlyphData);
  1.1082 +	inline void WriteGlyphBit(TInt aBit);
  1.1083 +	inline void WriteGlyphByte(TInt aByte);
  1.1084 +	inline void EndGlyph();
  1.1085 +private:
  1.1086 +	TOpenFontGlyphData* iGlyphData;
  1.1087 +	TUint8* iGlyphDataStart;
  1.1088 +	TUint8* iGlyphDataPtr;
  1.1089 +	TUint8* iGlyphDataEnd;
  1.1090 +	TInt iGlyphBit;
  1.1091 +	TInt iBytesNeeded;
  1.1092 +	TBool iOverflow;
  1.1093 +	TAny* iReserved; // unused; for future expansion
  1.1094 +	};
  1.1095 +
  1.1096 +
  1.1097 +/**
  1.1098 + Shaper abstract class.  All shaper implementations derive from this
  1.1099 + @publishedAll */
  1.1100 +class CShaper : public CBase
  1.1101 +	{
  1.1102 +public:
  1.1103 +	class TInput
  1.1104 +		{
  1.1105 +	public:
  1.1106 +		/** The text to be shaped possibly including context. */
  1.1107 +		const TDesC* iText;
  1.1108 +		/** The index of the first character in iText to be shaped. */
  1.1109 +		TInt iStart;
  1.1110 +		/** (One past) the end of the text in iText to be shaped. */
  1.1111 +		TInt iEnd;
  1.1112 +		/** Script code, for example 'd'<<24 | 'e'<<16 | 'v'<<8 | 'a'
  1.1113 +		for Devanagari. */
  1.1114 +		TInt iScript;
  1.1115 +		/** Language code. 0 implies "default" */
  1.1116 +		TUint32 iLanguage;
  1.1117 +		/** Maximum advance in pixels. Shaping beyond this
  1.1118 +		advance is not required (but is not harmful). */
  1.1119 +		TInt iMaximumAdvance;
  1.1120 +		/** Flags. Currently none is defined. */
  1.1121 +		TInt iFlags;
  1.1122 +		/** Session handle. To be used if rasterization is needed. */
  1.1123 +		TInt iSessionHandle;
  1.1124 +		/** Reserved for future expansion. Must be set to 0. */
  1.1125 +		TInt iReserved1;
  1.1126 +		};
  1.1127 +	/** Constructor */
  1.1128 +	IMPORT_C CShaper();
  1.1129 +
  1.1130 +	/** Destructor */
  1.1131 +	IMPORT_C virtual ~CShaper();
  1.1132 +
  1.1133 +	/** construct a shaper object
  1.1134 +	@param aBitmapFont The font to be shaped.
  1.1135 +	@param aHeap The heap to be used by the shaper.
  1.1136 +	@return KErrNone if this font can be shaper or system wide error code*/
  1.1137 +	virtual TInt ConstructL(CBitmapFont*  aBitmapFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0;
  1.1138 +
  1.1139 +	/** If possible, shape the text described by aInput, placing the
  1.1140 +	output on	aHeapForOutput.
  1.1141 +	@param aOutput The output, as a newly allocate object on
  1.1142 +	aHeapForOutput.
  1.1143 +	@param aInput The input text and other parameters.
  1.1144 +	@param aHeapForOutput. On success, aOutput should be allocated from
  1.1145 +	this and nothing else. On failure, nothing should be allocated from
  1.1146 +	it.
  1.1147 +	@return Error value from one of the system-wide error codes on
  1.1148 +	failure,	KErrNone on success.
  1.1149 +	@see TShapeHeader */
  1.1150 +	virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput) = 0;
  1.1151 +
  1.1152 +	/** For future expansion. Any overriders must base-call
  1.1153 +	if aInterface is unrecognized.
  1.1154 +	@param aInterfaceId The ID of the interface to return.
  1.1155 +	@return A pointer to the extension interface.
  1.1156 +	@internalComponent
  1.1157 +	*/
  1.1158 +
  1.1159 +	IMPORT_C virtual void* ExtendedInterface(TUid aInterfaceId);	
  1.1160 +	};
  1.1161 +
  1.1162 +/** ECOM plug-in base class for shaper factories.
  1.1163 +@publishedAll */
  1.1164 +class CShaperFactory : public CBase
  1.1165 +	{
  1.1166 +public:
  1.1167 +	/** Create a shaper if possible, for typeface aFaceIndex
  1.1168 +	within file aFileName.
  1.1169 +	@param aFont The font to be shaped.
  1.1170 +	@param iHeap The heap to use for constructing the shaper.
  1.1171 +	@return 0 If the font is not understood or inappropriate for
  1.1172 +	any shaper that might be constructed by this class, otherwise
  1.1173 +	returns the newly-constructed shaper on iHeap. */
  1.1174 +	virtual CShaper* NewShaperL(CBitmapFont* aFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0;
  1.1175 +
  1.1176 +	inline static CShaperFactory* NewL(TUid aInterfaceImplUid);
  1.1177 +	inline virtual ~CShaperFactory();
  1.1178 +
  1.1179 +	/** For future expansion. Any overriders must base-call
  1.1180 +	if aInterface is unrecognized.
  1.1181 +	@param aInterfaceId The ID of the interface to return.
  1.1182 +	@return A pointer to the extension interface.
  1.1183 +	@internalComponent
  1.1184 +	*/
  1.1185 +	virtual void* ExtendedInterface(TUid aInterfaceId);
  1.1186 +
  1.1187 +private:
  1.1188 +	TUid iDtor_ID_Key;//ECOM identifier used during destruction
  1.1189 +	};
  1.1190 +	
  1.1191 +
  1.1192 +// Inline functions start here.
  1.1193 +/** Default C++ constructor.
  1.1194 +	
  1.1195 +This creates then zero fills the object. */
  1.1196 +inline TOpenFontMetrics::TOpenFontMetrics()
  1.1197 +	{
  1.1198 +	Mem::FillZ(this,sizeof(*this));
  1.1199 +	}
  1.1200 +
  1.1201 +/** Gets the font's size.
  1.1202 +	
  1.1203 +@return The font's size. 
  1.1204 +@see SetSize() */
  1.1205 +inline TInt TOpenFontMetrics::Size() const
  1.1206 +	{
  1.1207 +	return iDesignHeight;
  1.1208 +	}
  1.1209 + 
  1.1210 +/** Gets the font's ascent.
  1.1211 +	
  1.1212 +This is the ascent for the Latin character which is highest above the baseline.
  1.1213 +
  1.1214 +@return The font's ascent, in pixels.
  1.1215 +@see SetAscent() */
  1.1216 +inline TInt TOpenFontMetrics::Ascent() const
  1.1217 +	{
  1.1218 +	return iAscent;
  1.1219 +	}
  1.1220 +
  1.1221 +/** Gets the font's descent.
  1.1222 +	
  1.1223 +This is the descent for the Latin character in the font which falls furthest below the baseline.
  1.1224 +	
  1.1225 +@return The font's descent, in pixels. 
  1.1226 +@see SetDescent() */
  1.1227 +inline TInt TOpenFontMetrics::Descent() const
  1.1228 +	{
  1.1229 +	return iDescent;
  1.1230 +	}
  1.1231 + 
  1.1232 +/** Sets the font's maximum height.
  1.1233 +
  1.1234 +Note that if this object was initialised from the CFont this will be the same 
  1.1235 +as the ascent.
  1.1236 +
  1.1237 +This is the ascent for the character which is highest above the baseline. 
  1.1238 +In many fonts this will be the height of an accented character like Â, 
  1.1239 +including the accent.
  1.1240 +	
  1.1241 +@return The maximum height of the font, in pixels.
  1.1242 +@see SetMaxDepth() */
  1.1243 +inline TInt TOpenFontMetrics::MaxHeight() const
  1.1244 +	{
  1.1245 +	return iMaxHeight;
  1.1246 +	}
  1.1247 + 
  1.1248 +/** Gets the font's maximum depth.
  1.1249 +
  1.1250 +Note: If this object was initialised from the CFont this will be the same as the 
  1.1251 +descent.
  1.1252 +
  1.1253 +This is the descent for the character in the font which falls furthest below 
  1.1254 +the baseline.
  1.1255 +	
  1.1256 +@return The font's maximum depth.
  1.1257 +@see SetMaxDepth() */
  1.1258 +inline TInt TOpenFontMetrics::MaxDepth() const
  1.1259 +	{
  1.1260 +	return iMaxDepth;
  1.1261 +	}
  1.1262 + 
  1.1263 +/** Gets the maximum character width, in pixels.
  1.1264 +	
  1.1265 +@return The maximum character width, in pixels.
  1.1266 +@see SetMaxWidth() */
  1.1267 +inline TInt TOpenFontMetrics::MaxWidth() const
  1.1268 +	{
  1.1269 +	return iMaxWidth;
  1.1270 +	}
  1.1271 + 
  1.1272 +/** Sets the font's size.
  1.1273 +	
  1.1274 +@param aSize The font's size.
  1.1275 +@see Size() */
  1.1276 +inline void TOpenFontMetrics::SetSize(TInt aSize)
  1.1277 +	{
  1.1278 +	iDesignHeight = static_cast<TInt16>(aSize);
  1.1279 +	}
  1.1280 +
  1.1281 +/** Sets the ascent.
  1.1282 +	
  1.1283 +@param aAscent The ascent, in pixels.
  1.1284 +@see Ascent() */
  1.1285 +inline void TOpenFontMetrics::SetAscent(TInt aAscent)
  1.1286 +	{
  1.1287 +	iAscent = static_cast<TInt16>(aAscent);
  1.1288 +	}
  1.1289 +
  1.1290 +/** Sets the descent.
  1.1291 +	
  1.1292 +@param aDescent The descent, in pixels.
  1.1293 +@see Descent() */
  1.1294 +inline void TOpenFontMetrics::SetDescent(TInt aDescent)
  1.1295 +	{
  1.1296 +	iDescent = static_cast<TInt16>(aDescent);
  1.1297 +	}
  1.1298 + 
  1.1299 +/** Sets the font's maximum height.
  1.1300 +	
  1.1301 +@param aMaxHeight The font's maximum height, in pixels. 
  1.1302 +@see MaxHeight() */
  1.1303 +inline void TOpenFontMetrics::SetMaxHeight(TInt aMaxHeight)
  1.1304 +	{
  1.1305 +	iMaxHeight = static_cast<TInt16>(aMaxHeight);
  1.1306 +	}
  1.1307 + 
  1.1308 +/** Sets the font's maximum depth.
  1.1309 +	
  1.1310 +@param aMaxDepth The font's maximum depth, in pixels.
  1.1311 +@see MaxDepth() */
  1.1312 +inline void TOpenFontMetrics::SetMaxDepth(TInt aMaxDepth)
  1.1313 +	{
  1.1314 +	iMaxDepth = static_cast<TInt16>(aMaxDepth);
  1.1315 +	}
  1.1316 + 
  1.1317 +/** Sets the maximum character width, in pixels.
  1.1318 +	
  1.1319 +@param aMaxWidth The maximum character width, in pixels.
  1.1320 +@see MaxWidth() */
  1.1321 +inline void TOpenFontMetrics::SetMaxWidth(TInt aMaxWidth)
  1.1322 +	{
  1.1323 +	iMaxWidth = static_cast<TInt16>(aMaxWidth);
  1.1324 +	}
  1.1325 + 
  1.1326 +/** Default C++ constructor. 
  1.1327 +	
  1.1328 +The constructor initialises all data members to zero. As for other T classes, 
  1.1329 +there is no need to explicitly cleanup TOpenFontCharMetrics objects. */
  1.1330 +inline TOpenFontCharMetrics::TOpenFontCharMetrics()
  1.1331 +	{
  1.1332 +	Mem::FillZ(this,sizeof(*this));
  1.1333 +	}
  1.1334 +	
  1.1335 +/** Gets the width of the character's bitmap.
  1.1336 +	
  1.1337 +@return The width of the bitmap in pixels. */
  1.1338 +inline TInt TOpenFontCharMetrics::Width() const
  1.1339 +	{
  1.1340 +	return iWidth;
  1.1341 +	}
  1.1342 + 
  1.1343 +/** Gets the height of the character's bitmap.
  1.1344 +	
  1.1345 +@return The character's height in pixels. */
  1.1346 +inline TInt TOpenFontCharMetrics::Height() const
  1.1347 +	{
  1.1348 +	return iHeight;
  1.1349 +	}
  1.1350 + 
  1.1351 +/** Gets the horizontal bearing X. 
  1.1352 +	
  1.1353 +This is the distance in pixels from the pen point before the character is 
  1.1354 +drawn (the origin) to the left edge of the bitmap, when drawing horizontally. 
  1.1355 +A positive value means that the left edge of the bitmap is right of the origin.
  1.1356 +	
  1.1357 +@return The horizontal bearing X in pixels */
  1.1358 +inline TInt TOpenFontCharMetrics::HorizBearingX() const
  1.1359 +	{
  1.1360 +	return iHorizBearingX;
  1.1361 +	}
  1.1362 + 
  1.1363 +/** Gets horizontal bearing Y.
  1.1364 +	
  1.1365 +This is the vertical distance in pixels from the pen point before the character 
  1.1366 +is drawn (the origin) to the top edge of the bitmap, when drawing horizontally. 
  1.1367 +A positive value means that the top edge of the bitmap is above the origin
  1.1368 +	
  1.1369 +@return The horizontal bearing Y in pixels. */
  1.1370 +inline TInt TOpenFontCharMetrics::HorizBearingY() const
  1.1371 +	{
  1.1372 +	return iHorizBearingY;
  1.1373 +	}
  1.1374 + 
  1.1375 +/** Gets the horizontal advance.
  1.1376 +	
  1.1377 +This is the amount added to the x co-ordinate of the origin after the character 
  1.1378 +is drawn   what most people understand by the width or escapement of a character. 
  1.1379 +The origin here is the pen point before the character is drawn. 
  1.1380 +	
  1.1381 +@return The horizontal advance in pixels */
  1.1382 +inline TInt TOpenFontCharMetrics::HorizAdvance() const
  1.1383 +	{
  1.1384 +	return iHorizAdvance;
  1.1385 +	}
  1.1386 +
  1.1387 +/** Gets the vertical bearing X.
  1.1388 +	
  1.1389 +This is the distance in pixels from the pen point before the character is 
  1.1390 +drawn (the origin) to the left edge of the bitmap, when drawing vertically. 
  1.1391 +A positive value means that the left edge of the bitmap is right of the origin.
  1.1392 +	
  1.1393 +@return The vertical bearing X in pixels. */
  1.1394 +inline TInt TOpenFontCharMetrics::VertBearingX() const
  1.1395 +	{
  1.1396 +	return iVertBearingX;
  1.1397 +	}
  1.1398 + 
  1.1399 +/** Gets the vertical bearing Y.
  1.1400 +	
  1.1401 +This is the distance in pixels from the pen point before the character is 
  1.1402 +drawn (the origin) to the top edge of the bitmap, when drawing vertically. 
  1.1403 +A positive value means that the top edge of the bitmap is above the origin.
  1.1404 +	
  1.1405 +@return The vertical bearing Y in pixels. */
  1.1406 +inline TInt TOpenFontCharMetrics::VertBearingY() const
  1.1407 +	{
  1.1408 +	return iVertBearingY;
  1.1409 +	}
  1.1410 + 
  1.1411 +/** Gets the vertical advance.
  1.1412 +	
  1.1413 +When drawing vertically, this is the amount added to the y co-ordinate of 
  1.1414 +the origin after the character is drawn what most people understand by 
  1.1415 +the height of a character. The origin here is the pen point before the character 
  1.1416 +is drawn.
  1.1417 +	
  1.1418 +Note: Vertical drawing is not supported in v5.
  1.1419 +	
  1.1420 +@return The vertical advance in pixels. */
  1.1421 +inline TInt TOpenFontCharMetrics::VertAdvance() const
  1.1422 +	{
  1.1423 +	return iVertAdvance;
  1.1424 +	}
  1.1425 + 
  1.1426 +/** Gets the bounds of the character relative to its origin when setting text 
  1.1427 +horizontally.
  1.1428 +	
  1.1429 +The origin here is the pen point before the character is drawn. 
  1.1430 +
  1.1431 +@param aBounds The character's bounds. */
  1.1432 +inline void TOpenFontCharMetrics::GetHorizBounds(TRect& aBounds) const
  1.1433 +	{
  1.1434 +	aBounds.iTl.iX = iHorizBearingX;
  1.1435 +	aBounds.iTl.iY = -iHorizBearingY;
  1.1436 +	aBounds.iBr.iX = aBounds.iTl.iX + iWidth;
  1.1437 +	aBounds.iBr.iY = aBounds.iTl.iY + iHeight;
  1.1438 +	}
  1.1439 + 
  1.1440 +/** Gets the bounds of the character relative to its origin when setting text 
  1.1441 +vertically. 
  1.1442 +	
  1.1443 +The origin here is the pen point before the character is drawn.
  1.1444 +	
  1.1445 +@param aBounds The character's bounds. */
  1.1446 +inline void TOpenFontCharMetrics::GetVertBounds(TRect& aBounds) const
  1.1447 +	{
  1.1448 +	aBounds.iTl.iX = -iVertBearingX;
  1.1449 +	aBounds.iTl.iY = iVertBearingY;
  1.1450 +	aBounds.iBr.iX = aBounds.iTl.iX + iWidth;
  1.1451 +	aBounds.iBr.iY = aBounds.iTl.iY + iHeight;
  1.1452 +	}
  1.1453 + 
  1.1454 +/** Sets the width of the character's bitmap.
  1.1455 +	
  1.1456 +@param aWidth The width of the bitmap in pixels. */
  1.1457 +inline void TOpenFontCharMetrics::SetWidth(TInt aWidth)
  1.1458 +	{
  1.1459 +	iWidth = (TInt16)aWidth;
  1.1460 +	}
  1.1461 + 
  1.1462 +/** Sets the height of the character's bitmap.
  1.1463 +	
  1.1464 +@param aHeight The character height (in pixels). */
  1.1465 +inline void TOpenFontCharMetrics::SetHeight(TInt aHeight)
  1.1466 +	{
  1.1467 +	iHeight = (TInt16)aHeight;
  1.1468 +	}
  1.1469 + 
  1.1470 +/** Sets the horizontal bearing X.
  1.1471 +	
  1.1472 +This is the distance in pixels from the pen point before the character is 
  1.1473 +drawn (the origin) to the left edge of the bitmap, when drawing horizontally. 
  1.1474 +A positive value means that the left edge of the bitmap is right of the origin.
  1.1475 +	
  1.1476 +@param aHorizBearingX The horizontal bearing X (in pixels). */
  1.1477 +inline void TOpenFontCharMetrics::SetHorizBearingX(TInt aHorizBearingX)
  1.1478 +	{
  1.1479 +	iHorizBearingX = (TInt16)aHorizBearingX;
  1.1480 +	}
  1.1481 + 
  1.1482 +/** Sets the horizontal bearing Y.
  1.1483 +	
  1.1484 +This is the distance in pixels from the pen point before the character is 
  1.1485 +drawn (the origin) to the top edge of the bitmap, when drawing horizontally. 
  1.1486 +A positive value means that the top edge of the bitmap is above the origin.
  1.1487 +	
  1.1488 +@param aHorizBearingY The horizontal bearing Y (in pixels). */
  1.1489 +inline void TOpenFontCharMetrics::SetHorizBearingY(TInt aHorizBearingY)
  1.1490 +	{
  1.1491 +	iHorizBearingY = (TInt16)aHorizBearingY;
  1.1492 +	}
  1.1493 + 
  1.1494 +/** Sets the horizontal advance.
  1.1495 +	
  1.1496 +This is the amount added to the x co-ordinate of the origin after the character 
  1.1497 +is drawn, what most people understand by the width or escapement of a character. 
  1.1498 +The origin here is the pen point before the character is drawn.
  1.1499 +	
  1.1500 +@param aHorizAdvance The horizontal advance (in pixels). */
  1.1501 +inline void TOpenFontCharMetrics::SetHorizAdvance(TInt aHorizAdvance)
  1.1502 +	{
  1.1503 +	iHorizAdvance = (TInt16)aHorizAdvance;
  1.1504 +	}
  1.1505 + 
  1.1506 +/** Set vertical bearing X.
  1.1507 +	
  1.1508 +This is the distance in pixels from the pen point before the character is 
  1.1509 +drawn (the origin) to the left edge of the bitmap, when drawing vertically. 
  1.1510 +A positive value means that the left edge of the bitmap is right of the origin.
  1.1511 +	
  1.1512 +@param aVertBearingX The vertical bearing X (in pixels). */
  1.1513 +inline void TOpenFontCharMetrics::SetVertBearingX(TInt aVertBearingX)
  1.1514 +	{
  1.1515 +	iVertBearingX = (TInt16)aVertBearingX;
  1.1516 +	}
  1.1517 + 
  1.1518 +/** Sets the vertical bearing Y.
  1.1519 +	
  1.1520 +This is the distance in pixels from the pen point before the character is 
  1.1521 +drawn (the origin) to the top edge of the bitmap, when drawing vertically. 
  1.1522 +A positive value means that the top edge of the bitmap is above the origin.
  1.1523 +	
  1.1524 +@param aVertBearingY The vertical bearing Y (in pixels). */
  1.1525 +inline void TOpenFontCharMetrics::SetVertBearingY(TInt aVertBearingY)
  1.1526 +	{
  1.1527 +	iVertBearingY = (TInt16)aVertBearingY;
  1.1528 +	}
  1.1529 + 
  1.1530 +/** Sets the vertical advance.
  1.1531 +	
  1.1532 +When drawing vertically, this is the amount added to the y co-ordinate of 
  1.1533 +the origin after the character is drawn  what most people understand by 
  1.1534 +the height of a character. The origin here is the pen point before the character 
  1.1535 +is drawn.
  1.1536 +	
  1.1537 +Note: Vertical drawing is not supported in v5.
  1.1538 +	
  1.1539 +@param aVertAdvance The vertical advance (in pixels). */
  1.1540 +inline void TOpenFontCharMetrics::SetVertAdvance(TInt aVertAdvance)
  1.1541 +	{
  1.1542 +	iVertAdvance = (TInt16)aVertAdvance;
  1.1543 +	}
  1.1544 + 
  1.1545 +/** Gets the character metrics for this font.
  1.1546 +	
  1.1547 +@return The character metrics for this font. */
  1.1548 +inline const TOpenFontMetrics& COpenFont::Metrics() const
  1.1549 +	{
  1.1550 +	return iMetrics;
  1.1551 +	}
  1.1552 +
  1.1553 +/** Gets the glyph index.
  1.1554 +	
  1.1555 +This is the index of a particular glyph within the font file.
  1.1556 +	
  1.1557 +Note: This makes it possible to gain access to glyphs which are not referenced 
  1.1558 +by the Unicode character set. However, this feature is not yet supported by 
  1.1559 +Symbian OS.
  1.1560 +	
  1.1561 +@return The glyph index.
  1.1562 +@see SetGlyphIndex() */
  1.1563 +inline TInt TOpenFontGlyphData::GlyphIndex() const
  1.1564 +	{
  1.1565 +	return iGlyphIndex;
  1.1566 +	}
  1.1567 + 
  1.1568 +/** Gets the typeface attributes.
  1.1569 +	
  1.1570 +These are the attributes of the font represented by this object.
  1.1571 +	
  1.1572 +@return The typeface attributes. */
  1.1573 +inline const TOpenFontFaceAttrib* COpenFont::FaceAttrib() const
  1.1574 +	{
  1.1575 +	return iFile ? &iFile->FaceAttrib(iFaceIndex) : NULL;
  1.1576 +	}
  1.1577 + 
  1.1578 +/** Gets a pointer to the COpenFontFile which created this object.
  1.1579 +	
  1.1580 +This is the COpenFontFile which owns the file that contains the definition 
  1.1581 +of the typeface. It can be used to get information about the typeface, or 
  1.1582 +to access the rasterizer context (engine).
  1.1583 +	
  1.1584 +@return The COpenFontFile which created this object. */
  1.1585 +inline COpenFontFile* COpenFont::File() const
  1.1586 +	{
  1.1587 +	return iFile;
  1.1588 +	}
  1.1589 + 
  1.1590 +/** Gets the index of this typeface within the font file.
  1.1591 +	
  1.1592 +@return The index of this typeface within the font file. */
  1.1593 +inline TInt COpenFont::FaceIndex() const
  1.1594 +	{
  1.1595 +	return iFaceIndex;
  1.1596 +	}
  1.1597 + 
  1.1598 +/** Tests whether or not a character needs to be rasterized.
  1.1599 +	
  1.1600 +Characters that have been rasterized are cached  there is no need to regenerate 
  1.1601 +the character bitmap. This function should only be called by the Font and 
  1.1602 +Bitmap server.
  1.1603 +	
  1.1604 +@param aSessionHandle A handle to the font and bitmap server session.
  1.1605 +@param aCode The code for the Unicode character.
  1.1606 +@return ETrue if the character needs to be rasterized, otherwise EFalse. */
  1.1607 +inline TBool COpenFont::CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const
  1.1608 +	{
  1.1609 +	return Glyph(aSessionHandle,aCode) == NULL;
  1.1610 +	}
  1.1611 +
  1.1612 +/** Gets the ascent of an ANSI capital letter in the font whether or not
  1.1613 +there are any ANSI capitals in the font.
  1.1614 +@return The positive distance from the font baseline to the top of a
  1.1615 +standard ANSI capital letter
  1.1616 +@publishedAll
  1.1617 +@released
  1.1618 +@see AscentInPixels()
  1.1619 +*/
  1.1620 +inline TInt COpenFont::FontCapitalAscent() const
  1.1621 +	{
  1.1622 +	return iFontCapitalAscent;
  1.1623 +	}
  1.1624 +
  1.1625 +/** Gets the max ascent of any pre-composed glyph in the font. This will
  1.1626 +include accents or diacritics that form part of pre-composed glyphs. It is
  1.1627 +not guaranteed to cover the max ascent of composite glyphs that have to be
  1.1628 +created by a layout engine. This is also the recommended distance between
  1.1629 +the top of a text box and the baseline of the first line of text. 
  1.1630 +
  1.1631 +The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().
  1.1632 +
  1.1633 +@return The positive distance from the font baseline to the top of the
  1.1634 +highest pre-composed glyph (including accents) above the baseline.
  1.1635 +@publishedAll
  1.1636 +@released
  1.1637 +@see AscentInPixels()
  1.1638 +@see SetScriptTypeForMetrics()
  1.1639 +*/
  1.1640 +inline TInt COpenFont::FontMaxAscent() const
  1.1641 +	{
  1.1642 +	return iFontMaxAscent;
  1.1643 +	}
  1.1644 +
  1.1645 +/** Gets the descent of an ANSI descending character in the font.
  1.1646 +Whether or not there are any ANSI descenders in the font.
  1.1647 +
  1.1648 +The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().
  1.1649 +
  1.1650 +@return The positive distance from the font baseline to the bottom of the
  1.1651 +lowest ANSI descender.
  1.1652 +@publishedAll
  1.1653 +@released
  1.1654 +@see DescentInPixels()
  1.1655 +@see SetScriptTypeForMetrics()
  1.1656 +*/
  1.1657 +inline TInt COpenFont::FontStandardDescent() const
  1.1658 +	{
  1.1659 +	return iFontStandardDescent;
  1.1660 +	}
  1.1661 +
  1.1662 +/** Gets the max descent of any pre-composed glyph in the font. This will
  1.1663 +include accents or diacritics that form part of pre-composed glyphs. It is
  1.1664 +not guaranteed to cover the max descent of composite glyphs that have to be
  1.1665 +created by a layout engine.
  1.1666 +
  1.1667 +The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().
  1.1668 +
  1.1669 +@return The positive distance from the font baseline to the bottom of the
  1.1670 +lowest pre-composed glyph (including accents) below the baseline
  1.1671 +@publishedAll
  1.1672 +@released
  1.1673 +@see DescentInPixels()
  1.1674 +@see SetScriptTypeForMetrics()
  1.1675 +*/
  1.1676 +inline TInt COpenFont::FontMaxDescent() const
  1.1677 +	{
  1.1678 +	return iFontMaxDescent;
  1.1679 +	}
  1.1680 +
  1.1681 +/** Gets the suggested line gap for the font. This is the recommended
  1.1682 +baseline to baseline distance between successive lines of text in the font.
  1.1683 +@return The positive recommended gap between successive lines
  1.1684 +@publishedAll
  1.1685 +@released
  1.1686 +*/
  1.1687 +inline TInt COpenFont::FontLineGap() const
  1.1688 +	{
  1.1689 +	return iFontLineGap;
  1.1690 +	}
  1.1691 +
  1.1692 +/** Gets the maximum height for the font. This is the sum of the max ascent 
  1.1693 +of the font and the max descent of the font.
  1.1694 +
  1.1695 +The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().
  1.1696 +
  1.1697 +@return The positive maximum height of the font
  1.1698 +@publishedAll
  1.1699 +@released
  1.1700 +@see HeightInPixels()
  1.1701 +@see SetScriptTypeForMetrics()
  1.1702 +*/
  1.1703 +inline TInt COpenFont::FontMaxHeight() const
  1.1704 +	{
  1.1705 +	return iFontMaxAscent + iFontMaxDescent;
  1.1706 +	}
  1.1707 +
  1.1708 +/** Default C++ constructor.
  1.1709 +	
  1.1710 +This sets all attribute fields to zero. As for other T classes, there is no 
  1.1711 +need to explicitly clean-up objects derived from this class. */
  1.1712 +inline TOpenFontFaceAttribBase::TOpenFontFaceAttribBase()
  1.1713 +	{
  1.1714 +	Mem::FillZ(this,sizeof(*this));
  1.1715 +	}
  1.1716 + 
  1.1717 +/** Default C++ constructor.
  1.1718 +	
  1.1719 +The function initialises the minimum typeface size to zero, the names to NULL, 
  1.1720 +and the coverage and style flags to zero. */
  1.1721 +inline TOpenFontFaceAttrib::TOpenFontFaceAttrib():
  1.1722 +	iMinSizeInPixels(0),
  1.1723 +	iReserved2(0)
  1.1724 +	{
  1.1725 +	}
  1.1726 + 
  1.1727 +/** Tests for support of Latin characters.
  1.1728 +	
  1.1729 +Note: A return value of ETrue implies that the font has a usable set of 
  1.1730 +characters. It does not imply exhaustive coverage.
  1.1731 +	
  1.1732 +@return ETrue if Latin characters are supported */
  1.1733 +inline TBool TOpenFontFaceAttribBase::HasLatin() const
  1.1734 +	{
  1.1735 +	return iCoverage[0] & ELatinSet;
  1.1736 +	}
  1.1737 + 
  1.1738 +/** Tests for support of Greek characters.
  1.1739 +	
  1.1740 +Note: A return value of ETrue implies that the font has a usable set of 
  1.1741 +characters. It does not imply exhaustive coverage.
  1.1742 +	
  1.1743 +@return ETrue if Greek characters are supported. */
  1.1744 +inline TBool TOpenFontFaceAttribBase::HasGreek() const
  1.1745 +	{
  1.1746 +	return iCoverage[0] & EGreekSet;
  1.1747 +	}
  1.1748 + 
  1.1749 +/** Tests for support of Cyrillic characters.
  1.1750 +	
  1.1751 +Note: A return value of ETrue implies that the font has a usable set of 
  1.1752 +characters. It does not imply exhaustive coverage.
  1.1753 +	
  1.1754 +@return ETrue if Cyrillic characters are supported. */
  1.1755 +inline TBool TOpenFontFaceAttribBase::HasCyrillic() const
  1.1756 +	{
  1.1757 +	return iCoverage[0] & ECyrillicSet;
  1.1758 +	}
  1.1759 + 
  1.1760 +/** Tests for support of Japanese syllabic characters.
  1.1761 +	
  1.1762 +This function tests for the presence of Hiragana and Katakana syllabic 
  1.1763 +characters in the font, collectively called kana. These characters are not 
  1.1764 +sufficient for the Japanese language, which also makes use of Chinese characters.
  1.1765 +	
  1.1766 +Note: A return value of ETrue implies that the font has a usable set of 
  1.1767 +characters. It does not imply exhaustive coverage.
  1.1768 +	
  1.1769 +@return ETrue if Japanese characters are supported 
  1.1770 +@see HasCJK() */
  1.1771 +inline TBool TOpenFontFaceAttribBase::HasKana() const
  1.1772 +	{
  1.1773 +	return iCoverage[1] & EKanaSets;
  1.1774 +	}
  1.1775 + 
  1.1776 +/** Tests for support of Korean Hangul characters.
  1.1777 +	
  1.1778 +Korean may also make use of Chinese characters.
  1.1779 +	
  1.1780 +Note: A return value of ETrue implies that the font has a usable set of 
  1.1781 +characters. It does not imply exhaustive coverage.
  1.1782 +	
  1.1783 +@return ETrue if Korean characters are supported 
  1.1784 +@see HasCJK() */
  1.1785 +inline TBool TOpenFontFaceAttribBase::HasHangul() const
  1.1786 +	{
  1.1787 +	return iCoverage[1] & EHangulSet;
  1.1788 +	}
  1.1789 + 
  1.1790 +/** Tests for support of Chinese ideographic characters.
  1.1791 +	
  1.1792 +These are used in Chinese, Japanese and Korean.
  1.1793 +	
  1.1794 +Note: A return value of ETrue implies that the font has a usable set of 
  1.1795 +characters. It does not imply exhaustive coverage.
  1.1796 +	
  1.1797 +@return ETrue if Chinese ideographs are supported. */
  1.1798 +inline TBool TOpenFontFaceAttribBase::HasCJK() const
  1.1799 +	{
  1.1800 +	return iCoverage[1] & ECJKSet;
  1.1801 +	}
  1.1802 + 
  1.1803 +/** Tests if the typeface contains symbols only.
  1.1804 +	
  1.1805 +@return ETrue if the typeface contains symbols only. */
  1.1806 +inline TBool TOpenFontFaceAttribBase::IsSymbol() const
  1.1807 +	{
  1.1808 +	return iCoverage[0] == 0 && iCoverage[2] == 0 && iCoverage[3] == 0 &&
  1.1809 +		   iCoverage[1] & ESymbolSets && !(iCoverage[1] & ~ESymbolSets);
  1.1810 +	}
  1.1811 + 
  1.1812 +/** Tests if the typeface is inherently bold.
  1.1813 +	
  1.1814 +@return ETrue if the typeface is inherently bold. */
  1.1815 +inline TBool TOpenFontFaceAttribBase::IsBold() const
  1.1816 +	{
  1.1817 +	return iStyle & EBold;
  1.1818 +	}
  1.1819 + 
  1.1820 +/** Tests if the typeface is inherently italic.
  1.1821 +	
  1.1822 +@return ETrue if the typeface is inherently italic. */
  1.1823 +inline TBool TOpenFontFaceAttribBase::IsItalic() const
  1.1824 +	{
  1.1825 +	return iStyle & EItalic;
  1.1826 +	}
  1.1827 + 
  1.1828 +/** Tests if the typeface has serifs.
  1.1829 +	
  1.1830 +@return ETrue if the typeface has serifs. */
  1.1831 +inline TBool TOpenFontFaceAttribBase::IsSerif() const
  1.1832 +	{
  1.1833 +	return iStyle & ESerif;
  1.1834 +	}
  1.1835 + 
  1.1836 +/** Tests if all the characters have the same width.
  1.1837 +	
  1.1838 +@return ETrue if all the characters have the same width. */
  1.1839 +inline TBool TOpenFontFaceAttribBase::IsMonoWidth() const
  1.1840 +	{
  1.1841 +	return iStyle & EMonoWidth;
  1.1842 +	}
  1.1843 + 
  1.1844 +/** Gets the typeface's name.
  1.1845 +	
  1.1846 +@return Descriptor containing typeface name. */
  1.1847 +inline TPtrC TOpenFontFaceAttribBase::Name() const
  1.1848 +	{
  1.1849 +	return iName;
  1.1850 +	}
  1.1851 + 
  1.1852 +/** Gets the full name.
  1.1853 +	
  1.1854 +The full name of the typeface includes style attributes like Italic, Bold, 
  1.1855 +and Cursive.
  1.1856 +	
  1.1857 +@return The full name of the typeface.
  1.1858 +@see FamilyName() */
  1.1859 +inline TPtrC TOpenFontFaceAttrib::FullName() const
  1.1860 +	{
  1.1861 +	return Name();
  1.1862 +	}
  1.1863 + 
  1.1864 +/** Gets the family name.
  1.1865 +	
  1.1866 +Note: The family name of the typeface does not include style attributes like 
  1.1867 +"Italic".
  1.1868 +	
  1.1869 +@return The family name of the typeface. 
  1.1870 +@see FullName() */
  1.1871 +inline TPtrC TOpenFontFaceAttrib::FamilyName() const
  1.1872 +	{
  1.1873 +	return iFamilyName;
  1.1874 +	}
  1.1875 + 
  1.1876 +/** Gets the local full name.
  1.1877 +	
  1.1878 +The local full name of the typeface includes style attributes like Italic, 
  1.1879 +Bold, and Cursive.
  1.1880 +	
  1.1881 +The local name of the typeface is the name in the language of the current 
  1.1882 +locale, where this is provided by the font file. If the local name is not 
  1.1883 +available then the local name will be the same as the ordinary name.
  1.1884 +	
  1.1885 +@return The local full name of the typeface. */
  1.1886 +inline TPtrC TOpenFontFaceAttrib::LocalFullName() const
  1.1887 +	{
  1.1888 +	return iLocalFullName;
  1.1889 +	}
  1.1890 + 
  1.1891 +/** Gets the local family name.
  1.1892 +	
  1.1893 +The local name of the typeface is the name in the language of the current 
  1.1894 +locale, where this is provided by the font file. If the local name is not 
  1.1895 +available then the local name will be the same as the ordinary name.
  1.1896 +	
  1.1897 +Note: The family name of the typeface does not include style attributes like 
  1.1898 +'Italic'.
  1.1899 +	
  1.1900 +@return The local family name of the typeface. */
  1.1901 +inline TPtrC TOpenFontFaceAttrib::LocalFamilyName() const
  1.1902 +	{
  1.1903 +	return iLocalFamilyName;
  1.1904 +	}
  1.1905 + 
  1.1906 +/** Gets the short full name.
  1.1907 +	
  1.1908 +This is the full name of the typeface, truncated to KMaxTypefaceNameLength, 
  1.1909 +if necessary.
  1.1910 +	
  1.1911 +Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters 
  1.1912 +where necessary so that they can be used in the TTypeFace class. The Open 
  1.1913 +Font Framework allows 32 characters as a maximum name length.
  1.1914 +	
  1.1915 +@return The short full name of the typeface.
  1.1916 +@see FullName() */
  1.1917 +inline TPtrC TOpenFontFaceAttrib::ShortFullName() const
  1.1918 +	{
  1.1919 +	// Can't use TDesC::Left for this because it panics if the desired length is > the existing length!
  1.1920 +	return TPtrC(iName.Ptr(),Min(iName.Length(),KMaxTypefaceNameLength));
  1.1921 +	}
  1.1922 + 
  1.1923 +/** Gets the short family name.
  1.1924 +	
  1.1925 +This is the family name, truncated to KMaxTypefaceNameLength, if necessary.
  1.1926 +	
  1.1927 +Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters 
  1.1928 +where necessary so that they can be used in the TTypeFace class. The Open 
  1.1929 +Font Framework allows 32 characters as a maximum name length.
  1.1930 +	
  1.1931 +@return The short family name of the typeface. 
  1.1932 +@see FamilyName() */
  1.1933 +inline TPtrC TOpenFontFaceAttrib::ShortFamilyName() const
  1.1934 +	{
  1.1935 +	return TPtrC(iFamilyName.Ptr(),Min(iFamilyName.Length(),KMaxTypefaceNameLength));
  1.1936 +	}
  1.1937 + 
  1.1938 +/** Gets the short local full name.
  1.1939 +	
  1.1940 +This is the local full name of the typeface, truncated to KMaxTypefaceNameLength, 
  1.1941 +if necessary.
  1.1942 +	
  1.1943 +Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters 
  1.1944 +where necessary so that they can be used in the TTypeFace class. The Open 
  1.1945 +Font Framework allows 32 characters as a maximum name length.
  1.1946 +	
  1.1947 +@return The short local full name of the typeface. 
  1.1948 +@see LocalFullName() */
  1.1949 +inline TPtrC TOpenFontFaceAttrib::ShortLocalFullName() const
  1.1950 +	{
  1.1951 +	return TPtrC(iLocalFullName.Ptr(),Min(iLocalFullName.Length(),KMaxTypefaceNameLength));
  1.1952 +	}
  1.1953 + 
  1.1954 +/** Gets the short local family name.
  1.1955 +	
  1.1956 +This is the local family name of the typeface, truncated to KMaxTypefaceNameLength, 
  1.1957 +if necessary.
  1.1958 +	
  1.1959 +Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters 
  1.1960 +where necessary so that they can be used in the TTypeFace class. The Open 
  1.1961 +Font Framework allows 32 characters as a maximum name length.
  1.1962 +	
  1.1963 +@return The short local family name of the typeface.
  1.1964 +@see LocalFamilyName() */
  1.1965 +inline TPtrC TOpenFontFaceAttrib::ShortLocalFamilyName() const
  1.1966 +	{
  1.1967 +	return TPtrC(iLocalFamilyName.Ptr(),Min(iLocalFamilyName.Length(),KMaxTypefaceNameLength));
  1.1968 +	}
  1.1969 + 
  1.1970 +/** Gets a pointer to the sets of flags that indicate the font's Unicode coverage.
  1.1971 +	
  1.1972 +Each flag that is set represents a supported Unicode range. The mapping is 
  1.1973 +defined in the TrueType documentation under the OS/2 table. 
  1.1974 +	
  1.1975 +Note: Some useful subsets are defined as anonymous enumerated constants at the end 
  1.1976 +of this class, see ELatinSet etc.
  1.1977 +	
  1.1978 +@return A pointer to the flags that indicate the font's Unicode coverage. 
  1.1979 +The flags are stored in an array of four 32-bit integers. When no information 
  1.1980 +is available, all four integers are zero.
  1.1981 +@see SetCoverage() */
  1.1982 +inline const TUint* TOpenFontFaceAttribBase::Coverage() const
  1.1983 +	{
  1.1984 +	return iCoverage;
  1.1985 +	}
  1.1986 + 
  1.1987 +/** Gets the minimum typeface size.
  1.1988 +	
  1.1989 +This is the smallest size that can be drawn legibly.
  1.1990 +	
  1.1991 +@return The minimum typeface size (in pixels). */
  1.1992 +inline TInt TOpenFontFaceAttrib::MinSizeInPixels() const
  1.1993 +	{
  1.1994 +	return iMinSizeInPixels;
  1.1995 +	}
  1.1996 + 
  1.1997 +/** Sets the name attribute.
  1.1998 +	
  1.1999 +@param aName Descriptor containing typeface name. */
  1.2000 +inline void TOpenFontFaceAttribBase::SetName(const TDesC& aName)
  1.2001 +	{
  1.2002 +	iName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength));
  1.2003 +	}
  1.2004 + 
  1.2005 +/** Sets the full name.
  1.2006 +	
  1.2007 +@param aName The full name of the typeface.
  1.2008 +@see FullName() */
  1.2009 +inline void TOpenFontFaceAttrib::SetFullName(const TDesC& aName)
  1.2010 +	{
  1.2011 +	SetName(aName);
  1.2012 +	}
  1.2013 + 
  1.2014 +/** Sets the family name.
  1.2015 +	
  1.2016 +@param aName The family name of the typeface. 
  1.2017 +@see FamilyName() */
  1.2018 +inline void TOpenFontFaceAttrib::SetFamilyName(const TDesC& aName)
  1.2019 +	{
  1.2020 +	iFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength));
  1.2021 +	}
  1.2022 + 
  1.2023 +/** Sets the local full name.
  1.2024 +	
  1.2025 +@param aName The local full name of the typeface. 
  1.2026 +@see LocalFullName() */
  1.2027 +inline void TOpenFontFaceAttrib::SetLocalFullName(const TDesC& aName)
  1.2028 +	{
  1.2029 +	iLocalFullName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength));
  1.2030 +	}
  1.2031 + 
  1.2032 +/** Sets the local family name.
  1.2033 +	
  1.2034 +@param aName The local family name of the typeface. 
  1.2035 +@see LocalFamilyName() */
  1.2036 +inline void TOpenFontFaceAttrib::SetLocalFamilyName(const TDesC& aName)
  1.2037 +	{
  1.2038 +	iLocalFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength));
  1.2039 +	}
  1.2040 +
  1.2041 +/** Sets the coverage flags.
  1.2042 +
  1.2043 +The flags are held in four 32 bit integers. Each flag that is set represents 
  1.2044 +a range of Unicode characters that is supported by the typeface: Latin, 
  1.2045 +Greek, Cyrillic etc. The mapping is defined in the TrueType documentation 
  1.2046 +under the OS/2 table.
  1.2047 +
  1.2048 +Note: Some useful subsets are defined as anonymous enumerated constants at 
  1.2049 +the end of this class, see ELatinSet etc.
  1.2050 +
  1.2051 +@param aCoverage0 The first set of coverage flags (bits 0-31).
  1.2052 +@param aCoverage1 The second set of coverage flags (bits 32-63).
  1.2053 +@param aCoverage2 The third set of coverage flags (bits 64-95). 
  1.2054 +@param aCoverage3 The fourth set of coverage flags (bits 96-127). */
  1.2055 +inline void TOpenFontFaceAttribBase::SetCoverage(TUint aCoverage0,TUint aCoverage1,TUint aCoverage2,TUint aCoverage3)
  1.2056 +	{
  1.2057 +	iCoverage[0] = aCoverage0;
  1.2058 +	iCoverage[1] = aCoverage1;
  1.2059 +	iCoverage[2] = aCoverage2;
  1.2060 +	iCoverage[3] = aCoverage3;
  1.2061 +	}
  1.2062 + 
  1.2063 +/** Set the minimum typeface size.
  1.2064 +	
  1.2065 +This is the smallest size that can be drawn legibly.
  1.2066 +	
  1.2067 +@param aSize Sets the minimum typeface size (in pixels). 
  1.2068 +@see MinSizeInPixels() */
  1.2069 +inline void TOpenFontFaceAttrib::SetMinSizeInPixels(TInt aSize)
  1.2070 +	{
  1.2071 +	iMinSizeInPixels = aSize;
  1.2072 +	}
  1.2073 + 
  1.2074 +/** Equality operator.
  1.2075 +	
  1.2076 +Compares this and another set of font attributes, including the coverage, 
  1.2077 +the family name, the local full name, the local family name, and the minimum 
  1.2078 +size in pixels.
  1.2079 +	
  1.2080 +@param aAttrib Contains the font attributes and names to compare.
  1.2081 +@return ETrue if all values are equal, EFalse if not. */
  1.2082 +inline TBool TOpenFontFaceAttrib::operator==(const TOpenFontFaceAttrib& aAttrib) const
  1.2083 +	{
  1.2084 +	return TOpenFontFaceAttribBase::operator==(aAttrib) &&
  1.2085 +		   iFamilyName == aAttrib.iFamilyName &&
  1.2086 +		   iLocalFullName == aAttrib.iLocalFullName &&
  1.2087 +		   iLocalFamilyName == aAttrib.iLocalFamilyName &&
  1.2088 +		   iMinSizeInPixels == aAttrib.iMinSizeInPixels;
  1.2089 +	}
  1.2090 +
  1.2091 +/** Sets the bold attribute.
  1.2092 +
  1.2093 +@param aBold The bold attribute takes this value: ETrue or EFalse. */
  1.2094 +inline void TOpenFontFaceAttribBase::SetBold(TBool aBold)
  1.2095 +	{
  1.2096 +	if (aBold)
  1.2097 +		iStyle |= EBold;
  1.2098 +	else
  1.2099 +		iStyle &= ~EBold;
  1.2100 +	}
  1.2101 +
  1.2102 +/** Sets the italic attribute.
  1.2103 +	
  1.2104 +@param aItalic The italic attribute takes this value   ETrue or EFalse. */
  1.2105 +inline void TOpenFontFaceAttribBase::SetItalic(TBool aItalic)
  1.2106 +	{
  1.2107 +	if (aItalic)
  1.2108 +		iStyle |= EItalic;
  1.2109 +	else
  1.2110 +		iStyle &= ~EItalic;
  1.2111 +	}
  1.2112 + 
  1.2113 +/** Sets the serif attribute.
  1.2114 +	
  1.2115 +@param aSerif The serif attribute takes this value  ETrue or EFalse. */
  1.2116 +inline void TOpenFontFaceAttribBase::SetSerif(TBool aSerif)
  1.2117 +	{
  1.2118 +	if (aSerif)
  1.2119 +		iStyle |= ESerif;
  1.2120 +	else
  1.2121 +		iStyle &= ~ESerif;
  1.2122 +	}
  1.2123 +
  1.2124 +/** Sets the mono-width attribute.
  1.2125 +
  1.2126 +@param aMonoWidth The mono-width attribute takes this value: ETrue or EFalse. */
  1.2127 +inline void TOpenFontFaceAttribBase::SetMonoWidth(TBool aMonoWidth)
  1.2128 +	{
  1.2129 +	if (aMonoWidth)
  1.2130 +		iStyle |= EMonoWidth;
  1.2131 +	else
  1.2132 +		iStyle &= ~EMonoWidth;
  1.2133 +	}
  1.2134 +
  1.2135 +/** Equality operator. 
  1.2136 +	
  1.2137 +Compares this and a specified set of font attributes, including the coverage 
  1.2138 +and the typeface name.
  1.2139 +	
  1.2140 +In version 6.1, and earlier, the return value was TInt.
  1.2141 +	
  1.2142 +@param aAttrib The font attributes to compare. This is an object of TOpenFontFaceAttribBase 
  1.2143 +or of a derived class. 
  1.2144 +@return ETrue if the values are equal. */
  1.2145 +inline TBool TOpenFontFaceAttribBase::operator==(const TOpenFontFaceAttribBase& aAttrib) const
  1.2146 +	{
  1.2147 +	return iStyle == aAttrib.iStyle &&
  1.2148 +		   iCoverage[0] == aAttrib.iCoverage[0] &&
  1.2149 +		   iCoverage[1] == aAttrib.iCoverage[1] &&
  1.2150 +		   iCoverage[2] == aAttrib.iCoverage[2] &&
  1.2151 +		   iCoverage[3] == aAttrib.iCoverage[3] &&
  1.2152 +		   iName.CompareF(aAttrib.iName) == 0;
  1.2153 +	}
  1.2154 +
  1.2155 +/** Compares this and another open font specification. Compares all the properties 
  1.2156 +of the two fonts.
  1.2157 +@publishedAll
  1.2158 +@released
  1.2159 +@param aFontSpec The open font specification to compare with this one.
  1.2160 +@return ETrue if all values are equal, EFalse if not.
  1.2161 +*/
  1.2162 +inline TBool TOpenFontSpec::operator==(const TOpenFontSpec& aOpenFontSpec) const
  1.2163 +	{
  1.2164 +	return
  1.2165 +		iHeight			== aOpenFontSpec.iHeight &&
  1.2166 +		iWidthFactor	== aOpenFontSpec.iWidthFactor &&
  1.2167 +		iSlantFactor	== aOpenFontSpec.iSlantFactor &&
  1.2168 +		iBitmapType		== aOpenFontSpec.iBitmapType &&
  1.2169 +		iEffects		== aOpenFontSpec.iEffects &&
  1.2170 +		iSymbol			== aOpenFontSpec.iSymbol &&
  1.2171 +		iPrintPosition	== aOpenFontSpec.iPrintPosition &&
  1.2172 +		TOpenFontFaceAttribBase::operator==(aOpenFontSpec);
  1.2173 +	}
  1.2174 +
  1.2175 +/** Gets the height of the font.
  1.2176 +	
  1.2177 +@return The height of the font, in pixels or twips. 
  1.2178 +@see SetHeight() */
  1.2179 +inline TInt TOpenFontSpec::Height() const
  1.2180 +	{
  1.2181 +	return iHeight;
  1.2182 +	}
  1.2183 + 
  1.2184 +/** Gets the algorithmic width factor.
  1.2185 +	
  1.2186 +@return The algorithmic width factor as a 16.16 fixed-point number.
  1.2187 +@see SetWidthFactor() */
  1.2188 +inline TInt32 TOpenFontSpec::WidthFactor() const
  1.2189 +	{
  1.2190 +	return iWidthFactor;
  1.2191 +	}
  1.2192 + 
  1.2193 +/** Gets the algorithmic slant factor.
  1.2194 +	
  1.2195 +@return The algorithmic slant factor as a 16.16 fixed-point number.
  1.2196 +@see SetSlantFactor() */
  1.2197 +inline TInt32 TOpenFontSpec::SlantFactor() const
  1.2198 +	{
  1.2199 +	return iSlantFactor;
  1.2200 +	}
  1.2201 + 
  1.2202 +/** Gets the anti-aliasing setting for the font, as set by SetBitmapType().
  1.2203 +	
  1.2204 +@return Indicates whether or not the font should be drawn using anti-aliasing. */
  1.2205 +inline TGlyphBitmapType TOpenFontSpec::BitmapType() const
  1.2206 +	{
  1.2207 +	return (TGlyphBitmapType)iBitmapType;
  1.2208 +	}
  1.2209 +
  1.2210 +/** Gets the font effects flags.
  1.2211 +Because the flags encoded in the Effects are anonymous, the return value should only
  1.2212 + be tested for the specific bits that are of interest, and never tested as a whole.
  1.2213 +@publishedAll
  1.2214 +@released
  1.2215 +@return The font effects flags.
  1.2216 +@see TOpenFontSpec::SetEffects()
  1.2217 +*/
  1.2218 +inline TUint32 TOpenFontSpec::Effects() const
  1.2219 +	{
  1.2220 +	return iEffects;
  1.2221 +	}
  1.2222 +
  1.2223 +/** Gets the print position.
  1.2224 +	
  1.2225 +@return The print position. */
  1.2226 +inline TFontPrintPosition TOpenFontSpec::PrintPosition() const
  1.2227 +	{
  1.2228 +	return iPrintPosition;
  1.2229 +	}
  1.2230 + 
  1.2231 +/** Sets the font's height.
  1.2232 +	
  1.2233 +@param aHeight The font's height, in pixels or twips.
  1.2234 +@see Height() */
  1.2235 +inline void TOpenFontSpec::SetHeight(TInt aHeight)
  1.2236 +	{
  1.2237 +	iHeight = aHeight;
  1.2238 +	}
  1.2239 +
  1.2240 +/** Sets the algorithmic width factor.
  1.2241 +	
  1.2242 +The width factor is multiplied by the pixel's x position to get the new position, 
  1.2243 +causing characters to become wider or narrower. A width factor of 1 (65536 
  1.2244 +in 16.16 fixed-point number format) should be used if the character width 
  1.2245 +is not to be changed.
  1.2246 +	
  1.2247 +@param aWidthFactor The algorithmic width factor as a 16.16 fixed-point number.
  1.2248 +@see WidthFactor() */
  1.2249 +inline void TOpenFontSpec::SetWidthFactor(TInt32 aWidthFactor)
  1.2250 +	{
  1.2251 +	iWidthFactor = aWidthFactor;
  1.2252 +	}
  1.2253 + 
  1.2254 +/** Sets the algorithmic slant factor.
  1.2255 +	
  1.2256 +Note: The slant factor is used to create an italic effect for characters which 
  1.2257 +do not have an italic glyph in the typeface. When slanting is active, pixel x 
  1.2258 +co-ordinates are shifted by a factor relative to the y co-ordinate (i.e. x 
  1.2259 += x + y x slant factor).
  1.2260 +	
  1.2261 +The slant factor is a 32 bit, 16.16 fixed-point number. This means that the 
  1.2262 +first 16 bits are treated as a whole number, and the second 16 as the fractional 
  1.2263 +part. e.g. if aSlantFactor=0, there is no slant. If aSlantFactor=65536 this 
  1.2264 +is equivalent to an integer slant value of 1, which causes a 45 degree slant 
  1.2265 +on the character.
  1.2266 +	
  1.2267 +@param aSlantFactor The slant factor as a 16.16 fixed-point number.
  1.2268 +@see SlantFactor() */
  1.2269 +inline void TOpenFontSpec::SetSlantFactor(TInt32 aSlantFactor)
  1.2270 +	{
  1.2271 +	iSlantFactor = aSlantFactor;
  1.2272 +	}
  1.2273 + 
  1.2274 +/** Sets whether the font should be drawn using anti-aliasing. If set, this value 
  1.2275 +overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType()) 
  1.2276 +for this font.
  1.2277 +	
  1.2278 +Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing 
  1.2279 +support for bitmapped fonts.
  1.2280 +	
  1.2281 +@param aBitmapType Indicates whether or not the font should be drawn using 
  1.2282 +anti-aliasing. */
  1.2283 +inline void TOpenFontSpec::SetBitmapType(TGlyphBitmapType aBitmapType)
  1.2284 +	{
  1.2285 +	iBitmapType = aBitmapType;
  1.2286 +	}
  1.2287 +
  1.2288 +/** Sets the font effects flags.
  1.2289 +Prior to calling this routine, the value from Effects() should be read,
  1.2290 + and its flags modified as required, before passing them back in.
  1.2291 +@publishedAll
  1.2292 +@released
  1.2293 +@param aEffect The font effects flags to be set.
  1.2294 +@see TOpenFontSpec::Effects()
  1.2295 +*/
  1.2296 +inline void TOpenFontSpec::SetEffects(TUint32 aEffects)
  1.2297 +	{
  1.2298 +	iEffects = aEffects;
  1.2299 +	}
  1.2300 +
  1.2301 +/** Gets the font file's UID.
  1.2302 +	
  1.2303 +@return The uid of the file. */
  1.2304 +inline TUid COpenFontFile::Uid() const
  1.2305 +	{
  1.2306 +	return iUid;
  1.2307 +	}
  1.2308 + 
  1.2309 +/** Gets the full path and filename of the font file
  1.2310 +	
  1.2311 +This is the filename that was passed to the constructor when the object is 
  1.2312 +created.
  1.2313 +	
  1.2314 +@return The filename of the font file. */
  1.2315 +inline const TDesC& COpenFontFile::FileName() const
  1.2316 +	{
  1.2317 +	return iFileName;
  1.2318 +	}
  1.2319 + 
  1.2320 +/** Gets the typeface at a specified index in the typeface attribute array.
  1.2321 +	
  1.2322 +@param aFaceIndex The index of the typeface for which the attributes are required.
  1.2323 +@return The attributes of the typeface with the specified index.
  1.2324 +@see AddFaceL()
  1.2325 +@see FaceCount() */
  1.2326 +inline const TOpenFontFaceAttrib& COpenFontFile::FaceAttrib(TInt aFaceIndex) const
  1.2327 +	{
  1.2328 +	return iFaceAttrib[aFaceIndex];
  1.2329 +	}
  1.2330 + 
  1.2331 +/** Gets the number of typefaces in the typeface attributes array.
  1.2332 +
  1.2333 +This is the number of typefaces in the font file: the attributes for each 
  1.2334 +typeface should be loaded into the array when the derived object is constructed.
  1.2335 +
  1.2336 +@return The number of typefaces in the font file.
  1.2337 +@see AddFaceL()
  1.2338 +@see FaceAttrib() */
  1.2339 +inline TInt COpenFontFile::FaceCount() const
  1.2340 +	{
  1.2341 +	return iFaceAttrib.Count();
  1.2342 +	}
  1.2343 + 
  1.2344 +/** Increments a reference count by one.
  1.2345 +	
  1.2346 +@see DecRefCount() */
  1.2347 +inline void COpenFontFile::IncRefCount()
  1.2348 +	{
  1.2349 +	iRefCount++;
  1.2350 +	}
  1.2351 + 
  1.2352 +/** Decrement a reference count by one.
  1.2353 +	
  1.2354 +@return ETrue if the reference count has reached zero (i.e. is less than or 
  1.2355 +equal to zero); EFalse if the reference count has not yet reached zero (i.e. 
  1.2356 +is positive).
  1.2357 +@see IncRefCount() */
  1.2358 +inline TBool COpenFontFile::DecRefCount()
  1.2359 +	{
  1.2360 +	iRefCount--;
  1.2361 +	return iRefCount <= 0;
  1.2362 +	}
  1.2363 + 
  1.2364 +/** Default C++ constructor. */
  1.2365 +inline COpenFontRasterizerContext::COpenFontRasterizerContext():
  1.2366 +	iGlyphData(NULL)
  1.2367 +	{
  1.2368 +	}
  1.2369 + 
  1.2370 +/** Start writing the glyph data.
  1.2371 +	
  1.2372 +Use this function to initialise the buffer to which the glyph bitmap is to 
  1.2373 +be written. Call WriteGlyphBit() to add bits to the buffer.
  1.2374 +	
  1.2375 +@param aGlyphData A pointer to the glyph data. */
  1.2376 +inline void COpenFontRasterizerContext::StartGlyph(TOpenFontGlyphData* aGlyphData)
  1.2377 +	{
  1.2378 +	aGlyphData->SetPointersToInternalBuffers();
  1.2379 +	iGlyphData = aGlyphData;
  1.2380 +	iGlyphDataStart = iGlyphDataPtr = aGlyphData->BufferStart();
  1.2381 +	// Allow 4 extra bytes; BITGDI requires this.
  1.2382 +	iGlyphDataEnd = aGlyphData->BufferEnd() - 4;
  1.2383 +	iGlyphBit = 1;
  1.2384 +	*iGlyphDataPtr = 0;
  1.2385 +	iBytesNeeded = 1;
  1.2386 +	iOverflow = FALSE;
  1.2387 +	}
  1.2388 + 
  1.2389 +/** Writes a bit to the glyph buffer.
  1.2390 +	
  1.2391 +Before calling this function you should first call StartGlyph().
  1.2392 +	
  1.2393 +@param aBit The bit to be added to the buffer. */
  1.2394 +inline void COpenFontRasterizerContext::WriteGlyphBit(TInt aBit)
  1.2395 +	{
  1.2396 +	if (aBit && !iOverflow)
  1.2397 +		*iGlyphDataPtr |= iGlyphBit;
  1.2398 +	iGlyphBit <<= 1;
  1.2399 +	if (iGlyphBit == 256)
  1.2400 +		{
  1.2401 +		iGlyphBit = 1;
  1.2402 +		iBytesNeeded++;
  1.2403 +		if (++iGlyphDataPtr < iGlyphDataEnd)
  1.2404 +			*iGlyphDataPtr = 0;
  1.2405 +		else
  1.2406 +			iOverflow = TRUE;
  1.2407 +		}
  1.2408 +	}
  1.2409 +
  1.2410 +/** Writes a byte to the glyph buffer.
  1.2411 +
  1.2412 +Before calling this function you should first call StartGlyph().
  1.2413 +
  1.2414 +@param aByte The byte to be added to the buffer. */	
  1.2415 +inline void COpenFontRasterizerContext::WriteGlyphByte(TInt aByte)
  1.2416 + 	{
  1.2417 +	if (iGlyphDataPtr < iGlyphDataEnd)
  1.2418 +		*iGlyphDataPtr++ = (TUint8)aByte;
  1.2419 +	else
  1.2420 +		iOverflow = TRUE;
  1.2421 +	iBytesNeeded++;
  1.2422 +	}
  1.2423 + 
  1.2424 +/** Completes writing glyph data.
  1.2425 +	
  1.2426 +Use this function to complete writing the glyph bitmap to the buffer. Call 
  1.2427 +it after adding all necessary bits using WriteGlyphBit(). */
  1.2428 +inline void COpenFontRasterizerContext::EndGlyph()
  1.2429 +	{
  1.2430 +	// Add 4 bytes to the data size; some BITGDI functions require this.
  1.2431 +	iGlyphData->SetBytesNeeded(iBytesNeeded + 4);
  1.2432 +	iGlyphData = NULL;
  1.2433 +	}
  1.2434 +    
  1.2435 +/** Tests whether the bitmap buffer is large enough to hold the bitmap.
  1.2436 +	
  1.2437 +@return ETrue if the bitmap will overflow its buffer, otherwise EFalse. */
  1.2438 +inline TBool TOpenFontGlyphData::Overflow() const
  1.2439 +	{
  1.2440 +	return iBytesNeeded > iBitmapBufferSize;
  1.2441 +	}
  1.2442 + 
  1.2443 +/** Gets the number of bytes needed to store the glyph bitmap.
  1.2444 +	
  1.2445 +@return The number of bytes needed to store the glyph bitmap.
  1.2446 +@see SetBytesNeeded() */
  1.2447 +inline TInt TOpenFontGlyphData::BytesNeeded() const
  1.2448 +	{
  1.2449 +	return iBytesNeeded;
  1.2450 +	}
  1.2451 + 
  1.2452 +/** Gets a constant pointer descriptor containing the bitmap this object 
  1.2453 +represents. 
  1.2454 +	
  1.2455 +@return Pointer descriptor for the glyph. */
  1.2456 +inline TPtrC8 TOpenFontGlyphData::Bitmap() const
  1.2457 +	{
  1.2458 +	return TPtrC8(iBitmap,iBytesNeeded);
  1.2459 +	}
  1.2460 + 
  1.2461 +/** Gets a pointer to the bitmap.
  1.2462 +	
  1.2463 +This points either to the buffer used to write the bitmap when it is first 
  1.2464 +rasterized, or to the cache if the character was already rasterized.
  1.2465 +	
  1.2466 +@return A pointer to the bitmap. */
  1.2467 +inline const TUint8* TOpenFontGlyphData::BitmapPointer() const
  1.2468 +	{
  1.2469 +	return iBitmap;
  1.2470 +	}
  1.2471 + 
  1.2472 +/** Gets the character's metrics.
  1.2473 +	
  1.2474 +@return The character's open font metrics. */
  1.2475 +inline const TOpenFontCharMetrics* TOpenFontGlyphData::Metrics() const
  1.2476 +	{
  1.2477 +	return iMetrics;
  1.2478 +	}
  1.2479 + 
  1.2480 +/** Gets a pointer to the start of the bitmap buffer.
  1.2481 +	
  1.2482 +@return A pointer to the start of the bitmap buffer. */
  1.2483 +inline TUint8* TOpenFontGlyphData::BufferStart()
  1.2484 +	{
  1.2485 +	return iBitmapBuffer;
  1.2486 +	}
  1.2487 + 
  1.2488 +/** Gets a pointer to the end of the bitmap buffer.
  1.2489 +	
  1.2490 +@return A pointer to the end of the bitmap buffer. */
  1.2491 +inline TUint8* TOpenFontGlyphData::BufferEnd()
  1.2492 +	{
  1.2493 +	return iBitmapBuffer + iBitmapBufferSize;
  1.2494 +	}
  1.2495 + 
  1.2496 +/** Sets the number of bytes needed to store the glyph bitmap.
  1.2497 +	
  1.2498 +@param aBytes The number of bytes needed to store the glyph bitmap.
  1.2499 +@see BytesNeeded() */
  1.2500 +inline void TOpenFontGlyphData::SetBytesNeeded(TInt aBytes)
  1.2501 +	{
  1.2502 +	iBytesNeeded = aBytes;
  1.2503 +	}
  1.2504 + 
  1.2505 +/** Sets the pointer to the bitmap buffer.
  1.2506 +	
  1.2507 +@param aBitmap The pointer to the bitmap buffer. */
  1.2508 +inline void TOpenFontGlyphData::SetBitmapPointer(const TUint8* aBitmap)
  1.2509 +	{
  1.2510 +	iBitmap = aBitmap;
  1.2511 +	}
  1.2512 + 
  1.2513 +/** Sets the character's metrics, passing a pointer to a TOpenFontCharMetrics object.
  1.2514 +	
  1.2515 +@param aMetrics A pointer to the character's open font character metrics. */
  1.2516 +inline void TOpenFontGlyphData::SetMetricsPointer(const TOpenFontCharMetrics* aMetrics)
  1.2517 +	{
  1.2518 +	iMetrics = aMetrics;
  1.2519 +	}
  1.2520 + 
  1.2521 +/** Sets the bitmap and metrics pointers to point to the internal buffers.
  1.2522 +	
  1.2523 +The alternative is that the pointers point to the cache of metrics and bitmaps 
  1.2524 +that have already been rasterized. */
  1.2525 +inline void TOpenFontGlyphData::SetPointersToInternalBuffers()
  1.2526 +	{
  1.2527 +	iBitmap = iBitmapBuffer;
  1.2528 +	iMetrics = &iMetricsBuffer;
  1.2529 +	}
  1.2530 + 
  1.2531 +/** Sets the character's metrics, passing a reference to a TOpenFontCharMetrics 
  1.2532 +object.
  1.2533 +	
  1.2534 +@param aMetrics The character's open font character metrics. */
  1.2535 +inline void TOpenFontGlyphData::SetMetrics(TOpenFontCharMetrics& aMetrics)
  1.2536 +	{
  1.2537 +	iMetricsBuffer = aMetrics;
  1.2538 +	iMetrics = &iMetricsBuffer;
  1.2539 +	}
  1.2540 + 
  1.2541 +/** Sets the glyph index.
  1.2542 +	
  1.2543 +@param aGlyphIndex The glyph index. */
  1.2544 +inline void TOpenFontGlyphData::SetGlyphIndex(TInt aGlyphIndex)
  1.2545 +	{
  1.2546 +	iGlyphIndex = aGlyphIndex;
  1.2547 +	}
  1.2548 +	
  1.2549 +/** Uses ECOM plug-in framework to instantiate the Open Font rasterizer interface 
  1.2550 +implementation given its implementation UID. 
  1.2551 +
  1.2552 +@param     "TUid aInterfaceImplUid"
  1.2553 +            The UID of the interface implementation required 
  1.2554 +
  1.2555 +@return    "COpenFontRasterizer*"
  1.2556 +            A pointer to a COpenFontRasterizer object. */
  1.2557 +inline COpenFontRasterizer* COpenFontRasterizer::NewL(TUid aInterfaceImplUid)
  1.2558 +{
  1.2559 +	return reinterpret_cast <COpenFontRasterizer*> (
  1.2560 +		REComSession::CreateImplementationL(
  1.2561 +			aInterfaceImplUid,
  1.2562 +			_FOFF(COpenFontRasterizer, iDtor_ID_Key))); 
  1.2563 +}
  1.2564 +
  1.2565 +/** Default destructor */
  1.2566 +inline COpenFontRasterizer::~COpenFontRasterizer()
  1.2567 +{
  1.2568 +	REComSession::DestroyedImplementation(iDtor_ID_Key);
  1.2569 +}
  1.2570 +
  1.2571 +/** Uses ECOM plug-in framework to instantiate the shaper factory interface 
  1.2572 +implementation given its implementation UID. 
  1.2573 +
  1.2574 +@param     "TUid aInterfaceImplUid"
  1.2575 +            The UID of the interface implementation required 
  1.2576 +
  1.2577 +@return    "CShaperFactory*"
  1.2578 +            A pointer to a CShaperFactory object. */
  1.2579 +inline CShaperFactory* CShaperFactory::NewL(TUid aInterfaceImplUid)
  1.2580 +	{
  1.2581 +	return reinterpret_cast <CShaperFactory*> (
  1.2582 +		REComSession::CreateImplementationL( 
  1.2583 +			aInterfaceImplUid,
  1.2584 +			_FOFF(CShaperFactory, iDtor_ID_Key))); 
  1.2585 +	}
  1.2586 +
  1.2587 +/** Default destructor */
  1.2588 +inline CShaperFactory::~CShaperFactory()
  1.2589 +{
  1.2590 +	REComSession::DestroyedImplementation(iDtor_ID_Key);
  1.2591 +}
  1.2592 +
  1.2593 +#endif // OPENFONT_H__