类 Font.Builder

java.lang.Object
com.google.typography.font.sfntly.Font.Builder
封闭类:
Font

public static final class Font.Builder extends Object
A builder for a font object. The builder allows the for the creation of immutable Font objects. The builder is a one use non-thread safe object and cnce the Font object has been created it is no longer usable. To create a further Font object new builder will be required.
作者:
Stuart Gill
  • 字段详细资料

    • tableBuilders

      private Map<Integer,Table.Builder<? extends Table>> tableBuilders
    • sfntVersion

      private int sfntVersion
    • numTables

      private int numTables
    • searchRange

      private int searchRange
    • entrySelector

      private int entrySelector
    • rangeShift

      private int rangeShift
    • dataBlocks

      private Map<Header,WritableFontData> dataBlocks
    • digest

      private byte[] digest
  • 构造器详细资料

    • Builder

      private Builder()
  • 方法详细资料

    • loadFont

      private void loadFont(InputStream is) throws IOException
      抛出:
      IOException
    • loadFont

      private void loadFont(WritableFontData wfd, int offsetToOffsetTable) throws IOException
      抛出:
      IOException
    • getOTFBuilder

      static final Font.Builder getOTFBuilder(InputStream is) throws IOException
      抛出:
      IOException
    • getOTFBuilder

      static final Font.Builder getOTFBuilder(WritableFontData wfd, int offsetToOffsetTable) throws IOException
      抛出:
      IOException
    • getOTFBuilder

      static final Font.Builder getOTFBuilder()
    • readyToBuild

      public boolean readyToBuild()
      Is the font ready to build?
      返回:
      true if ready to build; false otherwise
    • build

      public Font build()
      Build the Font. After this call this builder will no longer be usable.
      返回:
      a Font
    • setDigest

      public void setDigest(byte[] digest)
      Set a unique fingerprint for the font object.
      参数:
      digest - a unique identifier for the font
    • clearTableBuilders

      public void clearTableBuilders()
      Clear all table builders.
    • hasTableBuilder

      public boolean hasTableBuilder(int tag)
      Does this font builder have the specified table builder.
      参数:
      tag - the table builder tag
      返回:
      true if there is a builder for that table; false otherwise
    • getTableBuilder

      public Table.Builder<? extends Table> getTableBuilder(int tag)
      Get the table builder for the given tag. If there is no builder for that tag then return a null.
      参数:
      tag - the table builder tag
      返回:
      the builder for the tag; null if there is no builder for that tag
    • newTableBuilder

      public Table.Builder<? extends Table> newTableBuilder(int tag)
      Creates a new empty table builder for the table type given by the table id tag. This new table will be added to the font and will replace any existing builder for that table.
      参数:
      tag -
      返回:
      new empty table of the type specified by tag; if tag is not known then a generic OpenTypeTable is returned
    • newTableBuilder

      public Table.Builder<? extends Table> newTableBuilder(int tag, ReadableFontData srcData)
      Creates a new table builder for the table type given by the table id tag. It makes a copy of the data provided and uses that copy for the table. This new table has been added to the font and will replace any existing builder for that table.
      参数:
      tag -
      srcData -
      返回:
      new empty table of the type specified by tag; if tag is not known then a generic OpenTypeTable is returned
    • tableBuilderMap

      public Map<Integer,Table.Builder<? extends Table>> tableBuilderMap()
      Get a map of the table builders in this font builder accessed by table tag.
      返回:
      an unmodifiable view of the table builders in this font builder
    • removeTableBuilder

      public Table.Builder<? extends Table> removeTableBuilder(int tag)
      Remove the specified table builder from the font builder.
      参数:
      tag - the table builder to remove
      返回:
      the table builder removed
    • tableBuilderCount

      public int tableBuilderCount()
      Get the number of table builders in the font builder.
      返回:
      the number of table builders
    • sfntWrapperSize

      private int sfntWrapperSize()
    • buildAllTableBuilders

      private Map<Integer,Table.Builder<? extends Table>> buildAllTableBuilders(Map<Header,WritableFontData> tableData)
    • getTableBuilder

      private Table.Builder<? extends Table> getTableBuilder(Header header, WritableFontData data)
    • buildTablesFromBuilders

      private static Map<Integer,Table> buildTablesFromBuilders(Font font, Map<Integer,Table.Builder<? extends Table>> builderMap)
    • interRelateBuilders

      private static void interRelateBuilders(Map<Integer,Table.Builder<? extends Table>> builderMap)
    • readHeader

      private SortedSet<Header> readHeader(FontInputStream is) throws IOException
      抛出:
      IOException
    • loadTableData

      private Map<Header,WritableFontData> loadTableData(SortedSet<Header> headers, FontInputStream is) throws IOException
      抛出:
      IOException
    • readHeader

      private SortedSet<Header> readHeader(ReadableFontData fd, int offset)
    • loadTableData

      private Map<Header,WritableFontData> loadTableData(SortedSet<Header> headers, WritableFontData fd)