Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

Fonction: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

Bêta

Produire un tracé de glyphe rempli pour un SVG d'icône.

Paramètres

svg

string

Marquage SVG en ligne.

Retourne

GlyphPath

Le tracé rempli d (en coordonnées de viewBox) et la taille du viewBox.

Exemple

Tracer le contour d'une icône basée sur des traits (Lucide) et d'une icône basée sur un remplissage

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)