diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/openfont.h --- a/epoc32/include/openfont.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/openfont.h Wed Mar 31 12:33:34 2010 +0100 @@ -1,29 +1,39 @@ -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// 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 -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// A header for the open font system, which allows -// EPOC32 to use fonts of arbitrary types, including TrueType -// and other outline font formats. -// -// - -#ifndef OPENFONT_H__ -#define OPENFONT_H__ +/* +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* A header for the open font system, which allows SymbianOS +* to use fonts of arbitrary types, including TrueType/OpenType +* and other outline font formats. +* +*/ + + +#ifndef __OPENFONT_H__ +#define __OPENFONT_H__ #include #include #include +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#include +#include +#include +#include +#include +#endif class CFont; class COpenFontFile; @@ -48,50 +58,15 @@ class TFontShapeDeleteFunctionParameters; class RShapeInfo; class TShapeMessageParameters; -/** -The OpenFont ECOM Plug-in Interface Definition UID. - -@internalTechnology -*/ -const TInt KUidOpenFontRasterizerPlunginInterface = 0x101F7F5D; - -/** - -The Shaper Factory ECOM Plug-in Interface Definition UID. - -@internalTechnology -*/ -const TInt KUidShaperFactoryPlunginInterface = 0x10279726; - - -/** -Replacement character code. - -This is a Unicode private use area codepoint, which is reserved in the Symbian -OS to represent characters for which a glyph does not exist in a font (either -a bitmap or scalable font). If a glyph exists in a font with this character -code, it will be used for nonexistent characters, otherwise, the rasterizer's -default replacement character glyph will be used. For example, TrueType fonts -return glyph index 0 for nonexistent characters, and that is usually mapped -to an empty rectangle. -@internalTechnology -*/ -const TUint KReplacementCharacter = 0xF6DB; - -/** -KFillCharacterOffset is a significant offset that is set when a character within a code section is -not in the font. This means that for these fill characters nothing is stored within the binary -data part of the code section. -@internalTechnology -*/ -const TInt KFillCharacterOffset = 0x7FFF; +class CRasterizerLinkedTypefaceSpecification; +class TLinkedTypefaceSpecificationArgs; /** Supplied to COpenFont::ExtendedInterface() to access the extended API interface MOpenFontShapingExtension. -@see COpenFont::ExtendedInterface() -@see MOpenFontShapingExtension +@see COpenFont::ExtendedInterface() +@see MOpenFontShapingExtension @publishedAll @released */ @@ -101,27 +76,28 @@ Supplied to COpenFont::ExtendedInterface() to access the extended API interface MOpenFontTrueTypeExtension. -@see COpenFont::ExtendedInterface() -@see MOpenFontTrueTypeExtension +@see COpenFont::ExtendedInterface() +@see MOpenFontTrueTypeExtension @publishedAll @released */ const TUid KUidOpenFontTrueTypeExtension = {0x1027553E}; +const TUid KUidOpenFontGlyphOutlineExtension = {0x102872CE}; /** Supplied to CShaper::ExtendedInterface() to get the language and script code with which the current shaper is instatsiated. -@see CShaper::ExtendedInterface() +@see CShaper::ExtendedInterface() @publishedAll @released */ const TUid KUidShaperGetScript = {0x20009966}; const TUid KUidShaperGetLang = {0x20009967}; -/** +/** Font metrics. -@see CFbsFont::GetFontMetrics() +@see CFbsFont::GetFontMetrics() @publishedAll @released */ @@ -142,6 +118,9 @@ inline void SetMaxHeight(TInt aMaxHeight); inline void SetMaxDepth(TInt aMaxDepth); inline void SetMaxWidth(TInt aMaxWidth); + /** WARNING: Function for internal and partner use ONLY. Compatibility is not guaranteed in future releases.*/ + IMPORT_C void SetBaselineCorrection(TInt aBaselineCorrection); + IMPORT_C TInt BaselineCorrection(); private: TInt16 iDesignHeight; // size of the font ('pointsize' in pixels) TInt16 iAscent; // typographic ascent @@ -149,11 +128,12 @@ TInt16 iMaxHeight; // maximum height of a character; may be greater than iAscent TInt16 iMaxDepth; // maximum depth of a character; may be greater than iDescent TInt16 iMaxWidth; // maximum width of a character - TInt32 iReserved; + TInt16 iBaselineCorrection; + TInt16 iReserved; }; - -/** + +/** Character metrics includes more information than TCharacterMetrics. Character metrics allow characters to be placed horizontally or vertically. @@ -167,8 +147,8 @@ Vertical drawing (in the sense of characters drawn with horizontal baselines, but in a vertical line) is not yet supported by Symbian OS. -@see CFont::GetCharacterData() -@see CFbsFont::GetCharacterData() +@see CFont::GetCharacterData() +@see CFbsFont::GetCharacterData() @publishedAll @released */ @@ -177,10 +157,10 @@ public: enum TUninitialized { EUninitialized }; public: - /** Default constructor initializes all members to 0. */ + /** Default constructor initializes all members to 0. */ inline TOpenFontCharMetrics(); - /** Constructor that does not initialize any members. */ + /** Constructor that does not initialize any members. */ TOpenFontCharMetrics(TUninitialized) {} IMPORT_C TOpenFontCharMetrics(const TCharacterMetrics& aMetrics); IMPORT_C TBool GetTCharacterMetrics(TCharacterMetrics& aMetrics) const; @@ -202,6 +182,8 @@ inline void SetVertBearingX(TInt aVertBearingX); inline void SetVertBearingY(TInt aVertBearingY); inline void SetVertAdvance(TInt aVertAdvance); + IMPORT_C void SetGlyphType(TGlyphBitmapType); + IMPORT_C TGlyphBitmapType GlyphType() const; private: TInt16 iWidth; // width of the glyph TInt16 iHeight; // height of the glyph @@ -211,11 +193,12 @@ TInt16 iVertBearingX; // x component of vertical bearing TInt16 iVertBearingY; // y component of vertical bearing TInt16 iVertAdvance; // vertical advance - TInt32 iReserved; + TUint16 iGlyphBitmapType;// Glyph bitmap type; TGlyphBitmapType + TInt16 iReserved; }; - -/** + +/** Font glyph data. Objects of this type are used by rasterizers to supply glyph data to font @@ -225,7 +208,7 @@ The object cannot be constructed and destroyed by normal means. It resides on a specified heap. It is created by New() and deleted by RHeap::Free(). -@see COpenFont::RasterizeL() +@see COpenFont::RasterizeL() @publishedAll @released */ @@ -269,8 +252,7 @@ }; class COpenFontGlyph; -class CLinkedFontInformation; -/** +/** Open Font System font abstract base class. Derive a class from this class to represent an instance of a typeface at a @@ -294,7 +276,7 @@ Information about deriving from this class is also provided in the API guide. -@see COpenFontFile::GetNearestFontInPixelsL() +@see COpenFontFile::GetNearestFontInPixelsL() @publishedAll @released */ @@ -302,16 +284,16 @@ { public: /** Creates a bitmap for the specified Unicode character. - + Implementations of this function should put the bitmap in aGlyphData->iBitmapBuffer, and the character metrics are placed in aGlyphData->iMetricsBuffer. The other parts of aGlyphData should be left alone. - + There are a number of strategies for achieving this, e.g. pass the rasterization task all the way up to the rasterizer engine. These are discussed in the API guide. - + At present you must write the bitmap in the Symbian platform's run-length-encoded format. This is a packed binary format starting on a byte boundary and made up of a number of sections. Each section starts @@ -321,7 +303,7 @@ aGlyphData->iMetricsBuffer.Width()) follows. If the first bit of the header is 1 the next four bits are a count of non-repeating rows, again starting with the least significant bit, and that many rows of bits follow. - + @param aCode The character code of the Unicode character for which the bitmap is required. @param aGlyphData On return, contains a pointer to a TOpenFontGlyphData @@ -356,55 +338,86 @@ inline TInt FontLineGap() const; inline TInt FontMaxHeight() const; void DeleteShaper() const; + TInt GetFontTable(TUint32 aTag, TAny*& aTableContent, TInt& aLength); + TInt GetGlyphOutline(TUint aCode, TBool aHinted, TAny*& aOutline, TInt& aLength); + +protected: + /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. + */ + TInt PointerToThisOffset(const TAny* aAny); + /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. + */ + TAny* ThisOffsetToPointer(const TInt aOffset); + protected: RHeap* iHeap; TOpenFontMetrics iMetrics; private: /** The shaper for performing complex character positioning and substitution, if available. Null otherwise. - @internalComponent */ + + WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. + */ CShaper* iShaper; - + protected: /** The positive distance in pixels from the baseline to the top of an ANSI capital (whether or not there are ANSI capitals in the font) */ - TInt iFontCapitalAscent; + TInt iFontCapitalAscent; /** The positive distance in pixels from the baseline to the top of the highest pre-composed glyph in the font */ - TInt iFontMaxAscent; + TInt iFontMaxAscent; /** The positive distance in pixels from the baseline to the bottom of the lowest ANSI descender (whether or not there are ANSI chars in the font)*/ - TInt iFontStandardDescent; + TInt iFontStandardDescent; /** The positive distance in pixels from the baseline to the bottom of the lowest pre-composed glyph in the font */ - TInt iFontMaxDescent; + TInt iFontMaxDescent; /** The recommended baseline to baseline gap for successive lines of text in the font */ - TInt iFontLineGap; + TInt iFontLineGap; private: const COpenFontGlyph* Glyph(TInt aSessionHandle,TInt aCode) const; protected: - /** - @internalTechnology + + /** WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. */ - const COpenFontGlyph* FontCacheGlyph(TInt aCode,COpenFontGlyphTreeEntry**& aNode); -private: + const COpenFontGlyph* FontCacheGlyph(TInt aCode,TInt*& aNode); + const COpenFontGlyph* FontCacheGlyph(TInt aCode); + + void SetGlyphCache(COpenFontGlyphCache* aGlyphCache); + +private: const COpenFontGlyph* SessionCacheGlyph(RHeap* aHeap,TInt aSessionHandle,TInt aCode, COpenFontSessionCache*& aCache,TInt& aIndex,TBool aCreate) const; void RasterizeHelperL(TInt aCode,TOpenFontGlyphData* aGlyphData,TOpenFontGlyphData*& aTempGlyphData); + + COpenFontSessionCacheList* SessionCacheList()const; + + void SetSessionCacheList(COpenFontSessionCacheList* aSessionCacheList); + + void SetFile(COpenFontFile* aFile); private: - COpenFontFile* iFile; // the file used by this font; null if it has been deleted - // or cannot be used + + // Offset from the address of the file used by this font. + // If the file has been deleted or cannot be used, the offest will be zero. + TInt iFileOffset; + TInt iFaceIndex; // index of the face in the font file protected: - /** - @internalTechnology - */ - COpenFontGlyphCache* iGlyphCache; // the per-font glyph cache; owned by the font -private: - COpenFontSessionCacheList* iSessionCacheList; // the list of per-session glyph caches; owned by CFontStore + /** + WARNING: Compatibility is not guaranteed in future releases. Please use the provided APIs only. + Offset from the address of this font of the per-font glyph cache which is owned by the font + @internalTechnology + */ + TInt iGlyphCacheOffset; +private: + // Offset from the address of this font of the list of per-session glyph + // caches which are owned by CFontStore + TInt iSessionCacheListOffset; + TAny* iReserved; // unused; for future expansion }; @@ -417,8 +430,8 @@ COpenFont::ExtendedInterface function when KUidOpenFontShapingExtension is supplied as the UID. -@see COpenFont -@see KUidOpenFontShapingExtension +@see COpenFont +@see KUidOpenFontShapingExtension @publishedAll @released */ @@ -458,12 +471,10 @@ the unicode. For more information: - @see COpenFont::RasterizeL() - - @param aCode - The glyph code of the character for which the bitmap is required. - @param aGlyphData - The function puts its output here. + @see COpenFont::RasterizeL() + + @param aCode The glyph code of the character for which the bitmap is required. + @param aGlyphData The function puts its output here. */ virtual void RasterizeGlyphL(TInt aCode,TOpenFontGlyphData* aGlyphData) = 0; @@ -507,7 +518,7 @@ This interface should be returned by the overridden COpenFont::ExtendedInterface function when KUidOpenFontTrueTypeExtension is supplied as the UID. -@see KUidOpenFontTrueTypeExtension +@see KUidOpenFontTrueTypeExtension @publishedAll @released */ @@ -543,14 +554,20 @@ @see GetTrueTypeTable */ virtual TBool HasTrueTypeTable(TUint32 aTag) = 0; }; - + +class MOpenFontGlyphOutlineExtension + { +public: + virtual TInt GetGlyphOutline(TUint aCode, TBool aIsGlyphId, + TBool aHinted, TAny*& aOutline, TInt& aLength) = 0; + }; /** Font attribute base class. This class is not intended for user derivation. -@see TOpenFontFaceAttrib -@see TOpenFontSpec +@see TOpenFontFaceAttrib +@see TOpenFontSpec @publishedAll @released */ @@ -579,7 +596,7 @@ inline void SetMonoWidth(TBool aMonoWidth); inline TBool operator==(const TOpenFontFaceAttribBase& aAttrib) const; - // Unicode ranges for iCoverage[0] (incomplete; see the TrueType documentation for other values) + // Unicode ranges for iCoverage[0] (see the TrueType documentation for other values which are not included) enum { ELatinSet = 0x1, // 0000-007F @@ -636,13 +653,13 @@ TInt32 iReserved; }; - + /** Typeface attributes. These attributes include the name, family name, and supported scripts. -@see CFbsFont::GetFaceAttrib() +@see CFbsFont::GetFaceAttrib() @publishedAll @released */ @@ -673,8 +690,8 @@ TInt32 iReserved2; }; - -/** + +/** Font specification allowing more attributes to be specified than TFontSpec. In addition to the attributes specified by TFontSpec, this font specification @@ -718,12 +735,16 @@ IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const; IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage); IMPORT_C TInt ScriptTypeForMetrics() const; - static TBool IsCompensationForAspectRatioNeeded(TInt aPixelWidth, TInt aPixelHeight, TReal& aRatio); + static TBool IsCompensationForAspectRatioNeeded(TInt aPixelWidth, TInt aPixelHeight); + static TInt ApplyRatio(TInt& aValue,TInt aNumerator,TInt aDenominator); + static TInt ApplyRatio(TInt32& aValue,TInt aNumerator,TInt aDenominator); public: /** Algorithmic effects flags. - These can be combined using an OR operation. - @publishedPartner For use by system/UI software. + These can be combined using an OR operation. + + WARNING: Enum for internal and partner use ONLY. Compatibility is not guaranteed in future releases. + @deprecated Use FontEffect::TEffect instead. */ enum @@ -756,24 +777,6 @@ }; /** -Constants for attachment points for diacritics. -@internalComponent -*/ -enum TOpenFontAttachment - { - EBaselineLeft, - EBaselineRight, - ETopLeft, - ETopCenter, - ETopRight, - EBottomLeft, - EBottomCenter, - EBottomRight - }; - - - -/** Font file abstract base class. Write a class derived from COpenFontFile to manage a file with the font format @@ -806,8 +809,8 @@ these functions is provided in the definitions below. Information about deriving from this class is also provided in the API guide. -@see COpenFontRasterizer::NewFontFileL() -@see CWsScreenDevice::AddFile() +@see COpenFontRasterizer::NewFontFileL() +@see CWsScreenDevice::AddFile() @publishedAll @released */ @@ -828,21 +831,19 @@ Implementations may use the utility function GetNearestFontHelper() to get the attributes of the closest matching font. - @param aHeap Shared heap. This value should be passed to the COpenFont derived - classes' constructor. - @param aSessionCacheList The session cache list. This value should be passed - to the COpenFont derived classes' constructor. - @param aDesiredFontSpec The desired font specification. - @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating - the algorithmic slant of the typeface. - @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating - the algorithmic slant of the typeface. - @param aFont On return, contains a pointer to the newly created COpenFont - derived object, or NULL if no font matching aDesiredFontSpec exists. - @param aActualFontSpec The actual font specification of the font retrieved - into aFont. - @publishedAll - @see GetNearestFontHelper() + @param aHeap Shared heap. This value should be passed to the + COpenFont derived classes' constructor. + @param aSessionCacheList The session cache list. This value should be passed + to the COpenFont derived classes' constructor. + @param aDesiredFontSpec The desired font specification. + @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating + the algorithmic slant of the typeface. + @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating + the algorithmic slant of the typeface. + @param aFont On return, contains a pointer to the newly created COpenFont + derived object, or NULL if no font matching aDesiredFontSpec exists. + @param aActualFontSpec The actual font specification of the font retrieved into aFont. + @see GetNearestFontHelper() */ virtual void GetNearestFontInPixelsL( RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList, @@ -863,21 +864,19 @@ Implementations may use the utility function GetNearestFontHelper() to get the attributes of the closest matching font. - @param aHeap Shared heap. This value should be passed to the COpenFont derived - classes' constructor. - @param aSessionCacheList The session cache list. This value should be passed - to the COpenFont derived classes' constructor. - @param aDesiredFontSpec The desired font specification. - @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating - the algorithmic slant of the typeface. - @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating - the algorithmic slant of the typeface. - @param aFont On return, contains a pointer to the newly created COpenFont - derived object, or NULL if no font matching aDesiredFontSpec exists. - @param aActualFontSpec The actual font specification of the font retrieved - into aFont. - @publishedAll - @see GetNearestFontHelper() + @param aHeap Shared heap. This value should be passed to the COpenFont + derived classes' constructor. + @param aSessionCacheList The session cache list. This value should be passed + to the COpenFont derived classes' constructor. + @param aDesiredFontSpec The desired font specification. + @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating + the algorithmic slant of the typeface. + @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating + the algorithmic slant of the typeface. + @param aFont On return, contains a pointer to the newly created COpenFont + derived object, or NULL if no font matching aDesiredFontSpec exists. + @param aActualFontSpec The actual font specification of the font retrieved into aFont. + @see GetNearestFontHelper() */ virtual void GetNearestFontToDesignHeightInPixelsL( RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/, @@ -897,22 +896,20 @@ Implementations may use the utility function GetNearestFontHelper() to get the attributes of the closest matching font. - @param aHeap Shared heap. This value should be passed to the COpenFont derived - classes' constructor. - @param aSessionCacheList The session cache list. This value should be passed - to the COpenFont derived classes' constructor. - @param aDesiredFontSpec The desired font specification. - @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating - the algorithmic slant of the typeface. - @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating - the algorithmic slant of the typeface. - @param aFont On return, contains a pointer to the newly created COpenFont - derived object, or NULL if no font matching aDesiredFontSpec exists. - @param aActualFontSpec The actual font specification of the font retrieved - into aFont. - @param aMaxHeight The maximum height within which the font must fit. - @publishedAll - @see GetNearestFontHelper() + @param aHeap Shared heap. This value should be passed to the COpenFont + derived classes' constructor. + @param aSessionCacheList The session cache list. This value should be passed + to the COpenFont derived classes' constructor. + @param aDesiredFontSpec The desired font specification. + @param aPixelWidth The width of a pixel. Used with aPixelHeight for calculating + the algorithmic slant of the typeface. + @param aPixelHeight The height of a pixel. Used with aPixelWidth for calculating + the algorithmic slant of the typeface. + @param aFont On return, contains a pointer to the newly created COpenFont + derived object, or NULL if no font matching aDesiredFontSpec exists. + @param aActualFontSpec The actual font specification of the font retrieved into aFont. + @param aMaxHeight The maximum height (vertical extent) within which the font must fit. + @see GetNearestFontHelper() */ virtual void GetNearestFontToMaxHeightInPixelsL( RHeap* /*aHeap*/, COpenFontSessionCacheList* /*aSessionCacheList*/, @@ -920,10 +917,10 @@ COpenFont*& /*aFont*/, TOpenFontSpec& /*aActualFontSpec*/, TInt /*aMaxHeight*/) {} /** Tests whether a specified typeface contains a particular character. - - @param aFaceIndex The index of the typeface to be tested. - @param aCode The Unicode character code for the character to be tested. - @return ETrue if the typeface contains aCode, otherwise EFalse. */ + + @param aFaceIndex The index of the typeface to be tested. + @param aCode The Unicode character code for the character to be tested. + @return ETrue if the typeface contains aCode, otherwise EFalse. */ virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const = 0; IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam); IMPORT_C COpenFontFile(TInt aUid,const TDesC& aFileName); @@ -960,7 +957,7 @@ // A class to contain the public font attributes and private positioning information (for kerning, ligatures, etc.) class TAttrib: public TOpenFontFaceAttrib { - public: + public: COpenFontPositioner* iPositioner; // if non-null, positioning information for the typeface }; static TInt ScoreByName(const TOpenFontSpec& aDesiredFontSpec, const TAttrib& aAttrib); @@ -983,80 +980,7 @@ TOpenFontFileData* iData; }; - -/** -The Open Font rasterizer plug-in Interface Definition class. - -This interface allows the implementation of an Open Font rasterizer plug-in, -which can then be dynamically loaded at run time by the ECOM plug-in framework. -The plug-in implementation is instantiated by calling NewL(), passing the implementation -UID so that ECOM can instantiate the correct implementation. - -The rasterizer interface declares a single pure virtual functions, which the -plug-in derived from this interface must implement. The function reads font files, and creates -a COpenFontFile object if the font file is of the right type. - -Writing derived classes: - -Open font rasterizers should derive from this class and implement the -NewFontFileL() function. - -Derived classes should also define the factory function. It is a static function -which takes no arguments. It creates a COpenFontRasterizer derived object on the heap, and returns it -to the caller. This factory function, together with the implementation UID will form -the TImplementationProxy used by the ECOM framework to instatiate the plug-in. - -The rasterizer class may also need to store an 'engine context'. This is an -object derived from COpenFontRasterizerContext, which provides functions that -make it easier to write the glyph bitmap during rasterization. - - -@publishedAll -@released -*/ -class COpenFontRasterizer: public CBase - { -public: - /** Creates a COpenFontFile derived object for loading font files in the - new format. - - This function is called by the framework during font and bitmap server - startup. It creates a font file object for font files in the \\resource\\fonts - directory on all drives, using the default search path. The first font of - a given name overrides subsequent ones. The directory search path is soft - to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added - dynamically after startup using CWsScreenDevice::AddFile(), which - indirectly calls this function. - - Implementations of this function should examine the file aFileName, and if - it is of the correct type attempt to create a COpenFontFile derived object - to load it. The caller is responsible for deleting the object. The function - must return NULL if it cannot recognise the file, and it may also leave if - there is an error. - - @param aUid An ID to be used for the file. UIDs are required by the font - framework, so the font store allocates them for non Symbian OS-native font - files. This ID persists until the font is unloaded, e.g. if the device is - rebooted. - @param aFileName The full path and filename of the file from which the - COpenFontFile object is created, if the file is the correct type. - @param aFileSession The file session owned by the Font and Bitmap server. - This file session should be used for any file access. If COpenFontFile - objects need to keep files open, aFileSession should be stored in a place - that is accessible to them. - @return A pointer to a new COpenFontFile derived object, or NULL if the - file type is not recognised. - @see CWsScreenDevice::AddFile() */ - virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession) = 0; - inline static COpenFontRasterizer* NewL(TUid aInterfaceImplUid); - inline virtual ~COpenFontRasterizer(); - IMPORT_C virtual void Reserved(); // unused; for future expansion -private: - TUid iDtor_ID_Key;//ECOM identifier used during destruction - }; - - -/** +/** Convenience class from which rasterizer contexts may be derived. A rasterizer context object may (optionally) be created to provide the link @@ -1091,8 +1015,10 @@ /** - Shaper abstract class. All shaper implementations derive from this - @publishedAll */ +Shaper abstract class. All shaper implementations derive from this +@publishedAll +@released +*/ class CShaper : public CBase { public: @@ -1127,67 +1053,65 @@ IMPORT_C virtual ~CShaper(); /** construct a shaper object - @param aBitmapFont The font to be shaped. - @param aHeap The heap to be used by the shaper. - @return KErrNone if this font can be shaper or system wide error code*/ + @param aBitmapFont The font to be shaped. + @param aHeap The heap to be used by the shaper. + @return KErrNone if this font can be shaper or system wide error code*/ virtual TInt ConstructL(CBitmapFont* aBitmapFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0; - /** If possible, shape the text described by aInput, placing the - output on aHeapForOutput. - @param aOutput The output, as a newly allocate object on - aHeapForOutput. - @param aInput The input text and other parameters. - @param aHeapForOutput. On success, aOutput should be allocated from - this and nothing else. On failure, nothing should be allocated from - it. - @return Error value from one of the system-wide error codes on - failure, KErrNone on success. - @see TShapeHeader */ + /** If possible, shape the text described by aInput, placing the output on aHeapForOutput. + @param aOutput The output, as a newly allocate object on aHeapForOutput. + @param aInput The input text and other parameters. + @param aHeapForOutput On success, aOutput should be allocated from this and nothing else. + On failure, nothing should be allocated from it. + @return Error value from one of the system-wide error codes on failure, KErrNone on success. + @see TShapeHeader */ virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput) = 0; /** For future expansion. Any overriders must base-call if aInterface is unrecognized. - @param aInterfaceId The ID of the interface to return. - @return A pointer to the extension interface. - @internalComponent + + WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. + + @param aInterfaceId The ID of the interface to return. + @return A pointer to the extension interface. */ - - IMPORT_C virtual void* ExtendedInterface(TUid aInterfaceId); + IMPORT_C virtual void* ExtendedInterface(TUid aInterfaceId); }; /** ECOM plug-in base class for shaper factories. -@publishedAll */ +@publishedAll +@released +*/ class CShaperFactory : public CBase { public: /** Create a shaper if possible, for typeface aFaceIndex within file aFileName. - @param aFont The font to be shaped. - @param iHeap The heap to use for constructing the shaper. - @return 0 If the font is not understood or inappropriate for - any shaper that might be constructed by this class, otherwise - returns the newly-constructed shaper on iHeap. */ + @param aFont The font to be shaped. + @param iHeap The heap to use for constructing the shaper. + @return 0 If the font is not understood or inappropriate for any shaper that might be constructed + by this class, otherwise returns the newly-constructed shaper on iHeap. */ virtual CShaper* NewShaperL(CBitmapFont* aFont, TInt aScript, TInt aLanguage, RHeap* iHeap) = 0; inline static CShaperFactory* NewL(TUid aInterfaceImplUid); inline virtual ~CShaperFactory(); - /** For future expansion. Any overriders must base-call - if aInterface is unrecognized. - @param aInterfaceId The ID of the interface to return. - @return A pointer to the extension interface. - @internalComponent + /** For future expansion. Any overriders must base-call if aInterface is unrecognized. + + WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. + + @param aInterfaceId The ID of the interface to return. + @return A pointer to the extension interface. */ virtual void* ExtendedInterface(TUid aInterfaceId); private: TUid iDtor_ID_Key;//ECOM identifier used during destruction }; - // Inline functions start here. /** Default C++ constructor. - + This creates then zero fills the object. */ inline TOpenFontMetrics::TOpenFontMetrics() { @@ -1195,16 +1119,16 @@ } /** Gets the font's size. - -@return The font's size. -@see SetSize() */ + +@return The font's size. +@see SetSize() */ inline TInt TOpenFontMetrics::Size() const { return iDesignHeight; } - + /** Gets the font's ascent. - + This is the ascent for the Latin character which is highest above the baseline. @return The font's ascent, in pixels. @@ -1215,32 +1139,32 @@ } /** Gets the font's descent. - + This is the descent for the Latin character in the font which falls furthest below the baseline. - + @return The font's descent, in pixels. @see SetDescent() */ inline TInt TOpenFontMetrics::Descent() const { return iDescent; } - + /** Sets the font's maximum height. Note that if this object was initialised from the CFont this will be the same as the ascent. This is the ascent for the character which is highest above the baseline. -In many fonts this will be the height of an accented character like Â, +In many fonts this will be the height of an accented character like Â, including the accent. - + @return The maximum height of the font, in pixels. @see SetMaxDepth() */ inline TInt TOpenFontMetrics::MaxHeight() const { return iMaxHeight; } - + /** Gets the font's maximum depth. Note: If this object was initialised from the CFont this will be the same as the @@ -1248,25 +1172,25 @@ This is the descent for the character in the font which falls furthest below the baseline. - + @return The font's maximum depth. @see SetMaxDepth() */ inline TInt TOpenFontMetrics::MaxDepth() const { return iMaxDepth; } - + /** Gets the maximum character width, in pixels. - + @return The maximum character width, in pixels. @see SetMaxWidth() */ inline TInt TOpenFontMetrics::MaxWidth() const { return iMaxWidth; } - + /** Sets the font's size. - + @param aSize The font's size. @see Size() */ inline void TOpenFontMetrics::SetSize(TInt aSize) @@ -1275,7 +1199,7 @@ } /** Sets the ascent. - + @param aAscent The ascent, in pixels. @see Ascent() */ inline void TOpenFontMetrics::SetAscent(TInt aAscent) @@ -1284,96 +1208,96 @@ } /** Sets the descent. - + @param aDescent The descent, in pixels. @see Descent() */ inline void TOpenFontMetrics::SetDescent(TInt aDescent) { iDescent = static_cast(aDescent); } - + /** Sets the font's maximum height. - + @param aMaxHeight The font's maximum height, in pixels. @see MaxHeight() */ inline void TOpenFontMetrics::SetMaxHeight(TInt aMaxHeight) { iMaxHeight = static_cast(aMaxHeight); } - + /** Sets the font's maximum depth. - + @param aMaxDepth The font's maximum depth, in pixels. @see MaxDepth() */ inline void TOpenFontMetrics::SetMaxDepth(TInt aMaxDepth) { iMaxDepth = static_cast(aMaxDepth); } - + /** Sets the maximum character width, in pixels. - + @param aMaxWidth The maximum character width, in pixels. @see MaxWidth() */ inline void TOpenFontMetrics::SetMaxWidth(TInt aMaxWidth) { iMaxWidth = static_cast(aMaxWidth); } - + /** Default C++ constructor. - + The constructor initialises all data members to zero. As for other T classes, there is no need to explicitly cleanup TOpenFontCharMetrics objects. */ inline TOpenFontCharMetrics::TOpenFontCharMetrics() { Mem::FillZ(this,sizeof(*this)); } - + /** Gets the width of the character's bitmap. - + @return The width of the bitmap in pixels. */ inline TInt TOpenFontCharMetrics::Width() const { return iWidth; } - + /** Gets the height of the character's bitmap. - + @return The character's height in pixels. */ inline TInt TOpenFontCharMetrics::Height() const { return iHeight; } - + /** Gets the horizontal bearing X. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the left edge of the bitmap, when drawing horizontally. A positive value means that the left edge of the bitmap is right of the origin. - + @return The horizontal bearing X in pixels */ inline TInt TOpenFontCharMetrics::HorizBearingX() const { return iHorizBearingX; } - + /** Gets horizontal bearing Y. - + This is the vertical distance in pixels from the pen point before the character is drawn (the origin) to the top edge of the bitmap, when drawing horizontally. A positive value means that the top edge of the bitmap is above the origin - + @return The horizontal bearing Y in pixels. */ inline TInt TOpenFontCharMetrics::HorizBearingY() const { return iHorizBearingY; } - + /** Gets the horizontal advance. - + This is the amount added to the x co-ordinate of the origin after the character is drawn what most people understand by the width or escapement of a character. The origin here is the pen point before the character is drawn. - + @return The horizontal advance in pixels */ inline TInt TOpenFontCharMetrics::HorizAdvance() const { @@ -1381,47 +1305,47 @@ } /** Gets the vertical bearing X. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the left edge of the bitmap, when drawing vertically. A positive value means that the left edge of the bitmap is right of the origin. - + @return The vertical bearing X in pixels. */ inline TInt TOpenFontCharMetrics::VertBearingX() const { return iVertBearingX; } - + /** Gets the vertical bearing Y. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the top edge of the bitmap, when drawing vertically. A positive value means that the top edge of the bitmap is above the origin. - + @return The vertical bearing Y in pixels. */ inline TInt TOpenFontCharMetrics::VertBearingY() const { return iVertBearingY; } - + /** Gets the vertical advance. - + When drawing vertically, this is the amount added to the y co-ordinate of the origin after the character is drawn what most people understand by the height of a character. The origin here is the pen point before the character is drawn. - + Note: Vertical drawing is not supported in v5. - + @return The vertical advance in pixels. */ inline TInt TOpenFontCharMetrics::VertAdvance() const { return iVertAdvance; } - + /** Gets the bounds of the character relative to its origin when setting text horizontally. - + The origin here is the pen point before the character is drawn. @param aBounds The character's bounds. */ @@ -1432,12 +1356,12 @@ aBounds.iBr.iX = aBounds.iTl.iX + iWidth; aBounds.iBr.iY = aBounds.iTl.iY + iHeight; } - + /** Gets the bounds of the character relative to its origin when setting text vertically. - + The origin here is the pen point before the character is drawn. - + @param aBounds The character's bounds. */ inline void TOpenFontCharMetrics::GetVertBounds(TRect& aBounds) const { @@ -1446,100 +1370,100 @@ aBounds.iBr.iX = aBounds.iTl.iX + iWidth; aBounds.iBr.iY = aBounds.iTl.iY + iHeight; } - + /** Sets the width of the character's bitmap. - + @param aWidth The width of the bitmap in pixels. */ inline void TOpenFontCharMetrics::SetWidth(TInt aWidth) { iWidth = (TInt16)aWidth; } - + /** Sets the height of the character's bitmap. - + @param aHeight The character height (in pixels). */ inline void TOpenFontCharMetrics::SetHeight(TInt aHeight) { iHeight = (TInt16)aHeight; } - + /** Sets the horizontal bearing X. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the left edge of the bitmap, when drawing horizontally. A positive value means that the left edge of the bitmap is right of the origin. - + @param aHorizBearingX The horizontal bearing X (in pixels). */ inline void TOpenFontCharMetrics::SetHorizBearingX(TInt aHorizBearingX) { iHorizBearingX = (TInt16)aHorizBearingX; } - + /** Sets the horizontal bearing Y. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the top edge of the bitmap, when drawing horizontally. A positive value means that the top edge of the bitmap is above the origin. - + @param aHorizBearingY The horizontal bearing Y (in pixels). */ inline void TOpenFontCharMetrics::SetHorizBearingY(TInt aHorizBearingY) { iHorizBearingY = (TInt16)aHorizBearingY; } - + /** Sets the horizontal advance. - + This is the amount added to the x co-ordinate of the origin after the character is drawn, what most people understand by the width or escapement of a character. The origin here is the pen point before the character is drawn. - + @param aHorizAdvance The horizontal advance (in pixels). */ inline void TOpenFontCharMetrics::SetHorizAdvance(TInt aHorizAdvance) { iHorizAdvance = (TInt16)aHorizAdvance; } - + /** Set vertical bearing X. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the left edge of the bitmap, when drawing vertically. A positive value means that the left edge of the bitmap is right of the origin. - + @param aVertBearingX The vertical bearing X (in pixels). */ inline void TOpenFontCharMetrics::SetVertBearingX(TInt aVertBearingX) { iVertBearingX = (TInt16)aVertBearingX; } - + /** Sets the vertical bearing Y. - + This is the distance in pixels from the pen point before the character is drawn (the origin) to the top edge of the bitmap, when drawing vertically. A positive value means that the top edge of the bitmap is above the origin. - + @param aVertBearingY The vertical bearing Y (in pixels). */ inline void TOpenFontCharMetrics::SetVertBearingY(TInt aVertBearingY) { iVertBearingY = (TInt16)aVertBearingY; } - + /** Sets the vertical advance. - + When drawing vertically, this is the amount added to the y co-ordinate of the origin after the character is drawn what most people understand by the height of a character. The origin here is the pen point before the character is drawn. - + Note: Vertical drawing is not supported in v5. - + @param aVertAdvance The vertical advance (in pixels). */ inline void TOpenFontCharMetrics::SetVertAdvance(TInt aVertAdvance) { iVertAdvance = (TInt16)aVertAdvance; } - + /** Gets the character metrics for this font. - + @return The character metrics for this font. */ inline const TOpenFontMetrics& COpenFont::Metrics() const { @@ -1547,56 +1471,56 @@ } /** Gets the glyph index. - + This is the index of a particular glyph within the font file. - + Note: This makes it possible to gain access to glyphs which are not referenced by the Unicode character set. However, this feature is not yet supported by Symbian OS. - + @return The glyph index. @see SetGlyphIndex() */ inline TInt TOpenFontGlyphData::GlyphIndex() const { return iGlyphIndex; } - + /** Gets the typeface attributes. - + These are the attributes of the font represented by this object. - + @return The typeface attributes. */ inline const TOpenFontFaceAttrib* COpenFont::FaceAttrib() const { - return iFile ? &iFile->FaceAttrib(iFaceIndex) : NULL; + return iFileOffset == 0 ? NULL : &File()->FaceAttrib(iFaceIndex); } - + /** Gets a pointer to the COpenFontFile which created this object. - + This is the COpenFontFile which owns the file that contains the definition of the typeface. It can be used to get information about the typeface, or to access the rasterizer context (engine). - + @return The COpenFontFile which created this object. */ inline COpenFontFile* COpenFont::File() const { - return iFile; + return iFileOffset == 0 ? NULL : reinterpret_cast(const_cast(PtrAdd(this, iFileOffset))); } - + /** Gets the index of this typeface within the font file. - + @return The index of this typeface within the font file. */ inline TInt COpenFont::FaceIndex() const { return iFaceIndex; } - + /** Tests whether or not a character needs to be rasterized. - + Characters that have been rasterized are cached there is no need to regenerate the character bitmap. This function should only be called by the Font and Bitmap server. - + @param aSessionHandle A handle to the font and bitmap server session. @param aCode The code for the Unicode character. @return ETrue if the character needs to be rasterized, otherwise EFalse. */ @@ -1702,16 +1626,16 @@ } /** Default C++ constructor. - + This sets all attribute fields to zero. As for other T classes, there is no need to explicitly clean-up objects derived from this class. */ inline TOpenFontFaceAttribBase::TOpenFontFaceAttribBase() { Mem::FillZ(this,sizeof(*this)); } - + /** Default C++ constructor. - + The function initialises the minimum typeface size to zero, the names to NULL, and the coverage and style flags to zero. */ inline TOpenFontFaceAttrib::TOpenFontFaceAttrib(): @@ -1719,195 +1643,195 @@ iReserved2(0) { } - + /** Tests for support of Latin characters. - + Note: A return value of ETrue implies that the font has a usable set of characters. It does not imply exhaustive coverage. - + @return ETrue if Latin characters are supported */ inline TBool TOpenFontFaceAttribBase::HasLatin() const { return iCoverage[0] & ELatinSet; } - + /** Tests for support of Greek characters. - + Note: A return value of ETrue implies that the font has a usable set of characters. It does not imply exhaustive coverage. - + @return ETrue if Greek characters are supported. */ inline TBool TOpenFontFaceAttribBase::HasGreek() const { return iCoverage[0] & EGreekSet; } - + /** Tests for support of Cyrillic characters. - + Note: A return value of ETrue implies that the font has a usable set of characters. It does not imply exhaustive coverage. - + @return ETrue if Cyrillic characters are supported. */ inline TBool TOpenFontFaceAttribBase::HasCyrillic() const { return iCoverage[0] & ECyrillicSet; } - + /** Tests for support of Japanese syllabic characters. - + This function tests for the presence of Hiragana and Katakana syllabic characters in the font, collectively called kana. These characters are not sufficient for the Japanese language, which also makes use of Chinese characters. - + Note: A return value of ETrue implies that the font has a usable set of characters. It does not imply exhaustive coverage. - + @return ETrue if Japanese characters are supported @see HasCJK() */ inline TBool TOpenFontFaceAttribBase::HasKana() const { return iCoverage[1] & EKanaSets; } - + /** Tests for support of Korean Hangul characters. - + Korean may also make use of Chinese characters. - + Note: A return value of ETrue implies that the font has a usable set of characters. It does not imply exhaustive coverage. - + @return ETrue if Korean characters are supported @see HasCJK() */ inline TBool TOpenFontFaceAttribBase::HasHangul() const { return iCoverage[1] & EHangulSet; } - + /** Tests for support of Chinese ideographic characters. - + These are used in Chinese, Japanese and Korean. - + Note: A return value of ETrue implies that the font has a usable set of characters. It does not imply exhaustive coverage. - + @return ETrue if Chinese ideographs are supported. */ inline TBool TOpenFontFaceAttribBase::HasCJK() const { return iCoverage[1] & ECJKSet; } - + /** Tests if the typeface contains symbols only. - + @return ETrue if the typeface contains symbols only. */ inline TBool TOpenFontFaceAttribBase::IsSymbol() const { return iCoverage[0] == 0 && iCoverage[2] == 0 && iCoverage[3] == 0 && iCoverage[1] & ESymbolSets && !(iCoverage[1] & ~ESymbolSets); } - + /** Tests if the typeface is inherently bold. - + @return ETrue if the typeface is inherently bold. */ inline TBool TOpenFontFaceAttribBase::IsBold() const { return iStyle & EBold; } - + /** Tests if the typeface is inherently italic. - + @return ETrue if the typeface is inherently italic. */ inline TBool TOpenFontFaceAttribBase::IsItalic() const { return iStyle & EItalic; } - + /** Tests if the typeface has serifs. - + @return ETrue if the typeface has serifs. */ inline TBool TOpenFontFaceAttribBase::IsSerif() const { return iStyle & ESerif; } - + /** Tests if all the characters have the same width. - + @return ETrue if all the characters have the same width. */ inline TBool TOpenFontFaceAttribBase::IsMonoWidth() const { return iStyle & EMonoWidth; } - + /** Gets the typeface's name. - + @return Descriptor containing typeface name. */ inline TPtrC TOpenFontFaceAttribBase::Name() const { return iName; } - + /** Gets the full name. - + The full name of the typeface includes style attributes like Italic, Bold, and Cursive. - + @return The full name of the typeface. @see FamilyName() */ inline TPtrC TOpenFontFaceAttrib::FullName() const { return Name(); } - + /** Gets the family name. - + Note: The family name of the typeface does not include style attributes like "Italic". - + @return The family name of the typeface. @see FullName() */ inline TPtrC TOpenFontFaceAttrib::FamilyName() const { return iFamilyName; } - + /** Gets the local full name. - + The local full name of the typeface includes style attributes like Italic, Bold, and Cursive. - + The local name of the typeface is the name in the language of the current locale, where this is provided by the font file. If the local name is not available then the local name will be the same as the ordinary name. - + @return The local full name of the typeface. */ inline TPtrC TOpenFontFaceAttrib::LocalFullName() const { return iLocalFullName; } - + /** Gets the local family name. - + The local name of the typeface is the name in the language of the current locale, where this is provided by the font file. If the local name is not available then the local name will be the same as the ordinary name. - + Note: The family name of the typeface does not include style attributes like 'Italic'. - + @return The local family name of the typeface. */ inline TPtrC TOpenFontFaceAttrib::LocalFamilyName() const { return iLocalFamilyName; } - + /** Gets the short full name. - + This is the full name of the typeface, truncated to KMaxTypefaceNameLength, if necessary. - + Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters where necessary so that they can be used in the TTypeFace class. The Open Font Framework allows 32 characters as a maximum name length. - + @return The short full name of the typeface. @see FullName() */ inline TPtrC TOpenFontFaceAttrib::ShortFullName() const @@ -1915,62 +1839,62 @@ // Can't use TDesC::Left for this because it panics if the desired length is > the existing length! return TPtrC(iName.Ptr(),Min(iName.Length(),KMaxTypefaceNameLength)); } - + /** Gets the short family name. - + This is the family name, truncated to KMaxTypefaceNameLength, if necessary. - + Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters where necessary so that they can be used in the TTypeFace class. The Open Font Framework allows 32 characters as a maximum name length. - + @return The short family name of the typeface. @see FamilyName() */ inline TPtrC TOpenFontFaceAttrib::ShortFamilyName() const { return TPtrC(iFamilyName.Ptr(),Min(iFamilyName.Length(),KMaxTypefaceNameLength)); } - + /** Gets the short local full name. - + This is the local full name of the typeface, truncated to KMaxTypefaceNameLength, if necessary. - + Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters where necessary so that they can be used in the TTypeFace class. The Open Font Framework allows 32 characters as a maximum name length. - + @return The short local full name of the typeface. @see LocalFullName() */ inline TPtrC TOpenFontFaceAttrib::ShortLocalFullName() const { return TPtrC(iLocalFullName.Ptr(),Min(iLocalFullName.Length(),KMaxTypefaceNameLength)); } - + /** Gets the short local family name. - + This is the local family name of the typeface, truncated to KMaxTypefaceNameLength, if necessary. - + Note: Short names are names truncated to KMaxTypefaceNameLength (24) characters where necessary so that they can be used in the TTypeFace class. The Open Font Framework allows 32 characters as a maximum name length. - + @return The short local family name of the typeface. @see LocalFamilyName() */ inline TPtrC TOpenFontFaceAttrib::ShortLocalFamilyName() const { return TPtrC(iLocalFamilyName.Ptr(),Min(iLocalFamilyName.Length(),KMaxTypefaceNameLength)); } - + /** Gets a pointer to the sets of flags that indicate the font's Unicode coverage. - + Each flag that is set represents a supported Unicode range. The mapping is defined in the TrueType documentation under the OS/2 table. - + Note: Some useful subsets are defined as anonymous enumerated constants at the end of this class, see ELatinSet etc. - + @return A pointer to the flags that indicate the font's Unicode coverage. The flags are stored in an array of four 32-bit integers. When no information is available, all four integers are zero. @@ -1979,54 +1903,54 @@ { return iCoverage; } - + /** Gets the minimum typeface size. - + This is the smallest size that can be drawn legibly. - + @return The minimum typeface size (in pixels). */ inline TInt TOpenFontFaceAttrib::MinSizeInPixels() const { return iMinSizeInPixels; } - + /** Sets the name attribute. - + @param aName Descriptor containing typeface name. */ inline void TOpenFontFaceAttribBase::SetName(const TDesC& aName) { iName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); } - + /** Sets the full name. - + @param aName The full name of the typeface. @see FullName() */ inline void TOpenFontFaceAttrib::SetFullName(const TDesC& aName) { SetName(aName); } - + /** Sets the family name. - + @param aName The family name of the typeface. @see FamilyName() */ inline void TOpenFontFaceAttrib::SetFamilyName(const TDesC& aName) { iFamilyName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); } - + /** Sets the local full name. - + @param aName The local full name of the typeface. @see LocalFullName() */ inline void TOpenFontFaceAttrib::SetLocalFullName(const TDesC& aName) { iLocalFullName = TPtrC(aName.Ptr(),Min(aName.Length(),(TInt)ENameLength)); } - + /** Sets the local family name. - + @param aName The local family name of the typeface. @see LocalFamilyName() */ inline void TOpenFontFaceAttrib::SetLocalFamilyName(const TDesC& aName) @@ -2055,24 +1979,24 @@ iCoverage[2] = aCoverage2; iCoverage[3] = aCoverage3; } - + /** Set the minimum typeface size. - + This is the smallest size that can be drawn legibly. - + @param aSize Sets the minimum typeface size (in pixels). @see MinSizeInPixels() */ inline void TOpenFontFaceAttrib::SetMinSizeInPixels(TInt aSize) { iMinSizeInPixels = aSize; } - + /** Equality operator. - + Compares this and another set of font attributes, including the coverage, the family name, the local full name, the local family name, and the minimum size in pixels. - + @param aAttrib Contains the font attributes and names to compare. @return ETrue if all values are equal, EFalse if not. */ inline TBool TOpenFontFaceAttrib::operator==(const TOpenFontFaceAttrib& aAttrib) const @@ -2096,7 +2020,7 @@ } /** Sets the italic attribute. - + @param aItalic The italic attribute takes this value ETrue or EFalse. */ inline void TOpenFontFaceAttribBase::SetItalic(TBool aItalic) { @@ -2105,9 +2029,9 @@ else iStyle &= ~EItalic; } - + /** Sets the serif attribute. - + @param aSerif The serif attribute takes this value ETrue or EFalse. */ inline void TOpenFontFaceAttribBase::SetSerif(TBool aSerif) { @@ -2129,12 +2053,12 @@ } /** Equality operator. - + Compares this and a specified set of font attributes, including the coverage and the typeface name. - + In version 6.1, and earlier, the return value was TInt. - + @param aAttrib The font attributes to compare. This is an object of TOpenFontFaceAttribBase or of a derived class. @return ETrue if the values are equal. */ @@ -2169,34 +2093,34 @@ } /** Gets the height of the font. - + @return The height of the font, in pixels or twips. @see SetHeight() */ inline TInt TOpenFontSpec::Height() const { return iHeight; } - + /** Gets the algorithmic width factor. - + @return The algorithmic width factor as a 16.16 fixed-point number. @see SetWidthFactor() */ inline TInt32 TOpenFontSpec::WidthFactor() const { return iWidthFactor; } - + /** Gets the algorithmic slant factor. - + @return The algorithmic slant factor as a 16.16 fixed-point number. @see SetSlantFactor() */ inline TInt32 TOpenFontSpec::SlantFactor() const { return iSlantFactor; } - + /** Gets the anti-aliasing setting for the font, as set by SetBitmapType(). - + @return Indicates whether or not the font should be drawn using anti-aliasing. */ inline TGlyphBitmapType TOpenFontSpec::BitmapType() const { @@ -2217,15 +2141,15 @@ } /** Gets the print position. - + @return The print position. */ inline TFontPrintPosition TOpenFontSpec::PrintPosition() const { return iPrintPosition; } - + /** Sets the font's height. - + @param aHeight The font's height, in pixels or twips. @see Height() */ inline void TOpenFontSpec::SetHeight(TInt aHeight) @@ -2234,46 +2158,46 @@ } /** Sets the algorithmic width factor. - + The width factor is multiplied by the pixel's x position to get the new position, causing characters to become wider or narrower. A width factor of 1 (65536 in 16.16 fixed-point number format) should be used if the character width is not to be changed. - + @param aWidthFactor The algorithmic width factor as a 16.16 fixed-point number. @see WidthFactor() */ inline void TOpenFontSpec::SetWidthFactor(TInt32 aWidthFactor) { iWidthFactor = aWidthFactor; } - + /** Sets the algorithmic slant factor. - + Note: The slant factor is used to create an italic effect for characters which do not have an italic glyph in the typeface. When slanting is active, pixel x co-ordinates are shifted by a factor relative to the y co-ordinate (i.e. x = x + y x slant factor). - + The slant factor is a 32 bit, 16.16 fixed-point number. This means that the first 16 bits are treated as a whole number, and the second 16 as the fractional part. e.g. if aSlantFactor=0, there is no slant. If aSlantFactor=65536 this is equivalent to an integer slant value of 1, which causes a 45 degree slant on the character. - + @param aSlantFactor The slant factor as a 16.16 fixed-point number. @see SlantFactor() */ inline void TOpenFontSpec::SetSlantFactor(TInt32 aSlantFactor) { iSlantFactor = aSlantFactor; } - + /** Sets whether the font should be drawn using anti-aliasing. If set, this value overrides the default setting (set by CFbsTypefaceStore::SetDefaultBitmapType()) for this font. - + Anti-aliasing can only be used for scalable fonts. There is currently no anti-aliasing support for bitmapped fonts. - + @param aBitmapType Indicates whether or not the font should be drawn using anti-aliasing. */ inline void TOpenFontSpec::SetBitmapType(TGlyphBitmapType aBitmapType) @@ -2295,26 +2219,26 @@ } /** Gets the font file's UID. - + @return The uid of the file. */ inline TUid COpenFontFile::Uid() const { return iUid; } - + /** Gets the full path and filename of the font file - + This is the filename that was passed to the constructor when the object is created. - + @return The filename of the font file. */ inline const TDesC& COpenFontFile::FileName() const { return iFileName; } - + /** Gets the typeface at a specified index in the typeface attribute array. - + @param aFaceIndex The index of the typeface for which the attributes are required. @return The attributes of the typeface with the specified index. @see AddFaceL() @@ -2323,7 +2247,7 @@ { return iFaceAttrib[aFaceIndex]; } - + /** Gets the number of typefaces in the typeface attributes array. This is the number of typefaces in the font file: the attributes for each @@ -2336,17 +2260,17 @@ { return iFaceAttrib.Count(); } - + /** Increments a reference count by one. - + @see DecRefCount() */ inline void COpenFontFile::IncRefCount() { iRefCount++; } - + /** Decrement a reference count by one. - + @return ETrue if the reference count has reached zero (i.e. is less than or equal to zero); EFalse if the reference count has not yet reached zero (i.e. is positive). @@ -2356,18 +2280,18 @@ iRefCount--; return iRefCount <= 0; } - + /** Default C++ constructor. */ inline COpenFontRasterizerContext::COpenFontRasterizerContext(): iGlyphData(NULL) { } - + /** Start writing the glyph data. - + Use this function to initialise the buffer to which the glyph bitmap is to be written. Call WriteGlyphBit() to add bits to the buffer. - + @param aGlyphData A pointer to the glyph data. */ inline void COpenFontRasterizerContext::StartGlyph(TOpenFontGlyphData* aGlyphData) { @@ -2381,11 +2305,11 @@ iBytesNeeded = 1; iOverflow = FALSE; } - + /** Writes a bit to the glyph buffer. - + Before calling this function you should first call StartGlyph(). - + @param aBit The bit to be added to the buffer. */ inline void COpenFontRasterizerContext::WriteGlyphBit(TInt aBit) { @@ -2416,9 +2340,9 @@ iOverflow = TRUE; iBytesNeeded++; } - + /** Completes writing glyph data. - + Use this function to complete writing the glyph bitmap to the buffer. Call it after adding all necessary bits using WriteGlyphBit(). */ inline void COpenFontRasterizerContext::EndGlyph() @@ -2427,95 +2351,95 @@ iGlyphData->SetBytesNeeded(iBytesNeeded + 4); iGlyphData = NULL; } - + /** Tests whether the bitmap buffer is large enough to hold the bitmap. - + @return ETrue if the bitmap will overflow its buffer, otherwise EFalse. */ inline TBool TOpenFontGlyphData::Overflow() const { return iBytesNeeded > iBitmapBufferSize; } - + /** Gets the number of bytes needed to store the glyph bitmap. - + @return The number of bytes needed to store the glyph bitmap. @see SetBytesNeeded() */ inline TInt TOpenFontGlyphData::BytesNeeded() const { return iBytesNeeded; } - + /** Gets a constant pointer descriptor containing the bitmap this object represents. - + @return Pointer descriptor for the glyph. */ inline TPtrC8 TOpenFontGlyphData::Bitmap() const { return TPtrC8(iBitmap,iBytesNeeded); } - + /** Gets a pointer to the bitmap. - + This points either to the buffer used to write the bitmap when it is first rasterized, or to the cache if the character was already rasterized. - + @return A pointer to the bitmap. */ inline const TUint8* TOpenFontGlyphData::BitmapPointer() const { return iBitmap; } - + /** Gets the character's metrics. - + @return The character's open font metrics. */ inline const TOpenFontCharMetrics* TOpenFontGlyphData::Metrics() const { return iMetrics; } - + /** Gets a pointer to the start of the bitmap buffer. - + @return A pointer to the start of the bitmap buffer. */ inline TUint8* TOpenFontGlyphData::BufferStart() { return iBitmapBuffer; } - + /** Gets a pointer to the end of the bitmap buffer. - + @return A pointer to the end of the bitmap buffer. */ inline TUint8* TOpenFontGlyphData::BufferEnd() { return iBitmapBuffer + iBitmapBufferSize; } - + /** Sets the number of bytes needed to store the glyph bitmap. - + @param aBytes The number of bytes needed to store the glyph bitmap. @see BytesNeeded() */ inline void TOpenFontGlyphData::SetBytesNeeded(TInt aBytes) { iBytesNeeded = aBytes; } - + /** Sets the pointer to the bitmap buffer. - + @param aBitmap The pointer to the bitmap buffer. */ inline void TOpenFontGlyphData::SetBitmapPointer(const TUint8* aBitmap) { iBitmap = aBitmap; } - + /** Sets the character's metrics, passing a pointer to a TOpenFontCharMetrics object. - + @param aMetrics A pointer to the character's open font character metrics. */ inline void TOpenFontGlyphData::SetMetricsPointer(const TOpenFontCharMetrics* aMetrics) { iMetrics = aMetrics; } - + /** Sets the bitmap and metrics pointers to point to the internal buffers. - + The alternative is that the pointers point to the cache of metrics and bitmaps that have already been rasterized. */ inline void TOpenFontGlyphData::SetPointersToInternalBuffers() @@ -2523,55 +2447,31 @@ iBitmap = iBitmapBuffer; iMetrics = &iMetricsBuffer; } - + /** Sets the character's metrics, passing a reference to a TOpenFontCharMetrics object. - -@param aMetrics The character's open font character metrics. */ + +@param aMetrics The character's open font character metrics. */ inline void TOpenFontGlyphData::SetMetrics(TOpenFontCharMetrics& aMetrics) { iMetricsBuffer = aMetrics; iMetrics = &iMetricsBuffer; } - + /** Sets the glyph index. - -@param aGlyphIndex The glyph index. */ + +@param aGlyphIndex The glyph index. */ inline void TOpenFontGlyphData::SetGlyphIndex(TInt aGlyphIndex) { iGlyphIndex = aGlyphIndex; } - -/** Uses ECOM plug-in framework to instantiate the Open Font rasterizer interface -implementation given its implementation UID. - -@param "TUid aInterfaceImplUid" - The UID of the interface implementation required - -@return "COpenFontRasterizer*" - A pointer to a COpenFontRasterizer object. */ -inline COpenFontRasterizer* COpenFontRasterizer::NewL(TUid aInterfaceImplUid) -{ - return reinterpret_cast ( - REComSession::CreateImplementationL( - aInterfaceImplUid, - _FOFF(COpenFontRasterizer, iDtor_ID_Key))); -} - -/** Default destructor */ -inline COpenFontRasterizer::~COpenFontRasterizer() -{ - REComSession::DestroyedImplementation(iDtor_ID_Key); -} /** Uses ECOM plug-in framework to instantiate the shaper factory interface implementation given its implementation UID. -@param "TUid aInterfaceImplUid" - The UID of the interface implementation required - -@return "CShaperFactory*" - A pointer to a CShaperFactory object. */ +@param aInterfaceImplUid The UID of the interface implementation required + +@return CShaperFactory* A pointer to a CShaperFactory object. */ inline CShaperFactory* CShaperFactory::NewL(TUid aInterfaceImplUid) { return reinterpret_cast ( @@ -2586,4 +2486,4 @@ REComSession::DestroyedImplementation(iDtor_ID_Key); } -#endif // OPENFONT_H__ +#endif // __OPENFONT_H__