AsposefontConvertTottf | Node.js

如何使用node.js使用aspose.font将字体转换为ttf格式?

  1. 调用 AsposeFontConvertTottf函数。
  2. json.filenameresult中设置了结果名称文件。
  3. 如果“ JSON.ERRORCODE”为0,则可以获取结果文件的链接。如果“ JSON.ERRORCODE”参数不等于0,反之亦然,则文件中会有一个错误,则有关此类错误的信息将包含在json.errorText中。

以下是将type1字体转换为ttf格式的示例。

 1    const AsposeFont = require('asposefontnodejs');
 2
 3    const font_file = "./fonts/acade1.afm";
 4
 5    console.log('Aspose.Font for Node.js via C++ example');
 6
 7    AsposeFont().then(AsposeFontModule => {
 8        //call AsposeFontConvertToTTF to convert font
 9        const json = AsposeFontModule.AsposeFontConvertToTTF(font_file,AsposeFontModule.FontType.Type1);
10        console.log("AsposeFontConvertToTTF : %O",  json.errorCode == 0 ? font_file + ' => ' + json.fileNameResult : json.errorText);
11    });

*将路径/您/font.afm替换为字体文件的实际路径。

使用aspose.font for node.js,您可以轻松地在字体格式之间切换,并确保您的项目始终具有完美的外观!

参见

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.