Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

Funzione: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

Beta

Genera un tracciato glifo riempito per un'icona SVG.

Parametri

svg

string

Inserisci il markup SVG inline.

Restituisce

GlyphPath

Il percorso riempito d (nelle coordinate del viewBox) e la dimensione del viewBox.

Esempio

Delinea un'icona basata su tratto (Lucide) e un'icona basata su riempimento

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)