Package org.apache.fontbox.ttf
Class OpenTypeFont
java.lang.Object
org.apache.fontbox.ttf.TrueTypeFont
org.apache.fontbox.ttf.OpenTypeFont
- All Implemented Interfaces:
Closeable,AutoCloseable,FontBoxFont
An OpenType (OTF/TTF) font.
-
Field Summary
FieldsFields inherited from class org.apache.fontbox.ttf.TrueTypeFont
tables -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCFF()Get the "CFF" table for this OTF.getGlyph()Get the glyf table for this TTF.Returns the path for the character with the given name.booleanReturns true if this font uses OpenType Layout (Advanced Typographic) tables.booleanReturns true if this font is a PostScript outline font.booleanReturns true if this font is supported.(package private) voidsetVersion(float versionValue) Set the version.Methods inherited from class org.apache.fontbox.ttf.TrueTypeFont
addTable, close, disableGsubFeature, enableGsubFeature, enableVerticalSubstitutions, getAdvanceHeight, getAdvanceWidth, getCmap, getFontBBox, getFontMatrix, getGsub, getGsubData, getHeader, getHorizontalHeader, getHorizontalMetrics, getIndexToLocation, getKerning, getMaximumProfile, getName, getNaming, getNumberOfGlyphs, getOriginalData, getOriginalDataSize, getOS2Windows, getPostScript, getTable, getTableBytes, getTableMap, getTableNBytes, getTables, getUnicodeCmapLookup, getUnicodeCmapLookup, getUnitsPerEm, getVersion, getVerticalHeader, getVerticalMetrics, getVerticalOrigin, getWidth, hasGlyph, isEnableGsub, nameToGID, readTable, readTableHeaders, setEnableGsub, toString
-
Field Details
-
hasPostScriptTag
private boolean hasPostScriptTag
-
-
Constructor Details
-
OpenTypeFont
OpenTypeFont(TTFDataStream fontData) Constructor. Clients should use the OTFParser to create a new OpenTypeFont object.- Parameters:
fontData- The font data.
-
-
Method Details
-
setVersion
void setVersion(float versionValue) Description copied from class:TrueTypeFontSet the version. Package-private, used by TTFParser only.- Overrides:
setVersionin classTrueTypeFont- Parameters:
versionValue- The version to set.
-
getCFF
Get the "CFF" table for this OTF.- Returns:
- The "CFF" table.
- Throws:
IOException- if the font data could not be readUnsupportedOperationException- if the current font isn't a CFF font
-
getGlyph
Description copied from class:TrueTypeFontGet the glyf table for this TTF.- Overrides:
getGlyphin classTrueTypeFont- Returns:
- The glyf table or null if it doesn't exist.
- Throws:
IOException- if there was an error reading the table.
-
getPath
Description copied from interface:FontBoxFontReturns the path for the character with the given name.- Specified by:
getPathin interfaceFontBoxFont- Overrides:
getPathin classTrueTypeFont- Parameters:
name- PostScript glyph name- Returns:
- glyph path
- Throws:
IOException- if the path could not be read
-
isPostScript
public boolean isPostScript()Returns true if this font is a PostScript outline font.- Returns:
- true if the font is a PostScript outline font, otherwise false
-
isSupportedOTF
public boolean isSupportedOTF()Returns true if this font is supported. There are 3 kind of OpenType fonts, fonts using TrueType outlines, fonts using CFF outlines (version 1 and 2) Fonts using CFF outlines version 2 aren't supported yet.- Returns:
- true if the font is supported
-
hasLayoutTables
public boolean hasLayoutTables()Returns true if this font uses OpenType Layout (Advanced Typographic) tables.- Returns:
- true if the font has any layout table, otherwise false
-