Package com.adobe.fontengine.font
Class FontData
java.lang.Object
com.adobe.fontengine.font.FontData
- Direct Known Subclasses:
CFFFont
,OpenTypeFont
,PDFSimpleFont
,Type1Font
,WrapperFontData
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract Subset
Create a subset for this font.abstract CacheSupportInfo
Return the CacheSupportInfo that this font matchesbyte[]
double
Returns the CoolTypeCapHeight of this font.getCoolTypeGlyphBBox
(int glyphID) int
getCoolTypeGlyphForChar
(int unicodeScalarValue) Return the glyph used by CoolType for a character.abstract Rect
abstract Rect
abstract LineMetrics
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.abstract boolean
abstract CoolTypeScript
abstract UnderlineMetrics
double
double
abstract Permission
getEmbeddingPermission
(boolean wasEmbedded) abstract Rect
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.Return the line metrics for this font.abstract int
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[]
Return the range of point sizes for which this font has been designed.abstract PostscriptFontDescription[]
Return the postscript descriptions that this font matches.Get a scaler for this font.abstract Scaler
Get a scaler for this font, using a specific scan converter.abstract CatalogDescription
abstract SWFFont4Description
getSWFFont4Description
(boolean wasEmbedded) abstract SWFFontDescription
getSWFFontDescription
(boolean wasEmbedded) abstract double
abstract double
abstract XDCFontDescription
getXDCFontDescription
(Font font) boolean
Determines whether a font has proportional roman, as defined by CoolType.boolean
Tell whether this font is symbolic.abstract void
subsetAndStream
(Subset subset, OutputStream out, boolean preserveROS) Subset and stream this font for PDF use.
-
Constructor Details
-
FontData
public FontData(byte[] digest)
-
-
Method Details
-
getContainerFingerprint
public byte[] getContainerFingerprint() -
getNumGlyphs
Return the number of glyphs in this font. -
isSymbolic
Tell whether this font is symbolic. -
getUnitsPerEmX
-
getUnitsPerEmY
-
getCoolTypeUnitsPerEm
-
getFontBBox
-
getCoolTypeFontBBox
-
getCoolTypeScript
public abstract CoolTypeScript getCoolTypeScript() throws UnsupportedFontException, InvalidFontException -
getCoolTypeCapHeight
Returns the CoolTypeCapHeight of this font.- Returns:
- Double.NaN if the value cannot be determined
- Throws:
UnsupportedFontException
InvalidFontException
-
getCoolTypeXHeight
-
getCoolTypeIdeoEmBox
-
getCoolTypeIcfBox
-
getCoolTypeGlyphBBox
-
getCoolTypeLineMetrics
public abstract LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontExceptionEmulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.See also the
getLineMetrics()
method. -
getLineMetrics
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
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
Get the bounding box of a glyph. The returned value is in metric space. -
getScaler
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
Create a subset for this font. -
subsetAndStream
public abstract void subsetAndStream(Subset subset, OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, 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
IOException
-
getCacheSupportInfo
public abstract CacheSupportInfo getCacheSupportInfo() throws UnsupportedFontException, InvalidFontExceptionReturn the CacheSupportInfo that this font matches -
getPostscriptFontDescription
public abstract PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontExceptionReturn 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
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
-