Class OpenTypeFont
- java.lang.Object
-
- com.adobe.fontengine.font.FontData
-
- com.adobe.fontengine.font.opentype.OpenTypeFont
-
public final class OpenTypeFont extends FontData
Gives access to an OpenType font
-
-
Field Summary
Fields Modifier and Type Field Description BasebaseThe 'BASE' table if present, null otherwiseCffcffThe 'CFF' table, if present, null otherwiseCmapcmapThe 'cmap' table, if present, null otherwiseCvtcvtThe 'cvt' table, if present, null otherwiseFondfondThe Apple 'fond' table if present, null otherwiseFpgmfpgmThe 'fpgm' table, if present, null otherwiseGaspgaspThe 'gasp' table, if present, null otherwiseGdefgdefThe 'GDEF' table if present, null otherwiseGlyfglyfThe 'glyf' table, if present, null otherwiseGposgposThe 'GPOS' table, if present, null otherwiseGsubgsubThe 'GSUB' table, if present, null otherwiseHeadheadThe 'head' table, if present, null otherwiseHheahheaThe 'hhea' table, if present, null otherwiseHmtxhmtxThe 'hmtx' table, if present, null otherwiseKernkernThe 'kern' table, if present, null otherwiseLtshltshThe 'LTSH' table if present, null otherwiseMaxpmaxpThe 'maxp' table, if present, null otherwiseNamenameThe 'name' table, if present, null otherwiseOs2os2The 'OS/2' table, if present, null otherwisePostpostThe 'post' table, if present, null otherwisePrepprepThe 'prep' table, if present, null otherwiseVheavheaThe 'vhea' table, if present, null otherwiseVmtxvmtxThe 'vmtx' table, if present, null otherwiseVorgvorgThe 'VORG' table if present, null otherwise
-
Constructor Summary
Constructors Constructor Description OpenTypeFont(java.util.Map tables, byte[] digest, java.lang.String base14CSSName, java.lang.String base14PSName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcomputeRomanBaselineH()doublecomputeRomanBaselineV()SubsetcreateSubset()Create a subset for this font.CacheSupportInfogetCacheSupportInfo()Return the CacheSupportInfo that this font matchesCFFFontgetCFFFont()intgetCharForGlyph(int gid)Find a character mapped to some glyph.intgetCIDCount()doublegetCoolTypeCapHeight()Returns the CoolTypeCapHeight of this font.RectgetCoolTypeGlyphBBox(int glyphID)intgetCoolTypeGlyphForChar(int usv)Return the glyph used by CoolType for a character.RectgetCoolTypeIcfBox()Compute the IcfBox.RectgetCoolTypeIdeoEmBox()Compute the IdeoEmBox.LineMetricsgetCoolTypeLineMetrics()Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.booleangetCoolTypeProportionalRomanFromFontProperties()RectgetCoolTypeRawFontBBox()CoolTypeScriptgetCoolTypeScript()UnderlineMetricsgetCoolTypeUnderlineMetrics()doublegetCoolTypeUnitsPerEm()java.util.SetgetCSSFamilyNames()Return the set of CSS font-family names that this font matches.intgetCSSWeight()Return the CSS weight of this font.PermissiongetEmbeddingPermission(boolean wasEmbedded)RectgetFontBBox()FXGFontDescription[]getFXGFontDescription(Platform platform, ULocale locale)Return the FXG descriptions for this font.RectgetGlyphBBox(int gid)Get the bounding box of a glyph.intgetGlyphCid(int glyphID)intgetGlyphForChar(int usv)Return the glyph to use to display a character.java.lang.StringgetGlyphName(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.LineMetricsgetLineMetrics()Return the line metrics for this font.intgetNumGlyphs()Return the number of glyphs in this font.OpticalSizeDatagetOpticalSizeData()PDFFontDescriptiongetPDFFontDescription(Font font)PlatformFontDescription[]getPlatformFontDescription(Platform platform, ULocale locale)Return the platform descriptions for this font.double[]getPointSizeRange()Return the range of point sizes for which this font has been designed.PostscriptFontDescription[]getPostscriptFontDescription()Return the postscript descriptions that this font matches.java.lang.StringgetPreferredCSSFamilyName()ROSgetROS()ScalergetScaler(ScanConverter c)Get a scaler for this font, using a specific scan converter.CatalogDescriptiongetSelectionDescription()SWFFont4DescriptiongetSWFFont4Description(boolean wasEmbedded)SWFFontDescriptiongetSWFFontDescription(boolean wasEmbedded)doublegetUnitsPerEmX()doublegetUnitsPerEmY()XDCFontDescriptiongetXDCFontDescription(Font font)booleanisCSSStyleItalic()Tell if the font matches the CSS font-style italic.booleanisCSSStyleNormal()Tell if the font matches the CSS font-style normal.booleanisCSSStyleOblique()Tell if the font matches the CSS font-style oblique.booleanisCSSVariantNormal()Tell if the font matches the CSS font-variant normal.booleanisCSSVariantSmallCaps()Tell if the font matches the CSS font-variant small-caps.booleanisSymbolic()Tell whether the font is symbolic.voidsubsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS)Subset and stream this font for PDF use.voidsubsetAndStreamForSWFEmbedding(Subset subset, java.io.OutputStream out, java.util.TreeMap<java.lang.Integer,java.util.List> gsubLookups, java.util.TreeSet cmapData, boolean includeVariationCmap)-
Methods inherited from class com.adobe.fontengine.font.FontData
getContainerFingerprint, getCoolTypeFontBBox, getCoolTypeXHeight, getCSS20FontDescription, getPreferredCSS20FontDescription, getScaler, hasCoolTypeProportionalRoman
-
-
-
-
Field Detail
-
head
public final Head head
The 'head' table, if present, null otherwise
-
hhea
public final Hhea hhea
The 'hhea' table, if present, null otherwise
-
hmtx
public final Hmtx hmtx
The 'hmtx' table, if present, null otherwise
-
maxp
public final Maxp maxp
The 'maxp' table, if present, null otherwise
-
name
public final Name name
The 'name' table, if present, null otherwise
-
os2
public final Os2 os2
The 'OS/2' table, if present, null otherwise
-
cmap
public final Cmap cmap
The 'cmap' table, if present, null otherwise
-
post
public final Post post
The 'post' table, if present, null otherwise
-
gpos
public final Gpos gpos
The 'GPOS' table, if present, null otherwise
-
gsub
public final Gsub gsub
The 'GSUB' table, if present, null otherwise
-
gdef
public final Gdef gdef
The 'GDEF' table if present, null otherwise
-
base
public final Base base
The 'BASE' table if present, null otherwise
-
glyf
public final Glyf glyf
The 'glyf' table, if present, null otherwise
-
cff
public final Cff cff
The 'CFF' table, if present, null otherwise
-
vhea
public final Vhea vhea
The 'vhea' table, if present, null otherwise
-
vmtx
public final Vmtx vmtx
The 'vmtx' table, if present, null otherwise
-
cvt
public final Cvt cvt
The 'cvt' table, if present, null otherwise
-
fpgm
public final Fpgm fpgm
The 'fpgm' table, if present, null otherwise
-
prep
public final Prep prep
The 'prep' table, if present, null otherwise
-
kern
public final Kern kern
The 'kern' table, if present, null otherwise
-
gasp
public final Gasp gasp
The 'gasp' table, if present, null otherwise
-
ltsh
public final Ltsh ltsh
The 'LTSH' table if present, null otherwise
-
vorg
public final Vorg vorg
The 'VORG' table if present, null otherwise
-
fond
public final Fond fond
The Apple 'fond' table if present, null otherwise
-
-
Constructor Detail
-
OpenTypeFont
public OpenTypeFont(java.util.Map tables, byte[] digest, java.lang.String base14CSSName, java.lang.String base14PSName) throws InvalidFontException, UnsupportedFontException
-
-
Method Detail
-
isSymbolic
public boolean isSymbolic() throws UnsupportedFontException, InvalidFontExceptionTell whether the font is symbolic.- Overrides:
isSymbolicin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getNumGlyphs
public int getNumGlyphs() throws InvalidFontException, UnsupportedFontExceptionDescription copied from class:FontDataReturn the number of glyphs in this font.- Specified by:
getNumGlyphsin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getUnitsPerEmX
public double getUnitsPerEmX() throws UnsupportedFontException, InvalidFontException- Specified by:
getUnitsPerEmXin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getUnitsPerEmY
public double getUnitsPerEmY() throws UnsupportedFontException, InvalidFontException- Specified by:
getUnitsPerEmYin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeUnitsPerEm
public double getCoolTypeUnitsPerEm() throws UnsupportedFontException, InvalidFontException- Overrides:
getCoolTypeUnitsPerEmin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getFontBBox
public Rect getFontBBox() throws InvalidFontException, UnsupportedFontException
- Specified by:
getFontBBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeRawFontBBox
public Rect getCoolTypeRawFontBBox() throws InvalidFontException, UnsupportedFontException
-
getCoolTypeScript
public CoolTypeScript getCoolTypeScript() throws UnsupportedFontException, InvalidFontException
- Specified by:
getCoolTypeScriptin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeCapHeight
public double getCoolTypeCapHeight() throws InvalidFontException, UnsupportedFontExceptionDescription copied from class:FontDataReturns the CoolTypeCapHeight of this font.- Overrides:
getCoolTypeCapHeightin classFontData- Returns:
- Double.NaN if the value cannot be determined
- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeIdeoEmBox
public Rect getCoolTypeIdeoEmBox() throws InvalidFontException, UnsupportedFontException
Compute the IdeoEmBox. Various heuristics are applied until the IdeoEmBox can be determined.- Specified by:
getCoolTypeIdeoEmBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeIcfBox
public Rect getCoolTypeIcfBox() throws InvalidFontException, UnsupportedFontException
Compute the IcfBox. Various heuristics are applied until the IcfBox can be determined.- Specified by:
getCoolTypeIcfBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeLineMetrics
public LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException
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
public LineMetrics getLineMetrics() throws UnsupportedFontException, InvalidFontException
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
public boolean getCoolTypeProportionalRomanFromFontProperties() throws InvalidFontException- Specified by:
getCoolTypeProportionalRomanFromFontPropertiesin classFontData- Throws:
InvalidFontException
-
computeRomanBaselineH
public int computeRomanBaselineH() throws InvalidFontException- Throws:
InvalidFontException
-
computeRomanBaselineV
public double computeRomanBaselineV() throws UnsupportedFontException, InvalidFontException
-
getGlyphForChar
public int getGlyphForChar(int usv) throws InvalidFontException, UnsupportedFontExceptionReturn 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
public int getCoolTypeGlyphForChar(int usv) throws InvalidFontException, UnsupportedFontExceptionDescription 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
public int getCharForGlyph(int gid) throws UnsupportedFontException, InvalidFontExceptionFind 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
public double getHorizontalAdvance(int gid) throws InvalidFontException, UnsupportedFontExceptionDescription 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, InvalidFontExceptionDescription copied from class:FontDataSend a glyph's outline to an OutlineConsumer.- Specified by:
getGlyphOutlinein classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getGlyphBBox
public Rect getGlyphBBox(int gid) throws UnsupportedFontException, InvalidFontException
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
public Scaler getScaler(ScanConverter c) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontDataGet a scaler for this font, using a specific scan converter.- Specified by:
getScalerin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getGlyphName
public java.lang.String getGlyphName(int glyphID) throws UnsupportedFontException, InvalidFontExceptionGet the name of glyphglyphID.
-
getROS
public ROS getROS()
-
getCIDCount
public int getCIDCount()
-
getGlyphCid
public int getGlyphCid(int glyphID) throws InvalidFontException, UnsupportedFontException
-
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
public PDFFontDescription getPDFFontDescription(Font font)
- Specified by:
getPDFFontDescriptionin classFontData
-
getXDCFontDescription
public XDCFontDescription getXDCFontDescription(Font font)
- Specified by:
getXDCFontDescriptionin classFontData
-
getEmbeddingPermission
public Permission getEmbeddingPermission(boolean wasEmbedded) throws InvalidFontException, UnsupportedFontException
- Specified by:
getEmbeddingPermissionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
createSubset
public Subset createSubset() throws UnsupportedFontException, InvalidFontException
Description copied from class:FontDataCreate a subset for this font.- Specified by:
createSubsetin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
subsetAndStream
public void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, java.io.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 classFontDataout- the OutputStream to which the bytes are streamedpreserveROS- tells whether to preserve the cid -> gid mapping- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
subsetAndStreamForSWFEmbedding
public void subsetAndStreamForSWFEmbedding(Subset subset, java.io.OutputStream out, java.util.TreeMap<java.lang.Integer,java.util.List> gsubLookups, java.util.TreeSet cmapData, boolean includeVariationCmap) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
getCacheSupportInfo
public CacheSupportInfo getCacheSupportInfo() throws InvalidFontException, UnsupportedFontException
Description copied from class:FontDataReturn the CacheSupportInfo that this font matches- Specified by:
getCacheSupportInfoin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getPostscriptFontDescription
public PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontException
Description copied from class:FontDataReturn the postscript descriptions that this font matches.- Specified by:
getPostscriptFontDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCSSFamilyNames
public java.util.Set getCSSFamilyNames() throws InvalidFontException, UnsupportedFontExceptionReturn the set of CSS font-family names that this font matches.
-
getPreferredCSSFamilyName
public java.lang.String getPreferredCSSFamilyName() throws InvalidFontException, UnsupportedFontException
-
isCSSStyleNormal
public boolean isCSSStyleNormal() throws InvalidFontException, UnsupportedFontExceptionTell if the font matches the CSS font-style normal.
-
isCSSStyleItalic
public boolean isCSSStyleItalic() throws InvalidFontException, UnsupportedFontExceptionTell if the font matches the CSS font-style italic.
-
isCSSStyleOblique
public boolean isCSSStyleOblique() throws InvalidFontException, UnsupportedFontExceptionTell 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
public int getCSSWeight() throws InvalidFontExceptionReturn 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
public OpticalSizeData getOpticalSizeData() throws InvalidFontException
- Throws:
InvalidFontException
-
getPointSizeRange
public double[] getPointSizeRange() throws InvalidFontExceptionReturn 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
public Rect getCoolTypeGlyphBBox(int glyphID) throws UnsupportedFontException, InvalidFontException
- Overrides:
getCoolTypeGlyphBBoxin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCFFFont
public CFFFont getCFFFont()
-
-