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 intcharCode2gid(int charCode)java.lang.StringcharCode2GlyphName(int charCode)SubsetcreateSubset()Create a subset for this font.CacheSupportInfogetCacheSupportInfo()Return the CacheSupportInfo that this font matchesRectgetCoolTypeIcfBox()Compute the IcfBox.RectgetCoolTypeIdeoEmBox()Compute the IdeoEmBox.LineMetricsgetCoolTypeLineMetrics()Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.booleangetCoolTypeProportionalRomanFromFontProperties()RectgetCoolTypeRawFontBBox()CoolTypeScriptgetCoolTypeScript()UnderlineMetricsgetCoolTypeUnderlineMetrics()java.util.SetgetCSSFamilyNames()Return the set of CSS font-family names that this font matches.CSS20Attribute.CSSStretchValuegetCSSStretchValue()Return the CSS stretch associated with this fontintgetCSSWeight()Return the CSS weight of this font.PermissiongetEmbeddingPermission(boolean wasEmbedded)RectgetFontBBox()java.net.URLgetFontLocation()MatrixgetFontMatrix()The Type1 font matrix.FXGFontDescription[]getFXGFontDescription(Platform platform, ULocale locale)Return the FXG descriptions for this font.RectgetGlyphBBox(int gid)Get the bounding box for a glyph, in metric space.intgetGlyphForChar(int usv)Return the glyph to use to display a character.java.lang.StringgetGlyphName(int glyphID)Fetch the glyphName associated with a given glyphIDvoidgetGlyphOutline(int gid, OutlineConsumer consumer)Send a glyph's outline to an OutlineConsumer.doublegetHorizontalAdvance(int glyphID)Get the horizontal advance of the glyphglyphID.doublegetKernValue(int leftGID, int rightGID)Get the horizontal kerning between two glyphs.MetricFilegetMetricFile()intgetNumGlyphs()Fetch the number of glyphs in the fontPDFFontDescriptiongetPDFFontDescription(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.java.lang.StringgetPostscriptName()Fetch the font name (aka Postscript name) for the fontjava.lang.StringgetPreferredCSSFamilyName()ROSgetROS()ScalergetScaler(ScanConverter c)Get a scaler for this font, using a specific scan converter.CatalogDescriptiongetSelectionDescription()doublegetStemV()Return the vertical stem width of the font.SWFFont4DescriptiongetSWFFont4Description(boolean wasEmbedded)SWFFontDescriptiongetSWFFontDescription(boolean wasEmbedded)doublegetUnitsPerEmX()doublegetUnitsPerEmY()XDCFontDescriptiongetXDCFontDescription(Font font)intglyphName2gid(java.lang.String glyphName)Looks up a glyph by name and returns its glyphIDbooleanisCSSStyleItalic()Tell if the font matches the CSS font-style italic.booleanisCSSStyleNormal()Tell if the font matches the CSS font-style normal.booleanisCSSStyleOblique()Tell if the font matches the CSS font-style oblique.booleanisCSSVariantNormal()Tell if the font matches the CSS font-variant normal.booleanisCSSVariantSmallCaps()Tell if the font matches the CSS font-style small-caps.booleansetMetricFile(MetricFile f)This must be called only just after Type1Font construction (prior to the Type1Font being visible to the client).voidstream(java.io.OutputStream out, boolean openTypeOk)voidsubsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS)Subset and stream this font for PDF use.voidsubsetAndStream(SubsetSimpleType1 t1Subset, java.io.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 java.net.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(java.lang.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 java.lang.String charCode2GlyphName(int charCode)
-
charCode2gid
public int charCode2gid(int charCode)
-
getNumGlyphs
public int getNumGlyphs()
Fetch the number of glyphs in the font- Specified by:
getNumGlyphsin classFontData
-
getROS
public ROS getROS()
-
getGlyphName
public java.lang.String getGlyphName(int glyphID)
Fetch the glyphName associated with a given glyphID
-
getPostscriptName
public java.lang.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:
getUnitsPerEmXin classFontData
-
getUnitsPerEmY
public double getUnitsPerEmY()
- Specified by:
getUnitsPerEmYin classFontData
-
getFontBBox
public Rect getFontBBox()
- Specified by:
getFontBBoxin classFontData
-
getCoolTypeRawFontBBox
public Rect getCoolTypeRawFontBBox()
-
getCoolTypeScript
public CoolTypeScript getCoolTypeScript() throws UnsupportedFontException, InvalidFontException
- Specified by:
getCoolTypeScriptin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeIdeoEmBox
public Rect getCoolTypeIdeoEmBox() throws InvalidFontException, UnsupportedFontException
Compute the IdeoEmBox. Various heuristics are applied until the IdeoEmBox can be determined.- Specified by:
getCoolTypeIdeoEmBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCoolTypeIcfBox
public Rect getCoolTypeIcfBox() throws InvalidFontException, UnsupportedFontException
Compute the IcfBox.This metric is expressed in the metric space of the font.
- Specified by:
getCoolTypeIcfBoxin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
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:
getCoolTypeLineMetricsin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getCoolTypeUnderlineMetrics
public UnderlineMetrics getCoolTypeUnderlineMetrics() throws UnsupportedFontException, InvalidFontException
- Specified by:
getCoolTypeUnderlineMetricsin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getGlyphForChar
public int getGlyphForChar(int usv) throws InvalidFontException, UnsupportedFontExceptionReturn 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:
getGlyphForCharin 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:
InvalidFontExceptionUnsupportedFontException
-
getHorizontalAdvance
public double getHorizontalAdvance(int glyphID) throws InvalidGlyphException, UnsupportedFontExceptionGet the horizontal advance of the glyphglyphID.This horizontal metric is expressed in the metric space of the font.
- Specified by:
getHorizontalAdvancein classFontData- Throws:
InvalidGlyphExceptionUnsupportedFontException
-
getKernValue
public double getKernValue(int leftGID, int rightGID) throws InvalidFontException, UnsupportedFontExceptionGet 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, UnsupportedFontExceptionDescription copied from class:FontDataSend a glyph's outline to an OutlineConsumer.- Specified by:
getGlyphOutlinein classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getGlyphBBox
public Rect getGlyphBBox(int gid) throws UnsupportedFontException, InvalidFontException
Get the bounding box for a glyph, in metric space.- Specified by:
getGlyphBBoxin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getScaler
public Scaler getScaler(ScanConverter c) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontDataGet a scaler for this font, using a specific scan converter.- Specified by:
getScalerin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getCSSFamilyNames
public java.util.Set getCSSFamilyNames()
Return the set of CSS font-family names that this font matches.
-
getPreferredCSSFamilyName
public java.lang.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:FontDataReturn the CacheSupportInfo that this font matches- Specified by:
getCacheSupportInfoin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getPostscriptFontDescription
public PostscriptFontDescription[] getPostscriptFontDescription()
Description copied from class:FontDataReturn the postscript descriptions that this font matches.- Specified by:
getPostscriptFontDescriptionin classFontData
-
getFXGFontDescription
public FXGFontDescription[] getFXGFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontDataReturn the FXG descriptions for this font.- Specified by:
getFXGFontDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getPlatformFontDescription
public PlatformFontDescription[] getPlatformFontDescription(Platform platform, ULocale locale) throws InvalidFontException, UnsupportedFontException
Description copied from class:FontDataReturn the platform descriptions for this font.- Specified by:
getPlatformFontDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getPDFFontDescription
public PDFFontDescription getPDFFontDescription(Font font)
- Specified by:
getPDFFontDescriptionin classFontData
-
getXDCFontDescription
public XDCFontDescription getXDCFontDescription(Font font)
- Specified by:
getXDCFontDescriptionin classFontData
-
getCoolTypeProportionalRomanFromFontProperties
public boolean getCoolTypeProportionalRomanFromFontProperties() throws InvalidFontException- Specified by:
getCoolTypeProportionalRomanFromFontPropertiesin classFontData- Throws:
InvalidFontException
-
getEmbeddingPermission
public Permission getEmbeddingPermission(boolean wasEmbedded)
- Specified by:
getEmbeddingPermissionin classFontData
-
createSubset
public Subset createSubset() throws UnsupportedFontException, InvalidFontException
Description copied from class:FontDataCreate a subset for this font.- Specified by:
createSubsetin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
subsetAndStream
public 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 a CID-keyed CFF stream,.- Specified by:
subsetAndStreamin classFontData- Parameters:
out- the OutputStream to which the bytes are streamedpreserveROS- tells whether to preserve the cid -> gid mapping- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
subsetAndStream
public void subsetAndStream(SubsetSimpleType1 t1Subset, java.io.OutputStream out) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
stream
public void stream(java.io.OutputStream out, boolean openTypeOk) throws InvalidFontException, UnsupportedFontException, java.io.IOException- Throws:
InvalidFontExceptionUnsupportedFontExceptionjava.io.IOException
-
getSelectionDescription
public CatalogDescription getSelectionDescription() throws InvalidFontException, UnsupportedFontException
- Specified by:
getSelectionDescriptionin classFontData- Throws:
InvalidFontExceptionUnsupportedFontException
-
getSWFFontDescription
public SWFFontDescription getSWFFontDescription(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException
- Specified by:
getSWFFontDescriptionin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
getSWFFont4Description
public SWFFont4Description getSWFFont4Description(boolean wasEmbedded) throws UnsupportedFontException, InvalidFontException
- Specified by:
getSWFFont4Descriptionin classFontData- Throws:
UnsupportedFontExceptionInvalidFontException
-
-