Package com.adobe.fontengine.font.type1
Class Type1Font
- java.lang.Object
-
- com.adobe.fontengine.font.FontData
-
- com.adobe.fontengine.font.type1.Type1Font
-
public final class Type1Font extends FontData
Gives access to a Type1 font.Synchronization
This class can have a two-step construction. First, the constructor is called, then setMetricFile may be called. This is required because the fontname must be used to determine what metric file aligns with this font. setMetricFile shall only be called one time. It is called before the modules outside of AFE can see the Type1Font object. After the two-phase construction is complete, the class is immutable and threadsafe.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
charCode2gid(int charCode)
String
charCode2GlyphName(int charCode)
Subset
createSubset()
Create a subset for this font.CacheSupportInfo
getCacheSupportInfo()
Return the CacheSupportInfo that this font matchesRect
getCoolTypeIcfBox()
Compute the IcfBox.Rect
getCoolTypeIdeoEmBox()
Compute the IdeoEmBox.LineMetrics
getCoolTypeLineMetrics()
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.boolean
getCoolTypeProportionalRomanFromFontProperties()
Rect
getCoolTypeRawFontBBox()
CoolTypeScript
getCoolTypeScript()
UnderlineMetrics
getCoolTypeUnderlineMetrics()
Set
getCSSFamilyNames()
Return the set of CSS font-family names that this font matches.CSS20Attribute.CSSStretchValue
getCSSStretchValue()
Return the CSS stretch associated with this fontint
getCSSWeight()
Return the CSS weight of this font.Permission
getEmbeddingPermission(boolean wasEmbedded)
Rect
getFontBBox()
URL
getFontLocation()
Matrix
getFontMatrix()
The Type1 font matrix.FXGFontDescription[]
getFXGFontDescription(Platform platform, ULocale locale)
Return the FXG descriptions for this font.Rect
getGlyphBBox(int gid)
Get the bounding box for a glyph, in metric space.int
getGlyphForChar(int usv)
Return the glyph to use to display a character.String
getGlyphName(int glyphID)
Fetch the glyphName associated with a given glyphIDvoid
getGlyphOutline(int gid, OutlineConsumer consumer)
Send a glyph's outline to an OutlineConsumer.double
getHorizontalAdvance(int glyphID)
Get the horizontal advance of the glyphglyphID
.double
getKernValue(int leftGID, int rightGID)
Get the horizontal kerning between two glyphs.MetricFile
getMetricFile()
int
getNumGlyphs()
Fetch the number of glyphs in the fontPDFFontDescription
getPDFFontDescription(Font font)
PlatformFontDescription[]
getPlatformFontDescription(Platform platform, ULocale locale)
Return the platform descriptions for this font.PostscriptFontDescription[]
getPostscriptFontDescription()
Return the postscript descriptions that this font matches.String
getPostscriptName()
Fetch the font name (aka Postscript name) for the fontString
getPreferredCSSFamilyName()
ROS
getROS()
Scaler
getScaler(ScanConverter c)
Get a scaler for this font, using a specific scan converter.CatalogDescription
getSelectionDescription()
double
getStemV()
Return the vertical stem width of the font.SWFFont4Description
getSWFFont4Description(boolean wasEmbedded)
SWFFontDescription
getSWFFontDescription(boolean wasEmbedded)
double
getUnitsPerEmX()
double
getUnitsPerEmY()
XDCFontDescription
getXDCFontDescription(Font font)
int
glyphName2gid(String glyphName)
Looks up a glyph by name and returns its glyphIDboolean
isCSSStyleItalic()
Tell if the font matches the CSS font-style italic.boolean
isCSSStyleNormal()
Tell if the font matches the CSS font-style normal.boolean
isCSSStyleOblique()
Tell if the font matches the CSS font-style oblique.boolean
isCSSVariantNormal()
Tell if the font matches the CSS font-variant normal.boolean
isCSSVariantSmallCaps()
Tell if the font matches the CSS font-style small-caps.boolean
setMetricFile(MetricFile f)
This must be called only just after Type1Font construction (prior to the Type1Font being visible to the client).void
stream(OutputStream out, boolean openTypeOk)
void
subsetAndStream(Subset subset, OutputStream out, boolean preserveROS)
Subset and stream this font for PDF use.void
subsetAndStream(SubsetSimpleType1 t1Subset, OutputStream out)
-
Methods inherited from class com.adobe.fontengine.font.FontData
getContainerFingerprint, getCoolTypeCapHeight, getCoolTypeFontBBox, getCoolTypeGlyphBBox, getCoolTypeGlyphForChar, getCoolTypeUnitsPerEm, getCoolTypeXHeight, getCSS20FontDescription, getLineMetrics, getPointSizeRange, getPreferredCSS20FontDescription, getScaler, hasCoolTypeProportionalRoman, isSymbolic
-
-
-
-
Method Detail
-
getMetricFile
public MetricFile getMetricFile()
-
getFontLocation
public URL getFontLocation()
-
setMetricFile
public boolean setMetricFile(MetricFile f)
This must be called only just after Type1Font construction (prior to the Type1Font being visible to the client). It is NOT to be called by clients of this object.- Parameters:
f
- the metric file that may be associated with this font.
-
glyphName2gid
public int glyphName2gid(String glyphName)
Looks up a glyph by name and returns its glyphID- Parameters:
glyphName
- The name of the glyph- Returns:
- 0 if the glyphName is .notdef or if the glyphName is not found in the font.
-
charCode2GlyphName
public String charCode2GlyphName(int charCode)
-
charCode2gid
public int charCode2gid(int charCode)
-
getNumGlyphs
public int getNumGlyphs()
Fetch the number of glyphs in the font- Specified by:
getNumGlyphs
in classFontData
-
getROS
public ROS getROS()
-
getGlyphName
public String getGlyphName(int glyphID)
Fetch the glyphName associated with a given glyphID
-
getPostscriptName
public String getPostscriptName()
Fetch the font name (aka Postscript name) for the font
-
getStemV
public double getStemV()
Return the vertical stem width of the font.This horizontal metric is expressed in the metric space of the font.
-
getFontMatrix
public Matrix getFontMatrix()
The Type1 font matrix.
-
getUnitsPerEmX
public double getUnitsPerEmX()
- Specified by:
getUnitsPerEmX
in classFontData
-
getUnitsPerEmY
public double getUnitsPerEmY()
- Specified by:
getUnitsPerEmY
in classFontData
-
getFontBBox
public Rect getFontBBox()
- Specified by:
getFontBBox
in classFontData
-
getCoolTypeRawFontBBox
public Rect getCoolTypeRawFontBBox()
-
getCoolTypeScript
public CoolTypeScript getCoolTypeScript() throws UnsupportedFontException, InvalidFontException
- Specified by:
getCoolTypeScript
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getCoolTypeIdeoEmBox
public Rect getCoolTypeIdeoEmBox() throws InvalidFontException, UnsupportedFontException
Compute the IdeoEmBox. Various heuristics are applied until the IdeoEmBox can be determined.- Specified by:
getCoolTypeIdeoEmBox
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getCoolTypeIcfBox
public Rect getCoolTypeIcfBox() throws InvalidFontException, UnsupportedFontException
Compute the IcfBox.This metric is expressed in the metric space of the font.
- Specified by:
getCoolTypeIcfBox
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getCoolTypeLineMetrics
public LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.This vertical metric is expressed in the metric space of the font.
See also the
FontData.getLineMetrics()
method.- Specified by:
getCoolTypeLineMetrics
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getCoolTypeUnderlineMetrics
public UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException
- Specified by:
getCoolTypeUnderlineMetrics
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getGlyphForChar
public int getGlyphForChar(int usv) 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.- Specified by:
getGlyphForChar
in classFontData
- Parameters:
usv
- 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
-
getHorizontalAdvance
public double getHorizontalAdvance(int glyphID) throws InvalidGlyphException, UnsupportedFontException
Get the horizontal advance of the glyphglyphID
.This horizontal metric is expressed in the metric space of the font.
- Specified by:
getHorizontalAdvance
in classFontData
- Throws:
InvalidGlyphException
UnsupportedFontException
-
getKernValue
public double getKernValue(int leftGID, int rightGID) throws InvalidFontException, UnsupportedFontException
Get the horizontal kerning between two glyphs.This horizontal metric is expressed in the metric space of the font.
-
getGlyphOutline
public void getGlyphOutline(int gid, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontData
Send a glyph's outline to an OutlineConsumer.- Specified by:
getGlyphOutline
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getGlyphBBox
public Rect getGlyphBBox(int gid) throws UnsupportedFontException, InvalidFontException
Get the bounding box for a glyph, in metric space.- Specified by:
getGlyphBBox
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getScaler
public Scaler getScaler(ScanConverter c) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontData
Get a scaler for this font, using a specific scan converter.- Specified by:
getScaler
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getCSSFamilyNames
public Set getCSSFamilyNames()
Return the set of CSS font-family names that this font matches.
-
getPreferredCSSFamilyName
public String getPreferredCSSFamilyName()
-
isCSSStyleNormal
public boolean isCSSStyleNormal()
Tell if the font matches the CSS font-style normal.
-
isCSSStyleItalic
public boolean isCSSStyleItalic()
Tell if the font matches the CSS font-style italic.
-
isCSSStyleOblique
public boolean isCSSStyleOblique()
Tell if the font matches the CSS font-style oblique.
-
isCSSVariantNormal
public boolean isCSSVariantNormal()
Tell if the font matches the CSS font-variant normal.
-
isCSSVariantSmallCaps
public boolean isCSSVariantSmallCaps()
Tell if the font matches the CSS font-style small-caps.
-
getCSSWeight
public int getCSSWeight()
Return the CSS weight of this font.
-
getCSSStretchValue
public CSS20Attribute.CSSStretchValue getCSSStretchValue()
Return the CSS stretch associated with this font
-
getCacheSupportInfo
public CacheSupportInfo getCacheSupportInfo() throws InvalidFontException, UnsupportedFontException
Description copied from class:FontData
Return the CacheSupportInfo that this font matches- Specified by:
getCacheSupportInfo
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getPostscriptFontDescription
public PostscriptFontDescription[] getPostscriptFontDescription()
Description copied from class:FontData
Return the postscript descriptions that this font matches.- Specified by:
getPostscriptFontDescription
in classFontData
-
getFXGFontDescription
public FXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontData
Return the FXG descriptions for this font.- Specified by:
getFXGFontDescription
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getPlatformFontDescription
public PlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontData
Return the platform descriptions for this font.- Specified by:
getPlatformFontDescription
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getPDFFontDescription
public PDFFontDescription getPDFFontDescription(Font font)
- Specified by:
getPDFFontDescription
in classFontData
-
getXDCFontDescription
public XDCFontDescription getXDCFontDescription(Font font)
- Specified by:
getXDCFontDescription
in classFontData
-
getCoolTypeProportionalRomanFromFontProperties
public boolean getCoolTypeProportionalRomanFromFontProperties() throws InvalidFontException
- Specified by:
getCoolTypeProportionalRomanFromFontProperties
in classFontData
- Throws:
InvalidFontException
-
getEmbeddingPermission
public Permission getEmbeddingPermission(boolean wasEmbedded)
- Specified by:
getEmbeddingPermission
in classFontData
-
createSubset
public Subset createSubset() throws UnsupportedFontException, InvalidFontException
Description copied from class:FontData
Create a subset for this font.- Specified by:
createSubset
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
subsetAndStream
public void subsetAndStream(Subset subset, OutputStream out, boolean preserveROS) throws InvalidFontException, UnsupportedFontException, IOException
Subset and stream this font for PDF use. The stream is a CID-keyed CFF stream,.- Specified by:
subsetAndStream
in classFontData
- Parameters:
out
- the OutputStream to which the bytes are streamedpreserveROS
- tells whether to preserve the cid -> gid mapping- Throws:
InvalidFontException
UnsupportedFontException
IOException
-
subsetAndStream
public void subsetAndStream(SubsetSimpleType1 t1Subset, OutputStream out) throws InvalidFontException, UnsupportedFontException, IOException
-
stream
public void stream(OutputStream out, boolean openTypeOk) throws InvalidFontException, UnsupportedFontException, IOException
-
getSelectionDescription
public CatalogDescription getSelectionDescription() throws InvalidFontException, UnsupportedFontException
- Specified by:
getSelectionDescription
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getSWFFontDescription
public SWFFontDescription getSWFFontDescription(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException
- Specified by:
getSWFFontDescription
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getSWFFont4Description
public SWFFont4Description getSWFFont4Description(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException
- Specified by:
getSWFFont4Description
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
-