Package com.independentsoft.office.pdf

# Class TrueTypeFont

java.lang.Object
com.independentsoft.office.pdf.TrueTypeFont

public class TrueTypeFont extends Object
Minimal TrueType font parser. Reads the tables needed to embed a font in a PDF file as a CIDFontType2 font: glyph metrics, the character to glyph mapping and the values for the font descriptor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getAdvanceWidth​(int glyphId)`
  Gets the advance width of a glyph in font units.
  `int`
  `getAdvanceWidth1000​(int glyphId)`
  Gets the advance width of a glyph in PDF glyph space units (thousandths of the font size).
  `int`
  `getAscent1000()`
  `int[]`
  `getBBox1000()`
  `int`
  `getCapHeight1000()`
  `byte[]`
  `getData()`
  `int`
  `getDescent1000()`
  `String`
  `getFamilyName()`
  `int`
  `getGlyphId​(int codePoint)`
  Gets the glyph id for a Unicode code point, or 0 (missing glyph) when the font has no glyph for it.
  `double`
  `getItalicAngle()`
  `String`
  `getSubfamilyName()`
  `int`
  `getUnitsPerEm()`
  `boolean`
  `isBold()`
  `boolean`
  `isFixedPitch()`
  `boolean`
  `isItalic()`
  `static TrueTypeFont`
  `parse​(byte[] fontData, boolean metadataOnly)`
  Parses a TrueType font.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### parse

    public static TrueTypeFont parse​(byte[] fontData, boolean metadataOnly)
    Parses a TrueType font. Returns null when the data is not a usable TrueType font (for example a CFF-based OpenType font, which cannot be embedded as FontFile2).
    Parameters:
      `fontData` - the raw bytes of a .ttf or .ttc file
      `metadataOnly` - when true only the name and style tables are parsed
    Returns:
      the parsed font or null

  - ### getGlyphId

    public int getGlyphId​(int codePoint)
    Gets the glyph id for a Unicode code point, or 0 (missing glyph) when the font has no glyph for it.
    Parameters:
      `codePoint` - the Unicode code point
    Returns:
      the glyph id

  - ### getAdvanceWidth

    public int getAdvanceWidth​(int glyphId)
    Gets the advance width of a glyph in font units.
    Parameters:
      `glyphId` - the glyph id
    Returns:
      the advance width in font units

  - ### getAdvanceWidth1000

    public int getAdvanceWidth1000​(int glyphId)
    Gets the advance width of a glyph in PDF glyph space units (thousandths of the font size).
    Parameters:
      `glyphId` - the glyph id
    Returns:
      the advance width scaled to 1000 units per em

  - ### getData

    public byte[] getData()

  - ### getUnitsPerEm

    public int getUnitsPerEm()

  - ### getAscent1000

    public int getAscent1000()

  - ### getDescent1000

    public int getDescent1000()

  - ### getCapHeight1000

    public int getCapHeight1000()

  - ### getBBox1000

    public int[] getBBox1000()

  - ### getItalicAngle

    public double getItalicAngle()

  - ### isFixedPitch

    public boolean isFixedPitch()

  - ### isBold

    public boolean isBold()

  - ### isItalic

    public boolean isItalic()

  - ### getFamilyName

    public String getFamilyName()

  - ### getSubfamilyName

    public String getSubfamilyName()