1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
5 *******************************************************************************
7 * Copyright (C) 1999-2015, International Business Machines
8 * Corporation and others. All Rights Reserved.
10 *******************************************************************************
11 * file name: PortableFontInstance.h
13 * created on: 11/12/1999
14 * created by: Eric R. Mader
17 #ifndef __PORTABLEFONTINSTANCE_H
18 #define __PORTABLEFONTINSTANCE_H
22 #include "layout/LETypes.h"
23 #include "layout/LEFontInstance.h"
25 #include "FontTableCache.h"
30 class PortableFontInstance
: public LEFontInstance
, protected FontTableCache
37 le_uint32 fFontChecksum
;
42 const SFNTDirectory
*fDirectory
;
49 const NAMETable
*fNAMETable
;
51 le_uint16 fNameStringOffset
;
53 CMAPMapper
*fCMAPMapper
;
55 const HMTXTable
*fHMTXTable
;
57 le_uint16 fNumLongHorMetrics
;
59 static le_int8
highBit(le_int32 value
);
61 const DirectoryEntry
*findTable(LETag tag
) const;
62 const void *readTable(LETag tag
, le_uint32
*length
) const;
65 CMAPMapper
*findUnicodeMapper();
68 const void *readFontTable(LETag tableTag
) const { size_t ignored
; return readFontTable(tableTag
, ignored
); }
69 const void *readFontTable(LETag tableTag
, size_t &length
) const;
72 PortableFontInstance(const char *fileName
, float pointSize
, LEErrorCode
&status
);
74 virtual ~PortableFontInstance();
76 virtual const void *getFontTable(LETag tableTag
, size_t &length
) const;
78 virtual const char *getNameString(le_uint16 nameID
, le_uint16 platform
, le_uint16 encoding
, le_uint16 language
) const;
80 virtual const LEUnicode16
*getUnicodeNameString(le_uint16 nameID
, le_uint16 platform
, le_uint16 encoding
, le_uint16 language
) const;
82 virtual void deleteNameString(const char *name
) const;
84 virtual void deleteNameString(const LEUnicode16
*name
) const;
86 virtual le_int32
getUnitsPerEM() const;
88 virtual le_uint32
getFontChecksum() const;
90 virtual le_uint32
getRawChecksum() const;
92 virtual le_int32
getAscent() const;
94 virtual le_int32
getDescent() const;
96 virtual le_int32
getLeading() const;
98 // We really want to inherit this method from the superclass, but some compilers
99 // issue a warning if we don't implement it...
100 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
, le_bool filterZeroWidth
) const;
102 // We really want to inherit this method from the superclass, but some compilers
103 // issue a warning if we don't implement it...
104 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
) const;
106 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
108 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
110 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
112 float getXPixelsPerEm() const;
114 float getYPixelsPerEm() const;
116 float getScaleFactorX() const;
118 float getScaleFactorY() const;