AsposeFontConvert
AsposeFontConvert function
将字体转换为其他格式。
function AsposeFontConvert(
fileName,
fontType,
fontSavingFormat
)
| 参数 | 类型 | 描述 |
|---|---|---|
| fileName | string | 文件名。 |
| fontType | FontType | 要转换的字体类型。 |
| fontSavingFormat | FontSavingFormats | 要转换成的字体格式。 |
返回值
JSON 对象
| 字段 | 描述 |
|---|---|
| errorCode | |
| errorText | |
| fileNameResult |
备注
注意:现在仅支持 TTF 字体类型。
示例
Common js modules:
const AsposeFont = require('asposefontnodejs');
const font_file = "./fonts/Lora-Regular.ttf";
console.log('Aspose.Font for Node.js via C++ example');
AsposeFont().then(AsposeFontModule => {
//call AsposeFontConvert to convert font
const json = AsposeFontModule.AsposeFontConvert(font_file,AsposeFontModule.FontType.TTF,AsposeFontModule.FontSavingFormats.WOFF);
console.log("AsposeFontConvert : %O", json.errorCode == 0 ? font_file + ' => ' + json.fileNameResult : json.errorText);
});
ECMAScript\ES6 js modules:
import AsposeFont from 'asposefontnodejs';
const font_file ="./fonts/arial.ttf";
console.log('Aspose.Font for Node.js via C++ example');
const AsposeFontModule = await AsposeFont();
const json = AsposeFontModule.AsposeFontConvert(font_file,AsposeFontModule.FontType.TTF,AsposeFontModule.FontSavingFormats.WOFF);
console.log("AsposeFontConvert => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
另请参见
- enum FontType
- enum FontSavingFormats