PortableFontInstance.h revision af169d2813ff8075288cd4a7811f0715e4fea3da
1 2/* 3 ******************************************************************************* 4 * 5 * Copyright (C) 1999-2008, International Business Machines 6 * Corporation and others. All Rights Reserved. 7 * 8 ******************************************************************************* 9 * file name: PortableFontInstance.h 10 * 11 * created on: 11/12/1999 12 * created by: Eric R. Mader 13 */ 14 15#ifndef __PORTABLEFONTINSTANCE_H 16#define __PORTABLEFONTINSTANCE_H 17 18#define HB_H_IN 19#include <hb-font.h> 20#include <hb-blob.h> 21 22#include "layout/LETypes.h" 23#include "layout/LEFontInstance.h" 24 25#include "FontTableCache.h" 26 27#include "cmaps.h" 28 29class PortableFontInstance : public LEFontInstance, protected FontTableCache 30{ 31private: 32 hb_face_t *fFace; 33 34 float fXScale; 35 float fYScale; 36 le_int32 fUnitsPerEM; 37 le_int32 fAscent; 38 le_int32 fDescent; 39 le_int32 fLeading; 40 41 float fDeviceScaleX; 42 float fDeviceScaleY; 43 44 const NAMETable *fNAMETable; 45 le_uint16 fNameCount; 46 le_uint16 fNameStringOffset; 47 48 CMAPMapper *fCMAPMapper; 49 50 const HMTXTable *fHMTXTable; 51 le_uint16 fNumGlyphs; 52 le_uint16 fNumLongHorMetrics; 53 54 static le_int8 highBit(le_int32 value); 55 56 void getMetrics(); 57 58 CMAPMapper *findUnicodeMapper(); 59 60protected: 61 hb_blob_t *readFontTable(LETag tableTag) const; 62 63public: 64 PortableFontInstance(hb_face_t *face, float xScale, float yScale, LEErrorCode &status); 65 66 virtual ~PortableFontInstance(); 67 68 virtual const void *getFontTable(LETag tableTag) const; 69 70 virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const; 71 72 virtual const LEUnicode16 *getUnicodeNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const; 73 74 virtual void deleteNameString(const char *name) const; 75 76 virtual void deleteNameString(const LEUnicode16 *name) const; 77 78 virtual le_int32 getUnitsPerEM() const; 79 80 virtual le_uint32 getFontChecksum() const; 81 82 virtual le_int32 getAscent() const; 83 84 virtual le_int32 getDescent() const; 85 86 virtual le_int32 getLeading() const; 87 88 // We really want to inherit this method from the superclass, but some compilers 89 // issue a warning if we don't implement it... 90 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const; 91 92 // We really want to inherit this method from the superclass, but some compilers 93 // issue a warning if we don't implement it... 94 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const; 95 96 virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const; 97 98 virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const; 99 100 virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const; 101 102 virtual float getXPixelsPerEm() const; 103 104 virtual float getYPixelsPerEm() const; 105 106 virtual float getScaleFactorX() const; 107 108 virtual float getScaleFactorY() const; 109 110}; 111 112#endif 113