Class TrueTypeCollection

java.lang.Object
org.ofdrw.converter.font.TrueTypeCollection

public class TrueTypeCollection extends Object
A TrueType Collection, now more properly known as a "Font Collection" as it may contain either TrueType or OpenType fonts.
Author:
John Hewson
  • Constructor Details

    • TrueTypeCollection

      public TrueTypeCollection()
  • Method Details

    • parse

      public TrueTypeCollection parse(TTFDataStream stream) throws IOException
      Creates a new TrueTypeCollection from a TTC stream.
      Parameters:
      stream - The TTF file.
      Returns:
      this
      Throws:
      IOException - If the font could not be parsed.
    • getFontAtIndex

      public TrueTypeFont getFontAtIndex(int idx) throws IOException
      通过字体索引获取字体
      Parameters:
      idx - 索引号
      Returns:
      字体
      Throws:
      IOException - IOE
    • foreach

      public void foreach(Consumer<TrueTypeFont> cn) throws IOException
      遍历字体集合中的所有字体
      Parameters:
      cn - 字体集合
      Throws:
      IOException - IOE
    • getNumFonts

      public int getNumFonts()
      字体总数
      Returns:
      总数