sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * SymbianFontInstance.CPP sl@0: * Symbian implementation of LEFontInstance sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef SYMBIANFontInstance_H_ sl@0: #define SYMBIANFontInstance_H_ sl@0: sl@0: #include sl@0: sl@0: #include "layout/LETypes.h" sl@0: #include "layout/LEFontInstance.h" sl@0: sl@0: #include "FontTableCache.h" sl@0: sl@0: #include "sfnt.h" sl@0: #include "cmaps.h" sl@0: sl@0: // Symbian includes sl@0: #include sl@0: sl@0: class MOpenFontExtensionInterface; sl@0: sl@0: class SymbianFontInstance : public LEFontInstance, protected FontTableCache sl@0: { sl@0: public: sl@0: SymbianFontInstance(CBitmapFont* aBitmapFont, LEErrorCode &status, le_bool aKeepGlyphOfZWJ = false); sl@0: virtual ~SymbianFontInstance(); sl@0: void SetSessionHandle(TInt aHandle) sl@0: { sl@0: iSessionHandle = aHandle; sl@0: } sl@0: sl@0: const void *getFontTable(LETag tableTag) const; sl@0: sl@0: le_int32 getUnitsPerEM() const sl@0: { sl@0: return fUnitsPerEM; sl@0: } sl@0: sl@0: le_int32 getAscent() const sl@0: { sl@0: return fAscent; sl@0: } sl@0: sl@0: le_int32 getDescent() const sl@0: { sl@0: return fDescent; sl@0: } sl@0: sl@0: le_int32 getLeading() const sl@0: { sl@0: return fLeading; sl@0: } sl@0: sl@0: LEGlyphID mapCharToGlyph(LEUnicode32 ch) const sl@0: { sl@0: // 1922 mlyl --> sl@0: if (ch == 0x200D && !iKeepGlyphOfZWJ) sl@0: return 1; sl@0: else sl@0: // <-- 1922 mlyl sl@0: return fCMAPMapper->unicodeToGlyph(ch); sl@0: } sl@0: sl@0: void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const; sl@0: sl@0: le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const; sl@0: sl@0: void transformFunits(float xFunits, float yFunits, LEPoint &pixels) const; sl@0: float xUnitsToPoints(float xUnits) const; sl@0: float yUnitsToPoints(float yUnits) const; sl@0: float getXPixelsPerEm() const; sl@0: float getYPixelsPerEm() const; sl@0: float getScaleFactorX() const; sl@0: float getScaleFactorY() const; sl@0: sl@0: protected: sl@0: const void *readFontTable(LETag tableTag) const; sl@0: sl@0: private: sl@0: FILE *fFile; sl@0: sl@0: le_int32 fUnitsPerEM; sl@0: le_int32 fAscent; sl@0: le_int32 fDescent; sl@0: le_int32 fLeading; sl@0: sl@0: const SFNTDirectory *fDirectory; sl@0: le_uint16 fDirPower; sl@0: le_uint16 fDirExtra; sl@0: sl@0: float fXPixelsPerEm; sl@0: float fYPixelsPerEm; sl@0: sl@0: float fDeviceScaleX; sl@0: float fDeviceScaleY; sl@0: sl@0: CMAPMapper *fCMAPMapper; sl@0: sl@0: const HMTXTable *fHMTXTable; sl@0: le_uint16 fNumGlyphs; sl@0: le_uint16 fNumLongHorMetrics; sl@0: sl@0: CBitmapFont* iFont; sl@0: MOpenFontShapingExtension* iExtensionInterface; sl@0: MOpenFontTrueTypeExtension* iTrueTypeExtensionInterface; sl@0: TInt iSessionHandle; sl@0: sl@0: // --> 1922 mlyl: The script which this shaper will shape sl@0: le_bool iKeepGlyphOfZWJ; sl@0: // <-- 1922 mlyl sl@0: sl@0: static le_int8 highBit(le_int32 value); sl@0: sl@0: const DirectoryEntry *findTable(LETag tag) const; sl@0: const void *readTable(LETag tag, le_uint32 *length) const; sl@0: void deleteTable(const void *table) const; sl@0: void getMetrics(); sl@0: sl@0: CMAPMapper *findUnicodeMapper(); sl@0: }; sl@0: sl@0: #endif