public class TrueTypeFont extends Object implements FontBoxFont, Closeable
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
disableGsubFeature(String featureTag)
Disable a particular glyph substitution feature.
|
void |
enableGsubFeature(String featureTag)
Enable a particular glyph substitution feature.
|
void |
enableVerticalSubstitutions()
Enable glyph substitutions for vertical writing.
|
int |
getAdvanceHeight(int gid)
Returns the height for the given GID.
|
int |
getAdvanceWidth(int gid)
Returns the width for the given GID.
|
CmapTable |
getCmap()
Get the "cmap" table for this TTF.
|
BoundingBox |
getFontBBox()
Returns the font's bounding box in PostScript units.
|
List<Number> |
getFontMatrix()
Returns the FontMatrix in PostScript units.
|
GlyphTable |
getGlyph()
Get the glyf table for this TTF.
|
GlyphSubstitutionTable |
getGsub()
Get the "gsub" table for this TTF.
|
HeaderTable |
getHeader()
Get the head table for this TTF.
|
HorizontalHeaderTable |
getHorizontalHeader()
Get the hhea table for this TTF.
|
HorizontalMetricsTable |
getHorizontalMetrics()
Get the hmtx table for this TTF.
|
IndexToLocationTable |
getIndexToLocation()
Get the loca table for this TTF.
|
KerningTable |
getKerning()
Get the "kern" table for this TTF.
|
MaximumProfileTable |
getMaximumProfile()
Get the maxp table for this TTF.
|
String |
getName()
The PostScript name of the font.
|
NamingTable |
getNaming()
This will get the naming table for the true type font.
|
int |
getNumberOfGlyphs()
Returns the number of glyphs (MaximumProfile.numGlyphs).
|
InputStream |
getOriginalData()
Get the data of the TrueType Font
program representing the stream used to build this
object (normally from the TTFParser object).
|
long |
getOriginalDataSize()
Get the data size of the TrueType Font program representing the stream used to build this
object (normally from the TTFParser object).
|
OS2WindowsMetricsTable |
getOS2Windows()
Get the OS/2 table for this TTF.
|
GeneralPath |
getPath(String name)
Returns the path for the character with the given name.
|
PostScriptTable |
getPostScript()
Get the postscript table for this TTF.
|
protected TTFTable |
getTable(String tag)
This will get the table for the given tag.
|
byte[] |
getTableBytes(TTFTable table)
Returns the raw bytes of the given table.
|
Map<String,TTFTable> |
getTableMap()
Get all of the tables.
|
Collection<TTFTable> |
getTables()
Get all of the tables.
|
CmapSubtable |
getUnicodeCmap()
Deprecated.
Use
getUnicodeCmapLookup() instead |
CmapSubtable |
getUnicodeCmap(boolean isStrict)
Deprecated.
Use
getUnicodeCmapLookup(boolean) instead |
CmapLookup |
getUnicodeCmapLookup()
Returns the best Unicode from the font (the most general).
|
CmapLookup |
getUnicodeCmapLookup(boolean isStrict)
Returns the best Unicode from the font (the most general).
|
int |
getUnitsPerEm()
Returns the units per EM (Header.unitsPerEm).
|
float |
getVersion() |
VerticalHeaderTable |
getVerticalHeader()
Get the vhea table for this TTF.
|
VerticalMetricsTable |
getVerticalMetrics()
Get the vmtx table for this TTF.
|
VerticalOriginTable |
getVerticalOrigin()
Get the VORG table for this TTF.
|
float |
getWidth(String name)
Returns the advance width for the character with the given name.
|
boolean |
hasGlyph(String name)
Returns true if the font contains the given glyph.
|
int |
nameToGID(String name)
Returns the GID for the given PostScript name, if the "post" table is present.
|
String |
toString() |
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public float getVersion()
public Collection<TTFTable> getTables()
public Map<String,TTFTable> getTableMap()
public byte[] getTableBytes(TTFTable table) throws IOException
table
- the table to read.IOException
- if there was an error accessing the table.protected TTFTable getTable(String tag) throws IOException
tag
- the name of the table to be returnedIOException
- if there was an error reading the table.public NamingTable getNaming() throws IOException
IOException
- if there was an error reading the table.public PostScriptTable getPostScript() throws IOException
IOException
- if there was an error reading the table.public OS2WindowsMetricsTable getOS2Windows() throws IOException
IOException
- if there was an error reading the table.public MaximumProfileTable getMaximumProfile() throws IOException
IOException
- if there was an error reading the table.public HeaderTable getHeader() throws IOException
IOException
- if there was an error reading the table.public HorizontalHeaderTable getHorizontalHeader() throws IOException
IOException
- if there was an error reading the table.public HorizontalMetricsTable getHorizontalMetrics() throws IOException
IOException
- if there was an error reading the table.public IndexToLocationTable getIndexToLocation() throws IOException
IOException
- if there was an error reading the table.public GlyphTable getGlyph() throws IOException
IOException
- if there was an error reading the table.public CmapTable getCmap() throws IOException
IOException
- if there was an error reading the table.public VerticalHeaderTable getVerticalHeader() throws IOException
IOException
- if there was an error reading the table.public VerticalMetricsTable getVerticalMetrics() throws IOException
IOException
- if there was an error reading the table.public VerticalOriginTable getVerticalOrigin() throws IOException
IOException
- if there was an error reading the table.public KerningTable getKerning() throws IOException
IOException
- if there was an error reading the table.public GlyphSubstitutionTable getGsub() throws IOException
IOException
- if there was an error reading the table.public InputStream getOriginalData() throws IOException
IOException
- If there is an error getting the font data.public long getOriginalDataSize()
public int getNumberOfGlyphs() throws IOException
IOException
- if there was an error reading the table.public int getUnitsPerEm() throws IOException
IOException
- if there was an error reading the table.public int getAdvanceWidth(int gid) throws IOException
gid
- the GIDIOException
- if there was an error reading the metrics table.public int getAdvanceHeight(int gid) throws IOException
gid
- the GIDIOException
- if there was an error reading the metrics table.public String getName() throws IOException
FontBoxFont
getName
in interface FontBoxFont
IOException
@Deprecated public CmapSubtable getUnicodeCmap() throws IOException
getUnicodeCmapLookup()
insteadIOException
- if the font could not be read@Deprecated public CmapSubtable getUnicodeCmap(boolean isStrict) throws IOException
getUnicodeCmapLookup(boolean)
insteadisStrict
- False if we allow falling back to any cmap, even if it's not Unicode.IOException
- if the font could not be read, or there is no Unicode cmappublic CmapLookup getUnicodeCmapLookup() throws IOException
IOException
- if the font could not be readpublic CmapLookup getUnicodeCmapLookup(boolean isStrict) throws IOException
isStrict
- False if we allow falling back to any cmap, even if it's not Unicode.IOException
- if the font could not be read, or there is no Unicode cmappublic int nameToGID(String name) throws IOException
name
- the PostScript name.IOException
public GeneralPath getPath(String name) throws IOException
FontBoxFont
getPath
in interface FontBoxFont
IOException
- if the path could not be readpublic float getWidth(String name) throws IOException
FontBoxFont
getWidth
in interface FontBoxFont
IOException
- if the path could not be readpublic boolean hasGlyph(String name) throws IOException
FontBoxFont
hasGlyph
in interface FontBoxFont
name
- PostScript glyph nameIOException
public BoundingBox getFontBBox() throws IOException
FontBoxFont
getFontBBox
in interface FontBoxFont
IOException
public List<Number> getFontMatrix() throws IOException
FontBoxFont
getFontMatrix
in interface FontBoxFont
IOException
public void enableGsubFeature(String featureTag)
featureTag
- The GSUB feature to enablepublic void disableGsubFeature(String featureTag)
featureTag
- The GSUB feature to disablepublic void enableVerticalSubstitutions()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.