Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

Fungsi: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

Beta

Hasilkan laluan glif terisi untuk SVG ikon.

Parameter

svg

string

Penanda SVG sebaris.

Mengembalikan

GlyphPath

Laluan terisi d (dalam koordinat viewBox) dan saiz viewBox.

Contoh

Garis besar ikon berasaskan strok (Lucide) dan ikon berasaskan isian

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)