stringMetrics method

  1. @override
PdfFontMetrics stringMetrics(
  1. String s, {
  2. double letterSpacing = 0,
})
override

Calculate the PdfFontMetrics for this string

Implementation

@override
PdfFontMetrics stringMetrics(String s, {double letterSpacing = 0}) {
  if (s.isEmpty || !font.unicode) {
    return super.stringMetrics(s, letterSpacing: letterSpacing);
  }

  final runes = s.runes;
  final bytes = <int>[];
  runes.forEach(bytes.add);

  final metrics = bytes.map(glyphMetrics);
  return PdfFontMetrics.append(metrics, letterSpacing: letterSpacing);
}