Class CFFCharset

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.Integer,​java.lang.Integer> gidToCid  
      private java.util.Map<java.lang.Integer,​java.lang.String> gidToName  
      private java.util.Map<java.lang.Integer,​java.lang.Integer> gidToSid  
      private boolean isCIDFont  
      private java.util.Map<java.lang.String,​java.lang.Integer> nameToSid  
      private java.util.Map<java.lang.Integer,​java.lang.Integer> sidOrCidToGid  
    • Constructor Summary

      Constructors 
      Constructor Description
      CFFCharset​(boolean isCIDFont)
      Package-private constructor for use by subclasses.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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, java.lang.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.
      (package private) int getGIDForSID​(int sid)
      Returns the GID for the given SID.
      java.lang.String getNameForGID​(int gid)
      Returns the PostScript glyph name for the given GID.
      (package private) int getSID​(java.lang.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.
      (package private) int getSIDForGID​(int sid)
      Returns the SID for a given GID.
      boolean isCIDFont()
      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 Detail

      • isCIDFont

        private final boolean isCIDFont
      • sidOrCidToGid

        private final java.util.Map<java.lang.Integer,​java.lang.Integer> sidOrCidToGid
      • gidToSid

        private final java.util.Map<java.lang.Integer,​java.lang.Integer> gidToSid
      • nameToSid

        private final java.util.Map<java.lang.String,​java.lang.Integer> nameToSid
      • gidToCid

        private final java.util.Map<java.lang.Integer,​java.lang.Integer> gidToCid
      • gidToName

        private final java.util.Map<java.lang.Integer,​java.lang.String> gidToName
    • Constructor Detail

      • CFFCharset

        CFFCharset​(boolean isCIDFont)
        Package-private constructor for use by subclasses.
        Parameters:
        isCIDFont - true if the parent font is a CIDFont
    • Method Detail

      • isCIDFont

        public boolean isCIDFont()
        Indicates if the charset belongs to a CID font.
        Returns:
        true for CID fonts
      • addSID

        public void addSID​(int gid,
                           int sid,
                           java.lang.String name)
        Adds a new GID/SID/name combination to the charset.
        Parameters:
        gid - GID
        sid - SID
      • addCID

        public void addCID​(int gid,
                           int cid)
        Adds a new GID/CID combination to the charset.
        Parameters:
        gid - GID
        cid - CID
      • getSIDForGID

        int getSIDForGID​(int sid)
        Returns the SID for a given GID. SIDs are internal to the font and are not public.
        Parameters:
        sid - SID
        Returns:
        GID
      • 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

        int getSID​(java.lang.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.
        Parameters:
        name - PostScript glyph name
        Returns:
        SID
      • getNameForGID

        public java.lang.String getNameForGID​(int gid)
        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