Package org.apache.fontbox.cff
Class CFFCharset
java.lang.Object
org.apache.fontbox.cff.CFFCharset
- Direct Known Subclasses:
CFFExpertCharset,CFFExpertSubsetCharset,CFFISOAdobeCharset,CFFParser.EmbeddedCharset
A CFF charset. A charset is an array of SIDs/CIDs for all glyphs in the font.
todo: split this into two? CFFCharsetType1 and CFFCharsetCID ?
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCFFCharset(boolean isCIDFont) Package-private constructor for use by subclasses. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCID(int gid, int cid) Adds a new GID/CID combination to the charset.voidAdds a new GID/SID/name combination to the charset.intgetCIDForGID(int gid) Returns the CID for the given GID.intgetGIDForCID(int cid) Returns the GID for a given CID.(package private) intgetGIDForSID(int sid) Returns the GID for the given SID.getNameForGID(int gid) Returns the PostScript glyph name for the given GID.(package private) intReturns the SID for a given PostScript name, you would think this is not needed, but some fonts have glyphs beyond their encoding with charset SID names.(package private) intgetSIDForGID(int gid) Returns the SID for a given GID.booleanIndicates if the charset belongs to a CID font.
-
Field Details
-
isCIDFont
private final boolean isCIDFont -
sidOrCidToGid
-
gidToSid
-
nameToSid
-
gidToCid
-
gidToName
-
-
Constructor Details
-
CFFCharset
CFFCharset(boolean isCIDFont) Package-private constructor for use by subclasses.- Parameters:
isCIDFont- true if the parent font is a CIDFont
-
-
Method Details
-
isCIDFont
public boolean isCIDFont()Indicates if the charset belongs to a CID font.- Returns:
- true for CID fonts
-
addSID
Adds a new GID/SID/name combination to the charset.- Parameters:
gid- GIDsid- SID
-
addCID
public void addCID(int gid, int cid) Adds a new GID/CID combination to the charset.- Parameters:
gid- GIDcid- CID
-
getSIDForGID
int getSIDForGID(int gid) Returns the SID for a given GID. SIDs are internal to the font and are not public.- Parameters:
gid- GID- Returns:
- SID
-
getGIDForSID
int getGIDForSID(int sid) Returns the GID for the given SID. SIDs are internal to the font and are not public.- Parameters:
sid- SID- Returns:
- GID
-
getGIDForCID
public int getGIDForCID(int cid) Returns the GID for a given CID. Returns 0 if the CID is missing.- Parameters:
cid- CID- Returns:
- GID
-
getSID
Returns the SID for a given PostScript name, you would think this is not needed, but some fonts have glyphs beyond their encoding with charset SID names.- Parameters:
name- PostScript glyph name- Returns:
- SID
-
getNameForGID
Returns the PostScript glyph name for the given GID.- Parameters:
gid- GID- Returns:
- PostScript glyph name
-
getCIDForGID
public int getCIDForGID(int gid) Returns the CID for the given GID.- Parameters:
gid- GID- Returns:
- CID
-