Package org.apache.fontbox.ttf
Class TrueTypeFont
java.lang.Object
org.apache.fontbox.ttf.TrueTypeFont
A class to hold true type font information.
- Author:
- Ben Litchfield (ben@benlitchfield.com)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a table definition.void
close()
Close the underlying resources.int
getAdvanceWidth
(int code) Returns the width for the given glyph code.getCMAP()
Get the cmap table for this TTF.getGlyph()
Get the glyf table for this TTF.Get the head table for this TTF.Get the hhea table for this TTF.Get the hmtx table for this TTF.Get the loca table for this TTF.Get the maxp table for this TTF.This will get the naming table for the true type font.int
Returns the number of glyphs (MaximumProfile.numGlyphs).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).Get the OS/2 table for this TTF.Get the postscript table for this TTF.Get all of the tables.int
Returns the units per EM (Header.unitsPerEm).float
void
initializeTable
(TTFTable table) Initialize the given table if necessary.void
setVersion
(float versionValue)
-
Method Details
-
close
Close the underlying resources.- Throws:
IOException
- If there is an error closing the resources.
-
getVersion
public float getVersion()- Returns:
- Returns the version.
-
setVersion
public void setVersion(float versionValue) - Parameters:
versionValue
- The version to set.
-
addTable
Add a table definition.- Parameters:
table
- The table to add.
-
getTables
Get all of the tables.- Returns:
- All of the tables.
-
getNaming
This will get the naming table for the true type font.- Returns:
- The naming table.
-
getPostScript
Get the postscript table for this TTF.- Returns:
- The postscript table.
-
getOS2Windows
Get the OS/2 table for this TTF.- Returns:
- The OS/2 table.
-
getMaximumProfile
Get the maxp table for this TTF.- Returns:
- The maxp table.
-
getHeader
Get the head table for this TTF.- Returns:
- The head table.
-
getHorizontalHeader
Get the hhea table for this TTF.- Returns:
- The hhea table.
-
getHorizontalMetrics
Get the hmtx table for this TTF.- Returns:
- The hmtx table.
-
getIndexToLocation
Get the loca table for this TTF.- Returns:
- The loca table.
-
getGlyph
Get the glyf table for this TTF.- Returns:
- The glyf table.
-
getCMAP
Get the cmap table for this TTF.- Returns:
- The cmap table.
-
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).- Returns:
- COSStream True type font program stream
- Throws:
IOException
- If there is an error getting the font data.
-
initializeTable
Initialize the given table if necessary.- Parameters:
table
- the table to be initialized
-
getNumberOfGlyphs
public int getNumberOfGlyphs()Returns the number of glyphs (MaximumProfile.numGlyphs).- Returns:
- the number of glyphs
-
getUnitsPerEm
public int getUnitsPerEm()Returns the units per EM (Header.unitsPerEm).- Returns:
- units per EM
-
getAdvanceWidth
public int getAdvanceWidth(int code) Returns the width for the given glyph code.- Parameters:
code
- the glyph code- Returns:
- the width
-