pathFor method

Path? pathFor(
  1. UPdfCodePoint point
)

Implementation

Path? pathFor(UPdfCodePoint point) {
  final int key = isType0 ? point.cid | 0x1000000 : point.code;
  if (_pathCache.containsKey(key)) return _pathCache[key];
  final UPdfGlyphSource? source = glyphs;
  Path? path;
  if (source != null) {
    final int gid = glyphIdFor(point);
    final Path? raw = source.glyphPath(gid);
    if (raw != null) {
      final double scale = 1 / (source.unitsPerEm <= 0 ? 1000 : source.unitsPerEm);
      path = raw.transform(Float64List.fromList(<double>[scale, 0, 0, 0, 0, scale, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]));
    }
  }
  if (_pathCache.length > 2048) _pathCache.clear();
  _pathCache[key] = path;
  return path;
}