Files
NapCatQQ/.pnpm-store/v3/files/45/934b5e864663f86e0e1ba65dd97a696e8ea04bd03dc1d7e8259d5f80b02263d6d7e4c87bdc7e75b6d23b24b0aaec32d96859089122b81434fea31720ea4377
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
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 = woff2tottf;
exports.woff2tottfasync = woff2tottfasync;
var _index = _interopRequireDefault(require("../../woff2/index"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file woff2 to ttf
* @author mengke01(kekee000@gmail.com)
*/
/**
* ttf格式转换成woff2字体格式
*
* @param {ArrayBuffer} woff2Buffer ttf缓冲数组
* @param {Object} options 选项
*
* @return {ArrayBuffer} woff格式byte流
*/
// eslint-disable-next-line no-unused-vars
function woff2tottf(woff2Buffer) {
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.decode(woff2Buffer);
return result.buffer;
}
/**
* ttf格式转换成woff2字体格式
*
* @param {ArrayBuffer} woff2Buffer ttf缓冲数组
* @param {Object} options 选项
*
* @return {Promise.<ArrayBuffer>} woff格式byte流
*/
function woff2tottfasync(woff2Buffer) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _index.default.init(options.wasmUrl).then(function () {
var result = _index.default.decode(woff2Buffer);
return result.buffer;
});
}