LoadFontData method

List<GlyphInfoD> LoadFontData(
  1. Uint8List fileData,
  2. num fontSize,
  3. Int32List? codepoints,
  4. num? codepointCount,
  5. FontType type,
)

Load font data for further use

Implementation

List<GlyphInfoD> LoadFontData(
  Uint8List fileData,
  num fontSize,
  Int32List? codepoints,
  num? codepointCount,
  FontType type,
) => run(
  () => _debugLabels.LoadFontData(fileData, fontSize, codepoints, codepointCount, type),
  () {
    final glyphCount = $.Int$.Ref1();
    final glyphs = _flat.LoadFontData(
      $.UnsignedChar$.Array(fileData),
      fileData.length,
      fontSize.toInt(),
      codepoints == null ? MemoryPointer.nullptr() : $.Int$.Array(codepoints).cast(),
      codepointCount?.toInt() ?? codepoints?.length ?? 0,
      type.value,
      glyphCount,
    );
    final requestedCount = (codepointCount == null || codepointCount == 0)
      ? codepoints?.length ?? glyphCount.value
      : codepointCount.toInt();
    return glyphs.readArray(requestedCount);
  },
);