readGlyph method

TtfGlyphInfo readGlyph(
  1. int index
)

Implementation

TtfGlyphInfo readGlyph(int index) {
  assert(index < glyphOffsets.length);

  final start = tableOffsets[glyf_table]! + glyphOffsets[index];

  if (start >= tableSize[glyf_table]! + tableOffsets[glyf_table]! ||
      start == 0) {
    return TtfGlyphInfo(index, Uint8List(0), const <int>[]);
  }

  final numberOfContours = bytes.getInt16(start);
  assert(numberOfContours >= -1);

  if (numberOfContours == -1) {
    return _readCompoundGlyph(index, start, start + 10);
  } else {
    return _readSimpleGlyph(index, start, start + 10, numberOfContours);
  }
}