Package com.adobe.fontengine.font
Class FontData
- java.lang.Object
-
- com.adobe.fontengine.font.FontData
-
- Direct Known Subclasses:
CFFFont,OpenTypeFont,PDFSimpleFont,Type1Font,WrapperFontData
public abstract class FontData extends java.lang.ObjectThe base class for all FontData objects. This class provides the basic functionality common to all Fonts.Synchronization
These objects are immutable.
-
-
Constructor Summary
Constructors Constructor Description FontData(byte[] digest)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract SubsetcreateSubset()Create a subset for this font.abstract CacheSupportInfogetCacheSupportInfo()Return the CacheSupportInfo that this font matchesbyte[]getContainerFingerprint()doublegetCoolTypeCapHeight()Returns the CoolTypeCapHeight of this font.RectgetCoolTypeFontBBox()RectgetCoolTypeGlyphBBox(int glyphID)intgetCoolTypeGlyphForChar(int unicodeScalarValue)Return the glyph used by CoolType for a character.abstract RectgetCoolTypeIcfBox()abstract RectgetCoolTypeIdeoEmBox()abstract LineMetricsgetCoolTypeLineMetrics()Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.abstract booleangetCoolTypeProportionalRomanFromFontProperties()abstract CoolTypeScriptgetCoolTypeScript()abstract UnderlineMetricsgetCoolTypeUnderlineMetrics()doublegetCoolTypeUnitsPerEm()doublegetCoolTypeXHeight()CSS20FontDescription[]getCSS20FontDescription()abstract PermissiongetEmbeddingPermission(boolean wasEmbedded)abstract RectgetFontBBox()abstract FXGFontDescription[]getFXGFontDescription(Platform platform, ULocale locale)Return the FXG descriptions for this font.abstract RectgetGlyphBBox(int gid)Get the bounding box of a glyph.abstract intgetGlyphForChar(int unicodeScalarValue)Return the glyph to use to display a character.abstract voidgetGlyphOutline(int gid, OutlineConsumer consumer)Send a glyph's outline to an OutlineConsumer.abstract doublegetHorizontalAdvance(int gid)Get the horizontal advance of a glyph.LineMetricsgetLineMetrics()Return the line metrics for this font.abstract intgetNumGlyphs()Return the number of glyphs in this font.abstract PDFFontDescriptiongetPDFFontDescription(Font font)abstract 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.abstract PostscriptFontDescription[]getPostscriptFontDescription()Return the postscript descriptions that this font matches.CSS20FontDescriptiongetPreferredCSS20FontDescription()ScalergetScaler()Get a scaler for this font.abstract ScalergetScaler(ScanConverter c)Get a scaler for this font, using a specific scan converter.abstract CatalogDescriptiongetSelectionDescription()abstract SWFFont4DescriptiongetSWFFont4Description(boolean wasEmbedded)abstract SWFFontDescriptiongetSWFFontDescription(boolean wasEmbedded)abstract doublegetUnitsPerEmX()abstract doublegetUnitsPerEmY()abstract XDCFontDescriptiongetXDCFontDescription(Font font)booleanhasCoolTypeProportionalRoman()Determines whether a font has proportional roman, as defined by CoolType.booleanisSymbolic()Tell whether this font is symbolic.abstract voidsubsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS)Subset and stream this font for PDF use.
-
-
-
Method Detail
-
getContainerFingerprint
public byte[] getContainerFingerprint()
-
getNumGlyphs
public abstract int getNumGlyphs() throws InvalidFontException, UnsupportedFontExceptionReturn the number of glyphs in this font.
-
isSymbolic
public boolean isSymbolic() throws UnsupportedFontException, InvalidFontExceptionTell whether this font is symbolic.
-
getUnitsPerEmX
public abstract double getUnitsPerEmX() throws UnsupportedFontException, InvalidFontException
-
getUnitsPerEmY
public abstract double getUnitsPerEmY() throws UnsupportedFontException, InvalidFontException
-
getCoolTypeUnitsPerEm
public double getCoolTypeUnitsPerEm() throws UnsupportedFontException, InvalidFontException
-
getFontBBox
public abstract Rect getFontBBox() throws InvalidFontException, UnsupportedFontException
-
getCoolTypeFontBBox
public Rect getCoolTypeFontBBox() throws InvalidFontException, UnsupportedFontException
-
getCoolTypeScript
public abstract CoolTypeScript getCoolTypeScript() throws UnsupportedFontException, InvalidFontException
-
getCoolTypeCapHeight
public double getCoolTypeCapHeight() throws UnsupportedFontException, InvalidFontExceptionReturns the CoolTypeCapHeight of this font.- Returns:
- Double.NaN if the value cannot be determined
- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeXHeight
public double getCoolTypeXHeight() throws UnsupportedFontException, InvalidFontException
-
getCoolTypeIdeoEmBox
public abstract Rect getCoolTypeIdeoEmBox() throws UnsupportedFontException, InvalidFontException
-
getCoolTypeIcfBox
public abstract Rect getCoolTypeIcfBox() throws UnsupportedFontException, InvalidFontException
-
getCoolTypeGlyphBBox
public Rect getCoolTypeGlyphBBox(int glyphID) throws UnsupportedFontException, InvalidFontException
-
getCoolTypeLineMetrics
public abstract LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.See also the
getLineMetrics()method.
-
getLineMetrics
public LineMetrics getLineMetrics() throws UnsupportedFontException, InvalidFontException
Return the line metrics for this font.Some font formats do not support the notion of line metrics, and in those cases, this method returns null.
See also the
getCoolTypeLineMetrics()method.
-
getCoolTypeUnderlineMetrics
public abstract UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException
-
hasCoolTypeProportionalRoman
public boolean hasCoolTypeProportionalRoman() throws InvalidFontException, UnsupportedFontExceptionDetermines whether a font has proportional roman, as defined by CoolType.- Returns:
- whether the font is proportional
- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeProportionalRomanFromFontProperties
public abstract boolean getCoolTypeProportionalRomanFromFontProperties() throws InvalidFontException- Throws:
InvalidFontException
-
getGlyphForChar
public abstract int getGlyphForChar(int unicodeScalarValue) 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.- Parameters:
unicodeScalarValue- 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 unicodeScalarValue) throws InvalidFontException, UnsupportedFontExceptionReturn 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.
-
getHorizontalAdvance
public abstract double getHorizontalAdvance(int gid) throws InvalidGlyphException, UnsupportedFontException, InvalidFontExceptionGet the horizontal advance of a glyph. The returned value is in metric space.
-
getGlyphOutline
public abstract void getGlyphOutline(int gid, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontExceptionSend a glyph's outline to an OutlineConsumer.
-
getGlyphBBox
public abstract Rect getGlyphBBox(int gid) throws UnsupportedFontException, InvalidFontException
Get the bounding box of a glyph. The returned value is in metric space.
-
getScaler
public Scaler getScaler() throws InvalidFontException, UnsupportedFontException
Get a scaler for this font. This scaler uses to the most appropriate scan converter for the font.
-
getScaler
public abstract Scaler getScaler(ScanConverter c) throws InvalidFontException, UnsupportedFontException
Get a scaler for this font, using a specific scan converter.
-
getSWFFontDescription
public abstract SWFFontDescription getSWFFontDescription(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException
-
getSWFFont4Description
public abstract SWFFont4Description getSWFFont4Description(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException
-
getEmbeddingPermission
public abstract Permission getEmbeddingPermission(boolean wasEmbedded) throws InvalidFontException, UnsupportedFontException
-
getPDFFontDescription
public abstract PDFFontDescription getPDFFontDescription(Font font) throws UnsupportedFontException, InvalidFontException
-
getXDCFontDescription
public abstract XDCFontDescription getXDCFontDescription(Font font) throws UnsupportedFontException, InvalidFontException
-
createSubset
public abstract Subset createSubset() throws InvalidFontException, UnsupportedFontException
Create a subset for this font.
-
subsetAndStream
public abstract void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, java.io.IOException
Subset and stream this font for PDF use. The stream is either a TrueType stream or a CID-keyed CFF stream.- Parameters:
out- the OutputStream to which the bytes are streamedpreserveROS- tells whether to preserve the cid -> gid mapping- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
getCacheSupportInfo
public abstract CacheSupportInfo getCacheSupportInfo() throws UnsupportedFontException, InvalidFontException
Return the CacheSupportInfo that this font matches
-
getPostscriptFontDescription
public abstract PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontException
Return the postscript descriptions that this font matches.
-
getFXGFontDescription
public abstract FXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException
Return the FXG descriptions for this font.
-
getPlatformFontDescription
public abstract PlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException
Return the platform descriptions for this font.
-
getPointSizeRange
public double[] getPointSizeRange() throws InvalidFontException, UnsupportedFontExceptionReturn the range of point sizes for which this font has been designed.- 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:
InvalidFontExceptionUnsupportedFontException
-
getCSS20FontDescription
public CSS20FontDescription[] getCSS20FontDescription() throws InvalidFontException, UnsupportedFontException
-
getPreferredCSS20FontDescription
public CSS20FontDescription getPreferredCSS20FontDescription() throws InvalidFontException, UnsupportedFontException
-
getSelectionDescription
public abstract CatalogDescription getSelectionDescription() throws InvalidFontException, UnsupportedFontException
-
-