///|
/// TrueType table-directory record.
pub(all) struct PdfTrueTypeTableRecord {
  tag : String
  checksum : UInt32
  offset : Int32
  length : Int32
} derive(Debug, Eq, ToJson)

///|
/// Core metrics extracted from TrueType `head`, `hhea`, `hmtx`, and `maxp`.
pub(all) struct PdfTrueTypeMetrics {
  units_per_em : Int32
  minx : Int32
  miny : Int32
  maxx : Int32
  maxy : Int32
  index_to_loc_format : Int32
  num_glyphs : Int32
  num_of_long_hor_metrics : Int32
  advance_widths : Array[Int32]
  max_width : Int32
} derive(Debug, Eq, ToJson)

///|
/// Font descriptor metrics derived from TrueType tables.
pub(all) struct PdfTrueTypeDescriptorMetrics {
  ascent : Int32
  descent : Int32
  capheight : Int32
  xheight : Int32
  avgwidth : Int32
  italicangle : Int32
  nonsymbolic_flags : Int32
  symbolic_flags : Int32
} derive(Debug, Eq, ToJson)

///|
/// Mapping from a Unicode codepoint to a TrueType glyph index.
pub(all) struct PdfTrueTypeCMapGlyph {
  codepoint : Int32
  glyph_index : Int32
} derive(Debug, Eq, ToJson)

///|
/// Byte range for one glyph inside the TrueType `glyf` table.
pub(all) struct PdfTrueTypeGlyphByteRange {
  glyph_index : Int32
  start_offset : Int32
  end_offset : Int32
} derive(Debug, Eq, ToJson)

///|
/// Result of splitting a TrueType Unicode subset into cpdf's main and higher
/// subset groups.
pub(all) struct PdfTrueTypeSubsetPartition {
  main_subset : Array[Int32]
  higher_subsets : Array[Array[Int32]]
} derive(Debug, Eq, ToJson)

///|
/// Rebuilt subset-table bytes and their unpadded logical length.
pub(all) struct PdfTrueTypeSubsetTable {
  length : Int32
  bytes : Bytes
} derive(Debug, Eq)

///|
/// One subset record returned by cpdf-style TrueType parsing.
pub(all) struct PdfTrueTypeParsedSubset {
  flags : Int32
  minx : Int32
  miny : Int32
  maxx : Int32
  maxy : Int32
  italicangle : Int32
  ascent : Int32
  descent : Int32
  capheight : Int32
  stemv : Int32
  xheight : Int32
  avgwidth : Int32
  maxwidth : Int32
  firstchar : Int32
  lastchar : Int32
  widths : Array[Int32]
  subset_fontfile : Bytes
  subset : Array[Int32]
  tounicode : Array[(Int32, Bytes)]?
} derive(Debug, Eq)