Files
NapCatQQ/.pnpm-store/v3/files/3f/88823bfb5a9d2423c4afcbffc02d073161f5d0af86c39bf5118778f0fddac84d0b6bfa3c4f0bf97fb0c800dc5c0093d0c1fe031a6419b1890de864130200b6
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

42 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = glyf2svg;
var _contours2svg = _interopRequireDefault(require("./contours2svg"));
var _transformGlyfContours = _interopRequireDefault(require("./transformGlyfContours"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file glyf转换svg,复合字形轮廓需要ttfObject支持
* @author mengke01(kekee000@gmail.com)
*
* thanks to:
* ynakajima/ttf.js
* https://github.com/ynakajima/ttf.js
*/
/**
* glyf转换svg
*
* @param {Object} glyf 解析后的glyf结构
* @param {Object} ttf ttf对象
* @return {string} svg文本
*/
function glyf2svg(glyf, ttf) {
if (!glyf) {
return '';
}
var pathArray = [];
if (!glyf.compound) {
if (glyf.contours && glyf.contours.length) {
pathArray.push((0, _contours2svg.default)(glyf.contours));
}
} else {
var contours = (0, _transformGlyfContours.default)(glyf, ttf);
if (contours && contours.length) {
pathArray.push((0, _contours2svg.default)(contours));
}
}
return pathArray.join(' ');
}