widthFor method

double widthFor(
  1. UPdfCodePoint point
)

Implementation

double widthFor(UPdfCodePoint point) {
  final double? explicit = widths[isType0 ? point.cid : point.code];
  if (explicit != null) return explicit;
  if (isType0) return defaultWidth;
  final double? missing = widths[-1];
  if (missing != null) return missing;
  final UPdfGlyphSource? source = glyphs;
  if (source != null) {
    final int gid = glyphIdFor(point);
    if (gid > 0) {
      final double units = source.advance(gid);
      return units * 1000 / source.unitsPerEm;
    }
  }
  return _fallbackWidth(point);
}