of static method

SlugGlyphData of(
  1. PdfPath outline
)

Implementation

static SlugGlyphData of(PdfPath outline) {
  final cached = _cache[outline];
  if (cached != null) return cached;
  final sw = Stopwatch()..start();
  SlugGlyphData result;
  try {
    final quads = outlineToQuads(outline);
    final bands = buildBands(quads, bandCount: 8);
    if (quads.isEmpty || bands.overflow) {
      result = _overflow;
    } else {
      final stream = encodeGlyphStream(quads, bands);
      result = SlugGlyphData._(stream, stream.length ~/ 4, bands.bandCount,
          bands.minX, bands.minY, bands.maxX, bands.maxY, false);
    }
  } on ArgumentError {
    result = _overflow;
  }
  totalBuildMicros += sw.elapsedMicroseconds;
  totalBuilds++;
  _cache[outline] = result;
  return result;
}