3 *******************************************************************************
5 * Copyright (C) 1999-2015, International Business Machines
6 * Corporation and others. All Rights Reserved.
8 *******************************************************************************
9 * file name: PortableFontInstance.h
11 * created on: 11/12/1999
12 * created by: Eric R. Mader
15 #ifndef __PORTABLEFONTINSTANCE_H
16 #define __PORTABLEFONTINSTANCE_H
20 #include "layout/LETypes.h"
21 #include "layout/LEFontInstance.h"
23 #include "FontTableCache.h"
28 class PortableFontInstance
: public LEFontInstance
, protected FontTableCache
35 le_uint32 fFontChecksum
;
40 const SFNTDirectory
*fDirectory
;
47 const NAMETable
*fNAMETable
;
49 le_uint16 fNameStringOffset
;
51 CMAPMapper
*fCMAPMapper
;
53 const HMTXTable
*fHMTXTable
;
55 le_uint16 fNumLongHorMetrics
;
57 static le_int8
highBit(le_int32 value
);
59 const DirectoryEntry
*findTable(LETag tag
) const;
60 const void *readTable(LETag tag
, le_uint32
*length
) const;
63 CMAPMapper
*findUnicodeMapper();
66 const void *readFontTable(LETag tableTag
) const { size_t ignored
; return readFontTable(tableTag
, ignored
); }
67 const void *readFontTable(LETag tableTag
, size_t &length
) const;
70 PortableFontInstance(const char *fileName
, float pointSize
, LEErrorCode
&status
);
72 virtual ~PortableFontInstance();
74 virtual const void *getFontTable(LETag tableTag
, size_t &length
) const;
76 virtual const char *getNameString(le_uint16 nameID
, le_uint16 platform
, le_uint16 encoding
, le_uint16 language
) const;
78 virtual const LEUnicode16
*getUnicodeNameString(le_uint16 nameID
, le_uint16 platform
, le_uint16 encoding
, le_uint16 language
) const;
80 virtual void deleteNameString(const char *name
) const;
82 virtual void deleteNameString(const LEUnicode16
*name
) const;
84 virtual le_int32
getUnitsPerEM() const;
86 virtual le_uint32
getFontChecksum() const;
88 virtual le_uint32
getRawChecksum() const;
90 virtual le_int32
getAscent() const;
92 virtual le_int32
getDescent() const;
94 virtual le_int32
getLeading() const;
96 // We really want to inherit this method from the superclass, but some compilers
97 // issue a warning if we don't implement it...
98 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
, le_bool filterZeroWidth
) const;
100 // We really want to inherit this method from the superclass, but some compilers
101 // issue a warning if we don't implement it...
102 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
) const;
104 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
106 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
108 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
110 float getXPixelsPerEm() const;
112 float getYPixelsPerEm() const;
114 float getScaleFactorX() const;
116 float getScaleFactorY() const;