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

34 lines
679 B
Plaintext

/**
* @file 缩减glyf大小,去除冗余节点
* @author mengke01(kekee000@gmail.com)
*/
import reducePath from '../../graphics/reducePath';
/**
* 缩减glyf,去除冗余节点
*
* @param {Object} glyf glyf对象
* @return {Object} glyf对象
*/
export default function reduceGlyf(glyf) {
const contours = glyf.contours;
let contour;
for (let j = contours.length - 1; j >= 0; j--) {
contour = reducePath(contours[j]);
// 空轮廓
if (contour.length <= 2) {
contours.splice(j, 1);
continue;
}
}
if (0 === glyf.contours.length) {
delete glyf.contours;
}
return glyf;
}