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  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    });

*パス/to/your/font.afmを、フォントファイルへの実際のパスに置き換えます。

node.jsのAspose.Fontを使用すると、フォント形式を簡単に切り替えて、プロジェクトが常に完璧なルックアンドフィールを確保できます。

参照してください

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.