sl@0: /* sl@0: ******************************************************************************* sl@0: * sl@0: * Copyright (C) 1999-2003, International Business Machines sl@0: * Corporation and others. All Rights Reserved. sl@0: * sl@0: ******************************************************************************* sl@0: * file name: PortableFontInstance.h sl@0: * sl@0: * created on: 11/12/1999 sl@0: * created by: Eric R. Mader sl@0: */ sl@0: sl@0: #ifndef __PORTABLEFONTINSTANCE_H sl@0: #define __PORTABLEFONTINSTANCE_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: class PortableFontInstance : public LEFontInstance, protected FontTableCache sl@0: { sl@0: private: sl@0: FILE *fFile; sl@0: sl@0: float fPointSize; 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 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: 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: protected: sl@0: const void *readFontTable(LETag tableTag) const; sl@0: sl@0: public: sl@0: PortableFontInstance(char *fileName, float pointSize, LEErrorCode &status); sl@0: sl@0: virtual ~PortableFontInstance(); sl@0: sl@0: virtual const void *getFontTable(LETag tableTag) const; sl@0: sl@0: virtual le_int32 getUnitsPerEM() const sl@0: { sl@0: return fUnitsPerEM; sl@0: }; sl@0: sl@0: virtual le_int32 getAscent() const sl@0: { sl@0: return fAscent; sl@0: } sl@0: sl@0: virtual le_int32 getDescent() const sl@0: { sl@0: return fDescent; sl@0: } sl@0: sl@0: virtual le_int32 getLeading() const sl@0: { sl@0: return fLeading; sl@0: } sl@0: sl@0: virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const sl@0: { sl@0: return fCMAPMapper->unicodeToGlyph(ch); sl@0: } sl@0: sl@0: virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const; sl@0: sl@0: virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const; sl@0: sl@0: float getXPixelsPerEm() const sl@0: { sl@0: return fPointSize; sl@0: }; sl@0: sl@0: float getYPixelsPerEm() const sl@0: { sl@0: return fPointSize; sl@0: }; sl@0: sl@0: float getScaleFactorX() const sl@0: { sl@0: return 1.0; sl@0: } sl@0: sl@0: float getScaleFactorY() const sl@0: { sl@0: return 1.0; sl@0: } sl@0: sl@0: }; sl@0: sl@0: #endif