Skip to content

pantoken-root / formats/icon-font/src / svgToGlyphPath

Função: svgToGlyphPath() ​

svgToGlyphPath(svg): GlyphPath

Beta

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

Parâmetros ​

svg ​

string

Marcação SVG embutida.

Retorna ​

GlyphPath

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

Exemplo ​

Traçar o contorno de um ícone baseado em traço (Lucide) e de 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)