Skip to content

pantoken / formats/icon-font/src / svgToGlyphPath

دالة: svgToGlyphPath()

svgToGlyphPath(svg): GlyphPath

بيتا

إنشاء مسار الشكل المملوء لأيقونة SVG.

المعلمات

svg

string

ترميز SVG مضمّن.

القيم المرجعة

GlyphPath

المسار المملوء d (بإحداثيات viewBox) وحجم viewBox.

مثال

تحديد مخطط لأيقونة معتمدة على السكتة (Lucide) وأيقونة معتمدة على التعبئة

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)