Class OpenTypeFont
java.lang.Object
com.adobe.fontengine.font.FontData
com.adobe.fontengine.font.opentype.OpenTypeFont
Gives access to an OpenType font
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BaseThe 'BASE' table if present, null otherwisefinal CffThe 'CFF' table, if present, null otherwisefinal CmapThe 'cmap' table, if present, null otherwisefinal CvtThe 'cvt' table, if present, null otherwisefinal FondThe Apple 'fond' table if present, null otherwisefinal FpgmThe 'fpgm' table, if present, null otherwisefinal GaspThe 'gasp' table, if present, null otherwisefinal GdefThe 'GDEF' table if present, null otherwisefinal GlyfThe 'glyf' table, if present, null otherwisefinal GposThe 'GPOS' table, if present, null otherwisefinal GsubThe 'GSUB' table, if present, null otherwisefinal HeadThe 'head' table, if present, null otherwisefinal HheaThe 'hhea' table, if present, null otherwisefinal HmtxThe 'hmtx' table, if present, null otherwisefinal KernThe 'kern' table, if present, null otherwisefinal LtshThe 'LTSH' table if present, null otherwisefinal MaxpThe 'maxp' table, if present, null otherwisefinal NameThe 'name' table, if present, null otherwisefinal Os2The 'OS/2' table, if present, null otherwisefinal PostThe 'post' table, if present, null otherwisefinal PrepThe 'prep' table, if present, null otherwisefinal VheaThe 'vhea' table, if present, null otherwisefinal VmtxThe 'vmtx' table, if present, null otherwisefinal VorgThe 'VORG' table if present, null otherwise -
Constructor Summary
ConstructorsConstructorDescriptionOpenTypeFont(Map tables, byte[] digest, String base14CSSName, String base14PSName) -
Method Summary
Modifier and TypeMethodDescriptionintdoubleCreate a subset for this font.Return the CacheSupportInfo that this font matchesintgetCharForGlyph(int gid) Find a character mapped to some glyph.intdoubleReturns the CoolTypeCapHeight of this font.getCoolTypeGlyphBBox(int glyphID) intgetCoolTypeGlyphForChar(int usv) Return the glyph used by CoolType for a character.Compute the IcfBox.Compute the IdeoEmBox.Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.booleandoubleReturn the set of CSS font-family names that this font matches.intReturn the CSS weight of this font.getEmbeddingPermission(boolean wasEmbedded) getFXGFontDescription(Platform platform, ULocale locale) Return the FXG descriptions for this font.getGlyphBBox(int gid) Get the bounding box of a glyph.intgetGlyphCid(int glyphID) intgetGlyphForChar(int usv) Return the glyph to use to display a character.getGlyphName(int glyphID) Get the name of glyphglyphID.voidgetGlyphOutline(int gid, OutlineConsumer consumer) Send a glyph's outline to an OutlineConsumer.voidgetGlyphOutline(int gid, OutlineConsumer consumer, int pathType) doublegetHorizontalAdvance(int gid) Get the horizontal advance of a glyph.Return the line metrics for this font.intReturn the number of glyphs in this font.getPDFFontDescription(Font font) getPlatformFontDescription(Platform platform, ULocale locale) Return the platform descriptions for this font.double[]Return the range of point sizes for which this font has been designed.Return the postscript descriptions that this font matches.getROS()Get a scaler for this font, using a specific scan converter.getSWFFont4Description(boolean wasEmbedded) getSWFFontDescription(boolean wasEmbedded) doubledoublegetXDCFontDescription(Font font) booleanTell if the font matches the CSS font-style italic.booleanTell if the font matches the CSS font-style normal.booleanTell if the font matches the CSS font-style oblique.booleanTell if the font matches the CSS font-variant normal.booleanTell if the font matches the CSS font-variant small-caps.booleanTell whether the font is symbolic.voidsubsetAndStream(Subset subset, OutputStream out, boolean preserveROS) Subset and stream this font for PDF use.voidsubsetAndStreamForSWFEmbedding(Subset subset, OutputStream out, TreeMap<Integer, List> gsubLookups, TreeSet cmapData, boolean includeVariationCmap) Methods inherited from class com.adobe.fontengine.font.FontData
getContainerFingerprint, getCoolTypeFontBBox, getCoolTypeXHeight, getCSS20FontDescription, getPreferredCSS20FontDescription, getScaler, hasCoolTypeProportionalRoman
-
Field Details
-
head
The 'head' table, if present, null otherwise -
hhea
The 'hhea' table, if present, null otherwise -
hmtx
The 'hmtx' table, if present, null otherwise -
maxp
The 'maxp' table, if present, null otherwise -
name
The 'name' table, if present, null otherwise -
os2
The 'OS/2' table, if present, null otherwise -
cmap
The 'cmap' table, if present, null otherwise -
post
The 'post' table, if present, null otherwise -
gpos
The 'GPOS' table, if present, null otherwise -
gsub
The 'GSUB' table, if present, null otherwise -
gdef
The 'GDEF' table if present, null otherwise -
base
The 'BASE' table if present, null otherwise -
glyf
The 'glyf' table, if present, null otherwise -
cff
The 'CFF' table, if present, null otherwise -
vhea
The 'vhea' table, if present, null otherwise -
vmtx
The 'vmtx' table, if present, null otherwise -
cvt
The 'cvt' table, if present, null otherwise -
fpgm
The 'fpgm' table, if present, null otherwise -
prep
The 'prep' table, if present, null otherwise -
kern
The 'kern' table, if present, null otherwise -
gasp
The 'gasp' table, if present, null otherwise -
ltsh
The 'LTSH' table if present, null otherwise -
vorg
The 'VORG' table if present, null otherwise -
fond
The Apple 'fond' table if present, null otherwise
-
-
Constructor Details
-
OpenTypeFont
public OpenTypeFont(Map tables, byte[] digest, String base14CSSName, String base14PSName) throws InvalidFontException, UnsupportedFontException
-
-
Method Details
-
isSymbolic
Tell whether the font is symbolic.- Overrides:
isSymbolicin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getNumGlyphs
Description copied from class:FontDataReturn the number of glyphs in this font.- Specified by:
getNumGlyphsin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getUnitsPerEmX
- Specified by:
getUnitsPerEmXin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getUnitsPerEmY
- Specified by:
getUnitsPerEmYin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeUnitsPerEm
- Overrides:
getCoolTypeUnitsPerEmin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getFontBBox
- Specified by:
getFontBBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeRawFontBBox
-
getCoolTypeScript
- Specified by:
getCoolTypeScriptin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeCapHeight
Description copied from class:FontDataReturns the CoolTypeCapHeight of this font.- Overrides:
getCoolTypeCapHeightin classFontData- Returns:
- Double.NaN if the value cannot be determined
- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeIdeoEmBox
Compute the IdeoEmBox. Various heuristics are applied until the IdeoEmBox can be determined.- Specified by:
getCoolTypeIdeoEmBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeIcfBox
Compute the IcfBox. Various heuristics are applied until the IcfBox can be determined.- Specified by:
getCoolTypeIcfBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeLineMetrics
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.The metrics are expressed in the design space of the font, i.e. they need to be converted through the metrics matrix.
This methods never returns null.
See also the
getLineMetrics()method.- Specified by:
getCoolTypeLineMetricsin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getLineMetrics
Return the line metrics for this font.The metrics are expressed in the design space of the font, i.e. they need to be converted through the metrics matrix.
Some font formats do not support the notion of line metrics, and in those cases, this method returns null.
See also the
getCoolTypeLineMetrics()method.- Overrides:
getLineMetricsin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeUnderlineMetrics
public UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException- Specified by:
getCoolTypeUnderlineMetricsin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeProportionalRomanFromFontProperties
- Specified by:
getCoolTypeProportionalRomanFromFontPropertiesin classFontData- Throws:
InvalidFontException
-
computeRomanBaselineH
- Throws:
InvalidFontException
-
computeRomanBaselineV
-
getGlyphForChar
Return the glyph to use to display a character. Depending on the layout technology of the font, the returned gid may be further processed.- Specified by:
getGlyphForCharin classFontData- Parameters:
usv- the Unicode scalar value of the character; (by definition, surrogate code points are not Unicode scalar values).- Returns:
- the gid of the glyph to use
- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeGlyphForChar
Description copied from class:FontDataReturn the glyph used by CoolType for a character. This is slightly different from getGlyphForChar, and intend to be closer to the behavior of CoolType. The main use of this version is for other functions that emulate CoolType, such as the methods that compute metrics based on the charateristics of some glyphs. In most font types, this is the same as getGlyphForChar, so we provide a default implementation here.- Overrides:
getCoolTypeGlyphForCharin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCharForGlyph
Find a character mapped to some glyph.- Parameters:
gid- the target glyph- Returns:
- one of the characters mapped to the target glyph via the Microsoft/Unicode_BMP cmap if there is one, -1 if none
- Throws:
UnsupportedFontExceptionInvalidFontException
-
getHorizontalAdvance
Description copied from class:FontDataGet the horizontal advance of a glyph. The returned value is in metric space.- Specified by:
getHorizontalAdvancein classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getGlyphOutline
public void getGlyphOutline(int gid, OutlineConsumer consumer, int pathType) throws UnsupportedFontException, InvalidFontException -
getGlyphOutline
public void getGlyphOutline(int gid, OutlineConsumer consumer) throws UnsupportedFontException, InvalidFontException Description copied from class:FontDataSend a glyph's outline to an OutlineConsumer.- Specified by:
getGlyphOutlinein classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getGlyphBBox
Description copied from class:FontDataGet the bounding box of a glyph. The returned value is in metric space.- Specified by:
getGlyphBBoxin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getScaler
Description copied from class:FontDataGet a scaler for this font, using a specific scan converter.- Specified by:
getScalerin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getGlyphName
Get the name of glyphglyphID. -
getROS
-
getCIDCount
public int getCIDCount() -
getGlyphCid
-
getSWFFontDescription
public SWFFontDescription getSWFFontDescription(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException - Specified by:
getSWFFontDescriptionin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getSWFFont4Description
public SWFFont4Description getSWFFont4Description(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException - Specified by:
getSWFFont4Descriptionin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getPDFFontDescription
- Specified by:
getPDFFontDescriptionin classFontData
-
getXDCFontDescription
- Specified by:
getXDCFontDescriptionin classFontData
-
getEmbeddingPermission
public Permission getEmbeddingPermission(boolean wasEmbedded) throws InvalidFontException, UnsupportedFontException - Specified by:
getEmbeddingPermissionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
createSubset
Description copied from class:FontDataCreate a subset for this font.- Specified by:
createSubsetin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
subsetAndStream
public void subsetAndStream(Subset subset, OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, IOException Description copied from class:FontDataSubset and stream this font for PDF use. The stream is either a TrueType stream or a CID-keyed CFF stream.- Specified by:
subsetAndStreamin classFontData- Parameters:
out- the OutputStream to which the bytes are streamedpreserveROS- tells whether to preserve the cid -> gid mapping- Throws:
InvalidFontExceptionUnsupportedFontExceptionIOException
-
subsetAndStreamForSWFEmbedding
public void subsetAndStreamForSWFEmbedding(Subset subset, OutputStream out, TreeMap<Integer, List> gsubLookups, TreeSet cmapData, boolean includeVariationCmap) throws InvalidFontException, UnsupportedFontException, IOException -
getCacheSupportInfo
Description copied from class:FontDataReturn the CacheSupportInfo that this font matches- Specified by:
getCacheSupportInfoin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getPostscriptFontDescription
public PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontExceptionDescription copied from class:FontDataReturn the postscript descriptions that this font matches.- Specified by:
getPostscriptFontDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCSSFamilyNames
Return the set of CSS font-family names that this font matches. -
getPreferredCSSFamilyName
-
isCSSStyleNormal
Tell if the font matches the CSS font-style normal. -
isCSSStyleItalic
Tell if the font matches the CSS font-style italic. -
isCSSStyleOblique
Tell if the font matches the CSS font-style oblique. -
isCSSVariantNormal
public boolean isCSSVariantNormal()Tell if the font matches the CSS font-variant normal. -
isCSSVariantSmallCaps
public boolean isCSSVariantSmallCaps()Tell if the font matches the CSS font-variant small-caps. -
getCSSWeight
Return the CSS weight of this font.- Throws:
InvalidFontException
-
getFXGFontDescription
public FXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException Description copied from class:FontDataReturn the FXG descriptions for this font.- Specified by:
getFXGFontDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getPlatformFontDescription
public PlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException Description copied from class:FontDataReturn the platform descriptions for this font.- Specified by:
getPlatformFontDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getOpticalSizeData
- Throws:
InvalidFontException
-
getPointSizeRange
Return the range of point sizes for which this font has been designed.- Overrides:
getPointSizeRangein classFontData- Returns:
- an array with exactly two elements. The first is the smallest intended point size (inclusive), the second is the largest intended point size (exclusive). Both numbers are in decipoints.
- Throws:
InvalidFontException
-
getSelectionDescription
public CatalogDescription getSelectionDescription() throws InvalidFontException, UnsupportedFontException- Specified by:
getSelectionDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeGlyphBBox
- Overrides:
getCoolTypeGlyphBBoxin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCFFFont
-