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.Object
The 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 Subset
createSubset()
Create a subset for this font.abstract CacheSupportInfo
getCacheSupportInfo()
Return the CacheSupportInfo that this font matchesbyte[]
getContainerFingerprint()
double
getCoolTypeCapHeight()
Returns the CoolTypeCapHeight of this font.Rect
getCoolTypeFontBBox()
Rect
getCoolTypeGlyphBBox(int glyphID)
int
getCoolTypeGlyphForChar(int unicodeScalarValue)
Return the glyph used by CoolType for a character.abstract Rect
getCoolTypeIcfBox()
abstract Rect
getCoolTypeIdeoEmBox()
abstract LineMetrics
getCoolTypeLineMetrics()
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.abstract boolean
getCoolTypeProportionalRomanFromFontProperties()
abstract CoolTypeScript
getCoolTypeScript()
abstract UnderlineMetrics
getCoolTypeUnderlineMetrics()
double
getCoolTypeUnitsPerEm()
double
getCoolTypeXHeight()
CSS20FontDescription[]
getCSS20FontDescription()
abstract Permission
getEmbeddingPermission(boolean wasEmbedded)
abstract Rect
getFontBBox()
abstract FXGFontDescription[]
getFXGFontDescription(Platform platform, ULocale locale)
Return the FXG descriptions for this font.abstract Rect
getGlyphBBox(int gid)
Get the bounding box of a glyph.abstract int
getGlyphForChar(int unicodeScalarValue)
Return the glyph to use to display a character.abstract void
getGlyphOutline(int gid, OutlineConsumer consumer)
Send a glyph's outline to an OutlineConsumer.abstract double
getHorizontalAdvance(int gid)
Get the horizontal advance of a glyph.LineMetrics
getLineMetrics()
Return the line metrics for this font.abstract int
getNumGlyphs()
Return the number of glyphs in this font.abstract PDFFontDescription
getPDFFontDescription(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.CSS20FontDescription
getPreferredCSS20FontDescription()
Scaler
getScaler()
Get a scaler for this font.abstract Scaler
getScaler(ScanConverter c)
Get a scaler for this font, using a specific scan converter.abstract CatalogDescription
getSelectionDescription()
abstract SWFFont4Description
getSWFFont4Description(boolean wasEmbedded)
abstract SWFFontDescription
getSWFFontDescription(boolean wasEmbedded)
abstract double
getUnitsPerEmX()
abstract double
getUnitsPerEmY()
abstract XDCFontDescription
getXDCFontDescription(Font font)
boolean
hasCoolTypeProportionalRoman()
Determines whether a font has proportional roman, as defined by CoolType.boolean
isSymbolic()
Tell whether this font is symbolic.abstract void
subsetAndStream(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, UnsupportedFontException
Return the number of glyphs in this font.
-
isSymbolic
public boolean isSymbolic() throws UnsupportedFontException, InvalidFontException
Tell 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, InvalidFontException
Returns the CoolTypeCapHeight of this font.- Returns:
- Double.NaN if the value cannot be determined
- Throws:
UnsupportedFontException
InvalidFontException
-
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, UnsupportedFontException
Determines whether a font has proportional roman, as defined by CoolType.- Returns:
- whether the font is proportional
- Throws:
InvalidFontException
UnsupportedFontException
-
getCoolTypeProportionalRomanFromFontProperties
public abstract boolean getCoolTypeProportionalRomanFromFontProperties() throws InvalidFontException
- Throws:
InvalidFontException
-
getGlyphForChar
public abstract int getGlyphForChar(int unicodeScalarValue) throws InvalidFontException, UnsupportedFontException
Return 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:
InvalidFontException
UnsupportedFontException
-
getCoolTypeGlyphForChar
public int getCoolTypeGlyphForChar(int unicodeScalarValue) throws InvalidFontException, UnsupportedFontException
Return 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, InvalidFontException
Get the horizontal advance of a glyph. The returned value is in metric space.
-
getGlyphOutline
public abstract void getGlyphOutline(int gid, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontException
Send 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:
InvalidFontException
UnsupportedFontException
java.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, UnsupportedFontException
Return 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:
InvalidFontException
UnsupportedFontException
-
getCSS20FontDescription
public CSS20FontDescription[] getCSS20FontDescription() throws InvalidFontException, UnsupportedFontException
-
getPreferredCSS20FontDescription
public CSS20FontDescription getPreferredCSS20FontDescription() throws InvalidFontException, UnsupportedFontException
-
getSelectionDescription
public abstract CatalogDescription getSelectionDescription() throws InvalidFontException, UnsupportedFontException
-
-