Class FontImpl
- java.lang.Object
-
- com.adobe.fontengine.font.FontImpl
-
- All Implemented Interfaces:
Font,java.io.Serializable
- Direct Known Subclasses:
Base14Font,MemoryFont,ResourceFont
public abstract class FontImpl extends java.lang.Object implements Font
The base class for all Font objects. This class provides the basic functionality common to all Fonts.Synchronization
These objects are immutable.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FontImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanEmbedForEditting()booleancanEmbedForPrintAndPreview()SubsetcreateSubset()Create a subset for this font.abstract booleanequals(java.lang.Object obj)abstract java.lang.ObjectgetCachedFontDescription(java.lang.String key)abstract java.util.Map<java.lang.String,java.lang.Object>getCachedFontDescriptionMap()CacheSupportInfogetCacheSupportInfo()The new font cache support code starts here, though some code above here has been reworked also.abstract java.lang.StringgetCanonicalPath()RectgetCoolTypeGlyphBBox(int glyphID)Emulates the CoolType API CCTFontInstance::GetBBox.RectgetCoolTypeIcfBox()Emulates the CoolType API CTFontDict:GetICFBox.RectgetCoolTypeIdeoEmBox()Emulates the CoolType API CTFontDict:GetIdeoEmBox.LineMetricsgetCoolTypeLineMetrics()Emulates the CoolType API CTFontDict:GetHorizontalMetrics.CoolTypeScriptgetCoolTypeScript()Emulates the CoolType API CCTFontDict::GetWritingScript.UnderlineMetricsgetCoolTypeUnderlineMetrics()Emulates the CoolType API CTFontDict:GetUnderlineInfo.CSS20FontDescription[]getCSS20FontDescription()Get the CSS20FontDescriptions for this font.FontDatagetFontData()FXGFontDescription[]getFXGFontDescription()Get all of the FXG descriptions for the font.FXGFontDescription[]getFXGFontDescription(Platform platform)Get all of the FXG descriptions for this font on the given platform.FXGFontDescription[]getFXGFontDescription(Platform platform, ULocale locale)Get all of the FXG descriptions for this font on the given platform and for the given locale.abstract longgetLastModified()abstract longgetLength()LineMetricsgetLineMetrics()Return the line metrics for this font.PDFFontDescriptiongetPDFFontDescription()Get the PDFFontDescription for this font.PlatformFontDescription[]getPlatformFontDescription()Get all of the Platform descriptions for the font.PlatformFontDescription[]getPlatformFontDescription(Platform platform)Get all of the Platform descriptions for this font on the given platform.PlatformFontDescription[]getPlatformFontDescription(Platform platform, ULocale locale)Get all of the Platform descriptions for this font on the given platform and for the given locale.PostscriptFontDescription[]getPostscriptFontDescription()Get the PostscriptFontDescriptions for this font.CSS20FontDescriptiongetPreferredCSS20FontDescription()Get the preferred CSS20FontDescriptions for this font.SWFFont4DescriptiongetSWFFont4Description()Fetch data needed to construct a DefineFont4 tag in SWF.SWFFontDescriptiongetSWFFontDescription()Fetch data needed to construct a DefineFont2 or 3 tag in SWF.doublegetUnitsPerEmX()Return the units per em in the X direction.doublegetUnitsPerEmY()Return the units per em in the Y direction.XDCFontDescriptiongetXDCFontDescription()Get the XDCFontDescription for this font.booleanhasCoolTypeProportionalRoman()Emulates the CoolType API CTFontDict::hasPropRoman.abstract inthashCode()booleanisSymbolic()Tell whether the font is symbolic.abstract voidsetCachedFontDescription(java.lang.String key, java.lang.Object value)abstract java.lang.StringtoString()booleanwasEmbedded()Tells whether this font originally was embedded in a document.
-
-
-
Method Detail
-
getUnitsPerEmX
public double getUnitsPerEmX() throws UnsupportedFontException, InvalidFontException, FontLoadingExceptionDescription copied from interface:FontReturn the units per em in the X direction.Unless otherwise specified, horizontal metrics returned by AFE are expressed in a metric space, and must be divided by the units per em in the X direction to get em values.
- Specified by:
getUnitsPerEmXin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getUnitsPerEmY
public double getUnitsPerEmY() throws UnsupportedFontException, InvalidFontException, FontLoadingExceptionDescription copied from interface:FontReturn the units per em in the Y direction.Unless otherwise specified, vertical metrics returned by AFE are expressed in a metric space, and must be divided by the units per em in the Y direction to get em values.
- Specified by:
getUnitsPerEmYin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getLineMetrics
public LineMetrics getLineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException
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.- Specified by:
getLineMetricsin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getCoolTypeGlyphBBox
public Rect getCoolTypeGlyphBBox(int glyphID) throws UnsupportedFontException, InvalidFontException, FontLoadingException
Description copied from interface:FontEmulates the CoolType API CCTFontInstance::GetBBox. In particular, it calculates all bboxes instead of relying on metrics in the font.The metrics are expressed in the metric space of the font.
- Specified by:
getCoolTypeGlyphBBoxin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getCoolTypeLineMetrics
public LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException
Emulates the CoolType API CTFontDict:GetHorizontalMetrics.The metrics are expressed in the metric space of the font.
See also the
getLineMetrics()method.- Specified by:
getCoolTypeLineMetricsin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getCoolTypeScript
public CoolTypeScript getCoolTypeScript() throws FontLoadingException, InvalidFontException, UnsupportedFontException
Description copied from interface:FontEmulates the CoolType API CCTFontDict::GetWritingScript.- Specified by:
getCoolTypeScriptin interfaceFont- Returns:
- The "primary script" associated with this font.
- Throws:
FontLoadingExceptionInvalidFontExceptionUnsupportedFontException
-
getCoolTypeUnderlineMetrics
public UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException
Emulates the CoolType API CTFontDict:GetUnderlineInfo.The metrics are expressed in the metric space of the font.
- Specified by:
getCoolTypeUnderlineMetricsin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getCoolTypeIdeoEmBox
public Rect getCoolTypeIdeoEmBox() throws UnsupportedFontException, InvalidFontException, FontLoadingException
Emulates the CoolType API CTFontDict:GetIdeoEmBox.The metrics are expressed in the metric space of the font.
- Specified by:
getCoolTypeIdeoEmBoxin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
hasCoolTypeProportionalRoman
public boolean hasCoolTypeProportionalRoman() throws UnsupportedFontException, InvalidFontException, FontLoadingExceptionEmulates the CoolType API CTFontDict::hasPropRoman.- Specified by:
hasCoolTypeProportionalRomanin interfaceFont- Returns:
- true if the font contains proportional roman glyphs.
- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
getCoolTypeIcfBox
public Rect getCoolTypeIcfBox() throws UnsupportedFontException, InvalidFontException, FontLoadingException
Emulates the CoolType API CTFontDict:GetICFBox.The metrics are expressed in the metric space of the font.
- Specified by:
getCoolTypeIcfBoxin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
isSymbolic
public boolean isSymbolic() throws UnsupportedFontException, InvalidFontException, FontLoadingExceptionTell whether the font is symbolic.- Specified by:
isSymbolicin interfaceFont- Throws:
UnsupportedFontExceptionInvalidFontExceptionFontLoadingException
-
canEmbedForEditting
public boolean canEmbedForEditting() throws InvalidFontException, UnsupportedFontException, FontLoadingException- Specified by:
canEmbedForEdittingin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
canEmbedForPrintAndPreview
public boolean canEmbedForPrintAndPreview() throws InvalidFontException, UnsupportedFontException, FontLoadingException- Specified by:
canEmbedForPrintAndPreviewin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
createSubset
public Subset createSubset() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Create a subset for this font.- Specified by:
createSubsetin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getFontData
public FontData getFontData() throws InvalidFontException, UnsupportedFontException, FontLoadingException
-
getSWFFont4Description
public SWFFont4Description getSWFFont4Description() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontFetch data needed to construct a DefineFont4 tag in SWF. Returns null if a font does not support DefineFont4.- Specified by:
getSWFFont4Descriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getSWFFontDescription
public SWFFontDescription getSWFFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontFetch data needed to construct a DefineFont2 or 3 tag in SWF.- Specified by:
getSWFFontDescriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getPDFFontDescription
public PDFFontDescription getPDFFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet the PDFFontDescription for this font.- Specified by:
getPDFFontDescriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getXDCFontDescription
public XDCFontDescription getXDCFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet the XDCFontDescription for this font.- Specified by:
getXDCFontDescriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getPostscriptFontDescription
public PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet the PostscriptFontDescriptions for this font.- Specified by:
getPostscriptFontDescriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getCSS20FontDescription
public CSS20FontDescription[] getCSS20FontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet the CSS20FontDescriptions for this font.- Specified by:
getCSS20FontDescriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getPreferredCSS20FontDescription
public CSS20FontDescription getPreferredCSS20FontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet the preferred CSS20FontDescriptions for this font. Returns null if there is no CSS20 description for this font.- Specified by:
getPreferredCSS20FontDescriptionin interfaceFont- Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getFXGFontDescription
public FXGFontDescription[] getFXGFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet all of the FXG descriptions for the font.- Specified by:
getFXGFontDescriptionin interfaceFont- Returns:
- an array of all the FXG descriptions for the font
or
nullif there are none - Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getFXGFontDescription
public FXGFontDescription[] getFXGFontDescription(Platform platform) throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet all of the FXG descriptions for this font on the given platform.- Specified by:
getFXGFontDescriptionin interfaceFont- Parameters:
platform- the platform to get descriptions for- Returns:
- an array of all of the specified FXG descriptions for the font
or
nullif there are none - Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getFXGFontDescription
public FXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet all of the FXG descriptions for this font on the given platform and for the given locale.- Specified by:
getFXGFontDescriptionin interfaceFont- Parameters:
platform- the platform to get descriptions forlocale- the locale to get descriptions for- Returns:
- an array of all of the specified FXG descriptions for the font
or
nullif there are none - Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getPlatformFontDescription
public PlatformFontDescription[] getPlatformFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet all of the Platform descriptions for the font.- Specified by:
getPlatformFontDescriptionin interfaceFont- Returns:
- an array of all the Platform descriptions for the font
or
nullif there are none - Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getPlatformFontDescription
public PlatformFontDescription[] getPlatformFontDescription(Platform platform) throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet all of the Platform descriptions for this font on the given platform.- Specified by:
getPlatformFontDescriptionin interfaceFont- Parameters:
platform- the platform to get descriptions for- Returns:
- an array of all of the specified Platform descriptions for the font
or
nullif there are none - Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getPlatformFontDescription
public PlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException, FontLoadingException
Description copied from interface:FontGet all of the Platform descriptions for this font on the given platform and for the given locale.- Specified by:
getPlatformFontDescriptionin interfaceFont- Parameters:
platform- the platform to get descriptions forlocale- the locale to get descriptions for- Returns:
- an array of all of the specified Platform descriptions for the font
or
nullif there are none - Throws:
InvalidFontExceptionUnsupportedFontExceptionFontLoadingException
-
getCacheSupportInfo
public CacheSupportInfo getCacheSupportInfo() throws InvalidFontException, UnsupportedFontException, FontLoadingException
The new font cache support code starts here, though some code above here has been reworked also. The cached CacheSupportInfo of a font is used to allow the IntelligentResolver to operate entirely from cached data without have to re-parse the font.
-
getCanonicalPath
public abstract java.lang.String getCanonicalPath()
-
getLength
public abstract long getLength()
-
getLastModified
public abstract long getLastModified()
-
getCachedFontDescription
public abstract java.lang.Object getCachedFontDescription(java.lang.String key)
-
getCachedFontDescriptionMap
public abstract java.util.Map<java.lang.String,java.lang.Object> getCachedFontDescriptionMap()
-
setCachedFontDescription
public abstract void setCachedFontDescription(java.lang.String key, java.lang.Object value)
-
wasEmbedded
public boolean wasEmbedded()
Tells whether this font originally was embedded in a document.- Returns:
- true iff the font was embedded according to our client.
-
hashCode
public abstract int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public abstract java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-