类 Font

java.lang.Object
com.google.typography.font.sfntly.Font

public class Font extends Object
An sfnt container font object. This object is immutable and thread safe. To construct one use an instance of Font.Builder.
作者:
Stuart Gill
  • 字段详细资料

    • logger

      private static final Logger logger
    • CFF_TABLE_ORDERING

      private static final List<Integer> CFF_TABLE_ORDERING
      Ordering of tables for different font types.
    • TRUE_TYPE_TABLE_ORDERING

      private static final List<Integer> TRUE_TYPE_TABLE_ORDERING
    • SFNTVERSION_1

      public static final int SFNTVERSION_1
    • sfntVersion

      private final int sfntVersion
    • digest

      private final byte[] digest
    • checksum

      private long checksum
    • tables

      private Map<Integer,? extends Table> tables
  • 构造器详细资料

    • Font

      private Font(int sfntVersion, byte[] digest)
      Constructor.
      参数:
      sfntVersion - the sfnt version
      digest - the computed digest for the font; null if digest was not computed
  • 方法详细资料

    • sfntVersion

      public int sfntVersion()
      Gets the sfnt version set in the sfnt wrapper of the font.
      返回:
      the sfnt version
    • digest

      public byte[] digest()
      Gets a copy of the fonts digest that was created when the font was read. If no digest was set at creation time then the return result will be null.
      返回:
      a copy of the digest array or null if one wasn't set at creation time
    • checksum

      public long checksum()
      Get the checksum for this font.
      返回:
      the font checksum
    • numTables

      public int numTables()
      Get the number of tables in this font.
      返回:
      the number of tables
    • iterator

      public Iterator<? extends Table> iterator()
      Get an iterator over all the tables in the font.
      返回:
      a table iterator
    • hasTable

      public boolean hasTable(int tag)
      Does the font have a particular table.
      参数:
      tag - the table identifier
      返回:
      true if the table is in the font; false otherwise
    • getTable

      public <T extends Table> T getTable(int tag)
      Get the table in this font with the specified id.
      类型参数:
      T - the type of the table
      参数:
      tag - the identifier of the table
      返回:
      the table specified if it exists; null otherwise
    • tableMap

      public Map<Integer,? extends Table> tableMap()
      Get a map of the tables in this font accessed by table tag.
      返回:
      an unmodifiable view of the tables in this font
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • serialize

      void serialize(OutputStream os, List<Integer> tableOrdering) throws IOException
      Serialize the font to the output stream.
      参数:
      os - the destination for the font serialization
      tableOrdering - the table ordering to apply
      抛出:
      IOException
    • buildTableHeadersForSerialization

      private List<Header> buildTableHeadersForSerialization(List<Integer> tableOrdering)
      Build the table headers to be used for serialization. These headers will be filled out with the data required for serialization. The headers will be sorted in the order specified and only those specified will have headers generated.
      参数:
      tableOrdering - the tables to generate headers for and the order to sort them
      返回:
      a list of table headers ready for serialization
    • serializeHeader

      private void serializeHeader(FontOutputStream fos, List<Header> tableHeaders) throws IOException
      Searialize the headers.
      参数:
      fos - the destination stream for the headers
      tableHeaders - the headers to serialize
      抛出:
      IOException
    • serializeTables

      private void serializeTables(FontOutputStream fos, List<Header> tableHeaders) throws IOException
      Serialize the tables.
      参数:
      fos - the destination stream for the headers
      tableHeaders - the headers for the tables to serialize
      抛出:
      IOException
    • generateTableOrdering

      private List<Integer> generateTableOrdering(List<Integer> defaultTableOrdering)
      Generate the full table ordering to used for serialization. The full ordering uses the partial ordering as a seed and then adds all remaining tables in the font in an undefined order.
      参数:
      defaultTableOrdering - the partial ordering to be used as a seed for the full ordering
      返回:
      the full ordering for serialization
    • defaultTableOrdering

      private List<Integer> defaultTableOrdering()
      Get the default table ordering based on the type of the font.
      返回:
      the default table ordering