类 FontFactory

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

public final class FontFactory extends Object
The font factory. This is the root class for the creation and loading of fonts.
作者:
Stuart Gill
  • 字段详细资料

    • LOOKAHEAD_SIZE

      private static final int LOOKAHEAD_SIZE
      另请参阅:
  • 构造器详细资料

    • FontFactory

      private FontFactory()
      Constructor.
  • 方法详细资料

    • loadFonts

      public static Font[] loadFonts(InputStream is) throws IOException
      Load the font(s) from the input stream. The current settings on the factory are used during the loading process. One or more fonts are returned if the stream contains valid font data. Some font container formats may have more than one font and in this case multiple font objects will be returned. If the data in the stream cannot be parsed or is invalid an array of size zero will be returned.
      参数:
      is - the input stream font data
      返回:
      one or more fonts
      抛出:
      IOException
    • loadFontsForBuilding

      public static Font.Builder[] loadFontsForBuilding(InputStream is) throws IOException
      Load the font(s) from the input stream into font builders. The current settings on the factory are used during the loading process. One or more font builders are returned if the stream contains valid font data. Some font container formats may have more than one font and in this case multiple font builder objects will be returned. If the data in the stream cannot be parsed or is invalid an array of size zero will be returned.
      参数:
      is - the input stream font data
      返回:
      one or more font builders
      抛出:
      IOException
    • loadSingleOTF

      private static Font loadSingleOTF(InputStream is) throws IOException
      抛出:
      IOException
    • loadCollection

      private static Font[] loadCollection(InputStream is) throws IOException
      抛出:
      IOException
    • loadSingleOTFForBuilding

      private static Font.Builder loadSingleOTFForBuilding(InputStream is) throws IOException
      抛出:
      IOException
    • loadCollectionForBuilding

      private static Font.Builder[] loadCollectionForBuilding(InputStream is) throws IOException
      抛出:
      IOException
    • isCollection

      private static boolean isCollection(PushbackInputStream pbis) throws IOException
      抛出:
      IOException
    • loadFonts

      public static Font[] loadFonts(byte[] b) throws IOException
      Load the font(s) from the byte array. The current settings on the factory are used during the loading process. One or more fonts are returned if the stream contains valid font data. Some font container formats may have more than one font and in this case multiple font objects will be returned. If the data in the stream cannot be parsed or is invalid an array of size zero will be returned.
      参数:
      b - the font data
      返回:
      one or more fonts
      抛出:
      IOException
    • loadSingleOTF

      private static Font loadSingleOTF(WritableFontData wfd) throws IOException
      抛出:
      IOException
    • loadCollection

      private static Font[] loadCollection(WritableFontData wfd) throws IOException
      抛出:
      IOException
    • loadSingleOTFForBuilding

      private static Font.Builder loadSingleOTFForBuilding(WritableFontData wfd, int offsetToOffsetTable) throws IOException
      抛出:
      IOException
    • loadCollectionForBuilding

      private static Font.Builder[] loadCollectionForBuilding(WritableFontData wfd) throws IOException
      抛出:
      IOException
    • isCollection

      private static boolean isCollection(ReadableFontData rfd)
    • serializeFont

      public static void serializeFont(Font font, OutputStream os) throws IOException
      Serialize the font to the output stream.
      参数:
      font - the font to serialize
      os - the destination stream for the font
      抛出:
      IOException
    • serializeFont

      public static void serializeFont(Font font, OutputStream os, List<Integer> tableOrdering) throws IOException
      Serialize the font to the output stream.
      参数:
      font - the font to serialize
      os - the destination stream for the font
      tableOrdering -
      抛出:
      IOException
    • newFontBuilder

      public static Font.Builder newFontBuilder()
      Get an empty font builder for creating a new font from scratch.
      返回:
      an empty font builder