public class TrueTypeFont extends java.lang.Object implements FontBoxFont, java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,TTFTable> |
tables |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
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.
|
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()
This permit to get the data of the True Type 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()
Returns the best Unicode from the font (the most general).
|
CmapSubtable |
getUnicodeCmap(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.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic 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 java.io.InputStream getOriginalData()
throws java.io.IOException
java.io.IOException - If there is an error getting the font data.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
FontBoxFontgetName in interface FontBoxFontjava.io.IOExceptionpublic CmapSubtable getUnicodeCmap() throws java.io.IOException
java.io.IOException - if the font could not be readpublic CmapSubtable getUnicodeCmap(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.IOExceptionpublic java.awt.geom.GeneralPath getPath(java.lang.String name)
throws java.io.IOException
FontBoxFontgetPath in interface FontBoxFontjava.io.IOException - if the path could not be readpublic float getWidth(java.lang.String name)
throws java.io.IOException
FontBoxFontgetWidth in interface FontBoxFontjava.io.IOException - if the path could not be readpublic boolean hasGlyph(java.lang.String name)
throws java.io.IOException
FontBoxFonthasGlyph in interface FontBoxFontname - PostScript glyph namejava.io.IOExceptionpublic BoundingBox getFontBBox() throws java.io.IOException
FontBoxFontgetFontBBox in interface FontBoxFontjava.io.IOExceptionpublic java.util.List<java.lang.Number> getFontMatrix()
throws java.io.IOException
FontBoxFontgetFontMatrix in interface FontBoxFontjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object