Files
NapCatQQ/.pnpm-store/v3/files/06/f401accce4559573732b2ad16cb72d555a881d3ae7e64999e7fc02276a08bef7d14916b0c9608a5471b313f5bb6030dcda8c28127f09d877f92a4bd993215c
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

47 lines
1.4 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ttftowoff2;
exports.ttftowoff2async = ttftowoff2async;
var _index = _interopRequireDefault(require("../../woff2/index"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file ttf to woff2
* @author mengke01(kekee000@gmail.com)
*/
/**
* ttf格式转换成woff2字体格式
*
* @param {ArrayBuffer} ttfBuffer ttf缓冲数组
* @param {Object} options 选项
*
* @return {Promise.<ArrayBuffer>} woff格式byte流
*/
// eslint-disable-next-line no-unused-vars
function ttftowoff2(ttfBuffer) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!_index.default.isInited()) {
throw new Error('use woff2.init() to init woff2 module!');
}
var result = _index.default.encode(ttfBuffer);
return result.buffer;
}
/**
* ttf格式转换成woff2字体格式
*
* @param {ArrayBuffer} ttfBuffer ttf缓冲数组
* @param {Object} options 选项
*
* @return {Promise.<ArrayBuffer>} woff格式byte流
*/
function ttftowoff2async(ttfBuffer) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _index.default.init(options.wasmUrl).then(function () {
var result = _index.default.encode(ttfBuffer);
return result.buffer;
});
}