glyphMetrics method

  1. @override
PdfFontMetrics glyphMetrics(
  1. int charCode
)
override

Calculate the PdfFontMetrics for this glyph

Implementation

@override
PdfFontMetrics glyphMetrics(int charCode) {
  final g = font.charToGlyphIndexMap[charCode];

  if (g == null) {
    return PdfFontMetrics.zero;
  }

  if (useBidi && bidi.isArabicDiacriticValue(charCode)) {
    final metric = font.glyphInfoMap[g] ?? PdfFontMetrics.zero;
    return metric.copyWith(advanceWidth: 0);
  }

  if (useArabic && arabic.isArabicDiacriticValue(charCode)) {
    final metric = font.glyphInfoMap[g] ?? PdfFontMetrics.zero;
    return metric.copyWith(advanceWidth: 0);
  }

  return font.glyphInfoMap[g] ?? PdfFontMetrics.zero;
}