public interface Font extends Serializable
This class provides the basic functionality common to all Fonts.
Metrics are expressed in a metric space, which is related
to the em space by the matrix (1/ux 0, 0, 1/uy), where
ux is the units per em in the X direction and uy is the units per em
in the Y direction. Those two quantities can be retrieved by the
getUnitsPerEmX() and getUnitsPerEmY() methods.
The values ux and uy may or may not be related to any data in the font;
they are only guaranteed to be compatible with the values returned
by methods that retrieve metrics. In other words, if x is an
horizontal metric returned by some method, only the value x / ux is
meaningful, and the specific values x and ux may change from one execution
to the next (ux is constant for the life of a Font object).
Very often (but not always), the font metrics stored in the font are expressed in the metric space (or conversely, the metric space is selected to be the space in which the raw font data is expressed). Returning metrics in the metric space, instead of in the em space, allows the conversion to the em space to be performed less often (e.g. only after metrics such as the advance width have been cumulated). Another benefit is that the conversion to em space is often followed by a conversion to some kind of user space (e.g. scaling by the point size, or expressing the result in some other units than points); those further conversions can be combined with the metric to em space conversion, resulting in less computations.
A font contains a number of glyphs, which are identified by their gids. Gids are by construction in the range [0, numGlyphs-1[. The glyph with gid 0 has a special meaning: it is the .notdef glyph, which is used, e.g. when a font contains no glyph for a given character.
Implementations of this interface are synchronized as needed, so that users can use a Font in multiple threads without synchronization on their side.
A symbolic font is an OpenType font (without or without OpenType tables) which does not have Unicode cmap, but has a Microsoft/Symbol cmap. The fonts Wingdings, Webdings, and Symbol that are provided by Microsoft are symbolic fonts. The symbol cmaps, typically maps the code points 0xF0 yz
AFE behaves as if those fonts had a Unicode cmap. If 0xF0 yz is mapped in the symbolic cmap, then both U+F0 yz and U+00 yz are mapped in the Unicode cmap. The purpose of this double mapping is to approximate the behavior of GDI and applications such as Word.
The first set of mappings, from U+F0 yz , are rather innocuous, as
those code points are Private Use Area, and have very little semantic. The
second set of mappings, from U+00 yz , are very problematic, because
the the semantic of the source characters is typically not applicable. This
is particulary true for the glyphs mapped from U+0000 .. U+001F and U+0080 ..
U+009F (because those characters have the semantic of control character) and
the glyph mapped from U+00AD SOFT HYPHEN (which is a Cf character that is not
normally rendered). Other strange behavior can occur in bidi processing and
line breaking processing. To help clients avoid those problems,
the isSymbolic() method returns true for symbolic fonts.
| Modifier and Type | Method and Description |
|---|---|
boolean |
canEmbedForEditting() |
boolean |
canEmbedForPrintAndPreview() |
Subset |
createSubset()
Create a subset for this font.
|
Rect |
getCoolTypeGlyphBBox(int glyphID)
Emulates the CoolType API CCTFontInstance::GetBBox.
|
Rect |
getCoolTypeIcfBox()
Emulates the CoolType API CTFontDict:GetICFBox.
|
Rect |
getCoolTypeIdeoEmBox()
Emulates the CoolType API CTFontDict:GetIdeoEmBox.
|
LineMetrics |
getCoolTypeLineMetrics()
Emulates the CoolType API CTFontDict:GetHorizontalMetrics.
|
CoolTypeScript |
getCoolTypeScript()
Emulates the CoolType API CCTFontDict::GetWritingScript.
|
UnderlineMetrics |
getCoolTypeUnderlineMetrics()
Emulates the CoolType API CTFontDict:GetUnderlineInfo.
|
CSS20FontDescription[] |
getCSS20FontDescription()
Get the CSS20FontDescriptions for this font.
|
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.
|
LineMetrics |
getLineMetrics()
Return the line metrics for this font, as expressed by the
font designer.
|
PDFFontDescription |
getPDFFontDescription()
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.
|
CSS20FontDescription |
getPreferredCSS20FontDescription()
Get the preferred CSS20FontDescriptions for this font.
|
SWFFont4Description |
getSWFFont4Description()
Fetch data needed to construct a DefineFont4 tag in SWF.
|
SWFFontDescription |
getSWFFontDescription()
Fetch data needed to construct a DefineFont2 or 3 tag in SWF.
|
double |
getUnitsPerEmX()
Return the units per em in the X direction.
|
double |
getUnitsPerEmY()
Return the units per em in the Y direction.
|
XDCFontDescription |
getXDCFontDescription()
Get the XDCFontDescription for this font.
|
boolean |
hasCoolTypeProportionalRoman()
Emulates the CoolType API CTFontDict::hasPropRoman.
|
boolean |
isSymbolic()
Tell whether the font is symbolic.
|
double getUnitsPerEmX()
throws UnsupportedFontException,
InvalidFontException,
FontLoadingException
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.
double getUnitsPerEmY()
throws UnsupportedFontException,
InvalidFontException,
FontLoadingException
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.
LineMetrics getLineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException
The metrics are expressed in the metric space of the 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.
LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException
The metrics are expressed in the metric space of the font.
See also the getLineMetrics() method.
Rect getCoolTypeGlyphBBox(int glyphID) throws UnsupportedFontException, InvalidFontException, FontLoadingException
The metrics are expressed in the metric space of the font.
UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException, FontLoadingException
The metrics are expressed in the metric space of the font.
CoolTypeScript getCoolTypeScript() throws FontLoadingException, InvalidFontException, UnsupportedFontException
FontLoadingExceptionInvalidFontExceptionUnsupportedFontExceptionRect getCoolTypeIdeoEmBox() throws UnsupportedFontException, InvalidFontException, FontLoadingException
The metrics are expressed in the metric space of the font.
boolean hasCoolTypeProportionalRoman()
throws UnsupportedFontException,
InvalidFontException,
FontLoadingException
UnsupportedFontExceptionInvalidFontExceptionFontLoadingExceptionRect getCoolTypeIcfBox() throws UnsupportedFontException, InvalidFontException, FontLoadingException
The metrics are expressed in the metric space of the font.
boolean isSymbolic()
throws UnsupportedFontException,
InvalidFontException,
FontLoadingException
boolean canEmbedForPrintAndPreview()
throws InvalidFontException,
UnsupportedFontException,
FontLoadingException
boolean canEmbedForEditting()
throws InvalidFontException,
UnsupportedFontException,
FontLoadingException
Subset createSubset() throws InvalidFontException, UnsupportedFontException, FontLoadingException
SWFFontDescription getSWFFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
SWFFont4Description getSWFFont4Description() throws InvalidFontException, UnsupportedFontException, FontLoadingException
PDFFontDescription getPDFFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
XDCFontDescription getXDCFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
PostscriptFontDescription[] getPostscriptFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
CSS20FontDescription[] getCSS20FontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
CSS20FontDescription getPreferredCSS20FontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
FXGFontDescription[] getFXGFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
null if there are noneInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionFXGFontDescription[] getFXGFontDescription(Platform platform) throws InvalidFontException, UnsupportedFontException, FontLoadingException
platform - the platform to get descriptions fornull if there are noneInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionFXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException, FontLoadingException
platform - the platform to get descriptions forlocale - the locale to get descriptions fornull if there are noneInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionPlatformFontDescription[] getPlatformFontDescription() throws InvalidFontException, UnsupportedFontException, FontLoadingException
null if there are noneInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionPlatformFontDescription[] getPlatformFontDescription(Platform platform) throws InvalidFontException, UnsupportedFontException, FontLoadingException
platform - the platform to get descriptions fornull if there are noneInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionPlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException, FontLoadingException
platform - the platform to get descriptions forlocale - the locale to get descriptions fornull if there are noneInvalidFontExceptionUnsupportedFontExceptionFontLoadingExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved