GenericGlyph.fromSvg constructor

GenericGlyph.fromSvg(
  1. Svg svg
)

Implementation

factory GenericGlyph.fromSvg(Svg svg) {
  final pathList = svg.elementList.whereType<PathElement>();

  final outlines = [
    for (final p in pathList) ...PathToOutlineConverter(svg, p).convert()
  ];

  final metadata = GenericGlyphMetadata(
    name: svg.name,
    ratioX: svg.ratioX,
    ratioY: svg.ratioY,
    offset: svg.offset,
    preview: svg.toBase64(),
  );

  return GenericGlyph(outlines, svg.viewBox, metadata);
}