Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

Função: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

Beta

Produzir um caminho de glifo preenchido para um SVG de ícone.

Parâmetros

svg

string

Marcação SVG embutida.

Retorna

GlyphPath

O caminho preenchido d (em coordenadas do viewBox) e o tamanho do viewBox.

Exemplo

Delimitar um ícone baseado em traço (Lucide) e um ícone baseado em preenchimento

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)