Skip to content

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

دالة: svgToGlyphPath() ​

svgToGlyphPath(svg): GlyphPath

Beta

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

Parameters ​

svg ​

string

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

Returns ​

GlyphPath

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

Example ​

تحديد مخطط لأيقونة معتمدة على السكتة (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)