Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

Functie: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

Bèta

Genereer een ingevuld glyph-pad voor een icoon-SVG.

Parameters

svg

string

Inline SVG-markup.

Retourneert

GlyphPath

Het ingevulde pad d (in viewBox-coördinaten) en de viewBox-grootte.

Voorbeeld

Schets de omtrek van een op-stroke gebaseerde (Lucide) icoon en van een op-vulling gebaseerde icoon

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)