Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

Funktion: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

Beta

Erzeuge einen gefüllten Glyphenpfad für ein Icon-SVG.

Parameter

svg

string

SVG-Markup inline.

Rückgabe

GlyphPath

Der gefüllte Pfad d (in ViewBox-Koordinaten) und die ViewBox-Größe.

Beispiel

Eine strichbasierte (Lucide) Icon umreißen und eine füllbasierte Icon

ts
import { svgToGlyphPath } from "@pantoken/icon-font";
import { getIcon } from "@pantoken/icons";

const { d, width, height } = svgToGlyphPath(getIcon("arrow-left")!.svg);
// d: a single filled path; width/height: the viewBox size (e.g. 24, 24)