java.io.Closeable
, java.lang.AutoCloseable
, FontBoxFont
OpenTypeFont
public class TrueTypeFont extends java.lang.Object implements FontBoxFont, java.io.Closeable
Modifier and Type | Field | Description |
---|---|---|
protected java.util.Map<java.lang.String,TTFTable> |
tables |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
void |
disableGsubFeature(java.lang.String featureTag) |
Disable a particular glyph substitution feature.
|
void |
enableGsubFeature(java.lang.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.
|
java.util.List<java.lang.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.
|
java.lang.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).
|
java.io.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.
|
java.awt.geom.GeneralPath |
getPath(java.lang.String name) |
Returns the path for the character with the given name.
|
PostScriptTable |
getPostScript() |
Get the postscript table for this TTF.
|
protected TTFTable |
getTable(java.lang.String tag) |
This will get the table for the given tag.
|
byte[] |
getTableBytes(TTFTable table) |
Returns the raw bytes of the given table.
|
java.util.Map<java.lang.String,TTFTable> |
getTableMap() |
Get all of the tables.
|
java.util.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(java.lang.String name) |
Returns the advance width for the character with the given name.
|
boolean |
hasGlyph(java.lang.String name) |
Returns true if the font contains the given glyph.
|
int |
nameToGID(java.lang.String name) |
Returns the GID for the given PostScript name, if the "post" table is present.
|
java.lang.String |
toString() |
protected java.util.Map<java.lang.String,TTFTable> tables
public void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException
public float getVersion()
public java.util.Collection<TTFTable> getTables()
public java.util.Map<java.lang.String,TTFTable> getTableMap()
public byte[] getTableBytes(TTFTable table) throws java.io.IOException
table
- the table to read.java.io.IOException
- if there was an error accessing the table.protected TTFTable getTable(java.lang.String tag) throws java.io.IOException
tag
- the name of the table to be returnedjava.io.IOException
- if there was an error reading the table.public NamingTable getNaming() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public PostScriptTable getPostScript() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public OS2WindowsMetricsTable getOS2Windows() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public MaximumProfileTable getMaximumProfile() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public HeaderTable getHeader() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public HorizontalHeaderTable getHorizontalHeader() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public HorizontalMetricsTable getHorizontalMetrics() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public IndexToLocationTable getIndexToLocation() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public GlyphTable getGlyph() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public CmapTable getCmap() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public VerticalHeaderTable getVerticalHeader() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public VerticalMetricsTable getVerticalMetrics() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public VerticalOriginTable getVerticalOrigin() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public KerningTable getKerning() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public GlyphSubstitutionTable getGsub() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public java.io.InputStream getOriginalData() throws java.io.IOException
java.io.IOException
- If there is an error getting the font data.public long getOriginalDataSize()
public int getNumberOfGlyphs() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public int getUnitsPerEm() throws java.io.IOException
java.io.IOException
- if there was an error reading the table.public int getAdvanceWidth(int gid) throws java.io.IOException
gid
- the GIDjava.io.IOException
- if there was an error reading the metrics table.public int getAdvanceHeight(int gid) throws java.io.IOException
gid
- the GIDjava.io.IOException
- if there was an error reading the metrics table.public java.lang.String getName() throws java.io.IOException
FontBoxFont
getName
in interface FontBoxFont
java.io.IOException
@Deprecated public CmapSubtable getUnicodeCmap() throws java.io.IOException
getUnicodeCmapLookup()
insteadjava.io.IOException
- if the font could not be read@Deprecated public CmapSubtable getUnicodeCmap(boolean isStrict) throws java.io.IOException
getUnicodeCmapLookup(boolean)
insteadisStrict
- False if we allow falling back to any cmap, even if it's not Unicode.java.io.IOException
- if the font could not be read, or there is no Unicode cmappublic CmapLookup getUnicodeCmapLookup() throws java.io.IOException
java.io.IOException
- if the font could not be readpublic CmapLookup getUnicodeCmapLookup(boolean isStrict) throws java.io.IOException
isStrict
- False if we allow falling back to any cmap, even if it's not Unicode.java.io.IOException
- if the font could not be read, or there is no Unicode cmappublic int nameToGID(java.lang.String name) throws java.io.IOException
name
- the PostScript name.java.io.IOException
public java.awt.geom.GeneralPath getPath(java.lang.String name) throws java.io.IOException
FontBoxFont
getPath
in interface FontBoxFont
java.io.IOException
- if the path could not be readpublic float getWidth(java.lang.String name) throws java.io.IOException
FontBoxFont
getWidth
in interface FontBoxFont
java.io.IOException
- if the path could not be readpublic boolean hasGlyph(java.lang.String name) throws java.io.IOException
FontBoxFont
hasGlyph
in interface FontBoxFont
name
- PostScript glyph namejava.io.IOException
public BoundingBox getFontBBox() throws java.io.IOException
FontBoxFont
getFontBBox
in interface FontBoxFont
java.io.IOException
public java.util.List<java.lang.Number> getFontMatrix() throws java.io.IOException
FontBoxFont
getFontMatrix
in interface FontBoxFont
java.io.IOException
public void enableGsubFeature(java.lang.String featureTag)
featureTag
- The GSUB feature to enablepublic void disableGsubFeature(java.lang.String featureTag)
featureTag
- The GSUB feature to disablepublic void enableVerticalSubstitutions()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2008–2018. All rights reserved.