Package com.adobe.fontengine.font.cff
Class CIDKeyedFont
- java.lang.Object
-
- com.adobe.fontengine.font.FontData
-
- com.adobe.fontengine.font.cff.CFFFont
-
- com.adobe.fontengine.font.cff.CIDKeyedFont
-
public final class CIDKeyedFont extends CFFFont
Represents a CID-keyed font.
-
-
Constructor Summary
Constructors Constructor Description CIDKeyedFont(java.lang.String name, Dict topDict, CharStrings charStrings, int numGlyphs, Dict ciddict, Dict privateDict)
CIDKeyedFont(java.lang.String name, Dict topDict, CharStrings charStrings, int numGlyphs, Dict cidDict, Dict privateDict, CharStrings lSubrs, CharStrings gSubrs)
This constructor is called from Glyf.subsetAndStreamForCFF and is by the new TT->CFF-IdentityCID code for DF4.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
cid2gid(int cid)
Subset
createSubset()
Create a subset for this font.int
getCIDCount()
LineMetrics
getCoolTypeLineMetrics()
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.Permission
getEmbeddingPermission(boolean wasEmbedded)
int
getFirstChar()
Rect
getFontBBox()
Matrix
getFontMatrix()
Matrix
getFontMatrix(int component)
Allows recover of concatenated font matrix from a CID component.int
getGlyphCid(int gid)
Return the CID of the glyphgid
.int
getGlyphForChar(int usv)
Return the glyph to use to display a character.java.lang.String
getGlyphName(int gid)
Return the name of glyphgid
.void
getGlyphOutline(int gid, OutlineConsumer consumer)
Get the outline of glyphgid
.double
getHorizontalAdvance(int gid)
Get the horizontal advance of a glyph.int
getLastChar()
int
getNumGlyphs()
Return the number of glyphs in this font.void
getOutline(int gid, Type2OutlineParser parser, OutlineConsumer consumer)
Return the outline of glyphgid
.PDFFontDescription
getPDFFontDescription(Font font)
Rect
getRawFontBBox()
ROS
getROS()
Get the ROS associated with this font.double
getStemVForGlyph(int gid)
XDCFontDescription
getXDCFontDescription(Font font)
void
stream(java.io.OutputStream out, java.lang.Integer fsType)
void
subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS, java.lang.Integer fsType)
A version of subsetAndStream that can take an fsType value to be added to the fonts postscript string.void
subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS, java.lang.Integer fsType, boolean enableSubrizer)
void
subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS, java.lang.Integer fsType, boolean enableSubrizer, boolean rebuildCharstrings)
Added yet another boolean to make this code serve on the new TT->CFF-IdentityCID path for DF4.-
Methods inherited from class com.adobe.fontengine.font.cff.CFFFont
getCacheSupportInfo, getCoolTypeIcfBox, getCoolTypeIdeoEmBox, getCoolTypeProportionalRomanFromFontProperties, getCoolTypeScript, getCoolTypeUnderlineMetrics, getCoolTypeUnderlineMetrics, getCSSFamilyNames, getCSSStretchValue, getCSSWeight, getFXGFontDescription, getGlyphBBox, getName, getPlatformFontDescription, getPostscriptFontDescription, getPreferredCSSFamilyName, getScaler, getSelectionDescription, getSWFFont4Description, getSWFFontDescription, getUnitsPerEmX, getUnitsPerEmY, isCSSStyleItalic, isCSSStyleNormal, isCSSStyleOblique, isCSSVariantNormal, isCSSVariantSmallCaps, isFixedPitch, subsetAndStream
-
Methods inherited from class com.adobe.fontengine.font.FontData
getContainerFingerprint, getCoolTypeCapHeight, getCoolTypeFontBBox, getCoolTypeGlyphBBox, getCoolTypeGlyphForChar, getCoolTypeUnitsPerEm, getCoolTypeXHeight, getCSS20FontDescription, getLineMetrics, getPointSizeRange, getPreferredCSS20FontDescription, getScaler, hasCoolTypeProportionalRoman, isSymbolic
-
-
-
-
Constructor Detail
-
CIDKeyedFont
public CIDKeyedFont(java.lang.String name, Dict topDict, CharStrings charStrings, int numGlyphs, Dict ciddict, Dict privateDict) throws InvalidFontException, UnsupportedFontException
-
CIDKeyedFont
public CIDKeyedFont(java.lang.String name, Dict topDict, CharStrings charStrings, int numGlyphs, Dict cidDict, Dict privateDict, CharStrings lSubrs, CharStrings gSubrs) throws InvalidFontException, UnsupportedFontException
This constructor is called from Glyf.subsetAndStreamForCFF and is by the new TT->CFF-IdentityCID code for DF4.
-
-
Method Detail
-
createSubset
public Subset createSubset() throws InvalidFontException, UnsupportedFontException
Create a subset for this font.- Specified by:
createSubset
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getNumGlyphs
public int getNumGlyphs()
Description copied from class:FontData
Return the number of glyphs in this font.- Specified by:
getNumGlyphs
in classFontData
-
getGlyphName
public java.lang.String getGlyphName(int gid)
Return the name of glyphgid
. Since glyphs in CID-keyed font don't have names, we return null.- Specified by:
getGlyphName
in classCFFFont
-
getROS
public ROS getROS()
Description copied from class:CFFFont
Get the ROS associated with this font. If the font does not have an ROS, return null.
-
getCIDCount
public int getCIDCount()
-
getGlyphCid
public int getGlyphCid(int gid) throws InvalidFontException, UnsupportedFontException
Return the CID of the glyphgid
.- Specified by:
getGlyphCid
in classCFFFont
- Returns:
- the CID in the ROS associated with the font.
- Throws:
InvalidFontException
UnsupportedFontException
-
cid2gid
public int cid2gid(int cid) throws InvalidFontException, UnsupportedFontException
-
getGlyphOutline
public void getGlyphOutline(int gid, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontException
Get the outline of glyphgid
.- Specified by:
getGlyphOutline
in classCFFFont
- Parameters:
gid
- the glyph id of the glyphconsumer
- the OutlineConsumer to receive the outline- Throws:
InvalidFontException
UnsupportedFontException
-
getOutline
public void getOutline(int gid, Type2OutlineParser parser, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontException
Return the outline of glyphgid
.- Specified by:
getOutline
in classCFFFont
- Throws:
InvalidFontException
UnsupportedFontException
-
getStemVForGlyph
public double getStemVForGlyph(int gid) throws InvalidFontException
- Specified by:
getStemVForGlyph
in classCFFFont
- Throws:
InvalidFontException
-
getFontMatrix
public Matrix getFontMatrix()
- Specified by:
getFontMatrix
in classCFFFont
-
getFontMatrix
public Matrix getFontMatrix(int component)
Allows recover of concatenated font matrix from a CID component.
-
getHorizontalAdvance
public double getHorizontalAdvance(int gid) throws InvalidFontException, UnsupportedFontException
Get the horizontal advance of a glyph. The returned value is in metric space.- Specified by:
getHorizontalAdvance
in classCFFFont
- Throws:
InvalidFontException
UnsupportedFontException
-
getRawFontBBox
public Rect getRawFontBBox()
-
getFontBBox
public Rect getFontBBox() throws InvalidFontException, UnsupportedFontException
- Specified by:
getFontBBox
in classFontData
- Throws:
InvalidFontException
UnsupportedFontException
-
getCoolTypeLineMetrics
public LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException
Emulates the CoolType API CTFontDict:GetHorizontalMetrics CoolType API.The metrics are expressed in the design space of the font, i.e. they need to be converted through the metrics matrix.
This methods never returns null.
See also the
FontData.getLineMetrics()
method.- Specified by:
getCoolTypeLineMetrics
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getFirstChar
public int getFirstChar() throws InvalidFontException, UnsupportedFontException
-
getLastChar
public int getLastChar() throws InvalidFontException, UnsupportedFontException
-
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 classCFFFont
- 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
-
getEmbeddingPermission
public Permission getEmbeddingPermission(boolean wasEmbedded)
- Specified by:
getEmbeddingPermission
in classFontData
-
subsetAndStream
public void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS, java.lang.Integer fsType) throws InvalidFontException, UnsupportedFontException, java.io.IOException
Description copied from class:CFFFont
A version of subsetAndStream that can take an fsType value to be added to the fonts postscript string.- Specified by:
subsetAndStream
in classCFFFont
fsType
- if non-null an integer as described in technote 5147 http://partners.adobe.com/public/developer/en/acrobat/sdk/FontPolicies.pdf "Font Embedding Guidelines for Adobe Third-party Developers".- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
subsetAndStream
public void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS, java.lang.Integer fsType, boolean enableSubrizer) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
subsetAndStream
public void subsetAndStream(Subset subset, java.io.OutputStream out, boolean preserveROS, java.lang.Integer fsType, boolean enableSubrizer, boolean rebuildCharstrings) throws InvalidFontException, UnsupportedFontException, java.io.IOException
Added yet another boolean to make this code serve on the new TT->CFF-IdentityCID path for DF4. TODO: The addition of the "rebuildCharstrings" boolean makes this code too ugly and complicated to be left like this. It needs to be re-worked, somehow.- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
getPDFFontDescription
public PDFFontDescription getPDFFontDescription(Font font) throws UnsupportedFontException, InvalidFontException
- Specified by:
getPDFFontDescription
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
getXDCFontDescription
public XDCFontDescription getXDCFontDescription(Font font) throws UnsupportedFontException, InvalidFontException
- Specified by:
getXDCFontDescription
in classFontData
- Throws:
UnsupportedFontException
InvalidFontException
-
stream
public void stream(java.io.OutputStream out, java.lang.Integer fsType) throws InvalidFontException, UnsupportedFontException, java.io.IOException
- Specified by:
stream
in classCFFFont
- Throws:
InvalidFontException
UnsupportedFontException
java.io.IOException
-
-