Class EmbeddedCharset

java.lang.Object
org.apache.fontbox.cff.EmbeddedCharset
All Implemented Interfaces:
CFFCharset
Direct Known Subclasses:
CFFParser.Format0Charset, CFFParser.Format1Charset, CFFParser.Format2Charset

class EmbeddedCharset extends Object implements CFFCharset
Class representing an embedded CFF charset.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final CFFCharset
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    EmbeddedCharset(boolean isCIDFont)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCID(int gid, int cid)
    Adds a new GID/CID combination to the charset.
    void
    addSID(int gid, int sid, String name)
    Adds a new GID/SID/name combination to the charset.
    int
    getCIDForGID(int gid)
    Returns the CID for the given GID.
    int
    getGIDForCID(int cid)
    Returns the GID for a given CID.
    int
    getGIDForSID(int sid)
    Returns the GID for the given SID.
    getNameForGID(int gid)
    Returns the PostScript glyph name for the given GID.
    int
    getSID(String name)
    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.
    int
    getSIDForGID(int sid)
    Returns the SID for a given GID.
    boolean
    Indicates if the charset belongs to a CID font.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • EmbeddedCharset

      EmbeddedCharset(boolean isCIDFont)
  • Method Details

    • getCIDForGID

      public int getCIDForGID(int gid)
      Description copied from interface: CFFCharset
      Returns the CID for the given GID.
      Specified by:
      getCIDForGID in interface CFFCharset
      Parameters:
      gid - GID
      Returns:
      CID
    • isCIDFont

      public boolean isCIDFont()
      Description copied from interface: CFFCharset
      Indicates if the charset belongs to a CID font.
      Specified by:
      isCIDFont in interface CFFCharset
      Returns:
      true for CID fonts
    • addSID

      public void addSID(int gid, int sid, String name)
      Description copied from interface: CFFCharset
      Adds a new GID/SID/name combination to the charset.
      Specified by:
      addSID in interface CFFCharset
      Parameters:
      gid - GID
      sid - SID
      name - the postscript name of the glyph
    • addCID

      public void addCID(int gid, int cid)
      Description copied from interface: CFFCharset
      Adds a new GID/CID combination to the charset.
      Specified by:
      addCID in interface CFFCharset
      Parameters:
      gid - GID
      cid - CID
    • getSIDForGID

      public int getSIDForGID(int sid)
      Description copied from interface: CFFCharset
      Returns the SID for a given GID. SIDs are internal to the font and are not public.
      Specified by:
      getSIDForGID in interface CFFCharset
      Parameters:
      sid - GID
      Returns:
      SID
    • getGIDForSID

      public int getGIDForSID(int sid)
      Description copied from interface: CFFCharset
      Returns the GID for the given SID. SIDs are internal to the font and are not public.
      Specified by:
      getGIDForSID in interface CFFCharset
      Parameters:
      sid - SID
      Returns:
      GID
    • getGIDForCID

      public int getGIDForCID(int cid)
      Description copied from interface: CFFCharset
      Returns the GID for a given CID. Returns 0 if the CID is missing.
      Specified by:
      getGIDForCID in interface CFFCharset
      Parameters:
      cid - CID
      Returns:
      GID
    • getSID

      public int getSID(String name)
      Description copied from interface: CFFCharset
      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.
      Specified by:
      getSID in interface CFFCharset
      Parameters:
      name - PostScript glyph name
      Returns:
      SID
    • getNameForGID

      public String getNameForGID(int gid)
      Description copied from interface: CFFCharset
      Returns the PostScript glyph name for the given GID.
      Specified by:
      getNameForGID in interface CFFCharset
      Parameters:
      gid - GID
      Returns:
      PostScript glyph name