3 *******************************************************************************
5 * © 2016 and later: Unicode, Inc. and others.
6 * License & terms of use: http://www.unicode.org/copyright.html#License
8 *******************************************************************************
9 *******************************************************************************
11 * Copyright (C) 1999-2013, International Business Machines
12 * Corporation and others. All Rights Reserved.
14 *******************************************************************************
15 * file name: PortableFontInstance.h
17 * created on: 11/12/1999
18 * created by: Eric R. Mader
21 #ifndef __PORTABLEFONTINSTANCE_H
22 #define __PORTABLEFONTINSTANCE_H
26 #include "layout/LETypes.h"
27 #include "layout/LEFontInstance.h"
29 #include "FontTableCache.h"
34 class PortableFontInstance
: public LEFontInstance
, protected FontTableCache
41 le_uint32 fFontChecksum
;
46 const SFNTDirectory
*fDirectory
;
53 const NAMETable
*fNAMETable
;
55 le_uint16 fNameStringOffset
;
57 CMAPMapper
*fCMAPMapper
;
59 const HMTXTable
*fHMTXTable
;
61 le_uint16 fNumLongHorMetrics
;
63 static le_int8
highBit(le_int32 value
);
65 const DirectoryEntry
*findTable(LETag tag
) const;
66 const void *readTable(LETag tag
, le_uint32
*length
) const;
69 CMAPMapper
*findUnicodeMapper();
72 const void *readFontTable(LETag tableTag
) const { size_t ignored
; return readFontTable(tableTag
, ignored
); }
73 const void *readFontTable(LETag tableTag
, size_t &length
) const;
76 PortableFontInstance(const char *fileName
, float pointSize
, LEErrorCode
&status
);
78 virtual ~PortableFontInstance();
80 virtual const void *getFontTable(LETag tableTag
) const;
81 virtual const void *getFontTable(LETag tableTag
, size_t &length
) const;
83 virtual const char *getNameString(le_uint16 nameID
, le_uint16 platform
, le_uint16 encoding
, le_uint16 language
) const;
85 virtual const LEUnicode16
*getUnicodeNameString(le_uint16 nameID
, le_uint16 platform
, le_uint16 encoding
, le_uint16 language
) const;
87 virtual void deleteNameString(const char *name
) const;
89 virtual void deleteNameString(const LEUnicode16
*name
) const;
91 virtual le_int32
getUnitsPerEM() const;
93 virtual le_uint32
getFontChecksum() const;
95 virtual le_uint32
getRawChecksum() const;
97 virtual le_int32
getAscent() const;
99 virtual le_int32
getDescent() const;
101 virtual le_int32
getLeading() const;
103 // We really want to inherit this method from the superclass, but some compilers
104 // issue a warning if we don't implement it...
105 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
, le_bool filterZeroWidth
) const;
107 // We really want to inherit this method from the superclass, but some compilers
108 // issue a warning if we don't implement it...
109 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
, const LECharMapper
*mapper
) const;
111 virtual LEGlyphID
mapCharToGlyph(LEUnicode32 ch
) const;
113 virtual void getGlyphAdvance(LEGlyphID glyph
, LEPoint
&advance
) const;
115 virtual le_bool
getGlyphPoint(LEGlyphID glyph
, le_int32 pointNumber
, LEPoint
&point
) const;
117 float getXPixelsPerEm() const;
119 float getYPixelsPerEm() const;
121 float getScaleFactorX() const;
123 float getScaleFactorY() const;