AsposeFontConvertTosvg | Node.js

node.jsのAspose.Fontを使用してフォントをSVG形式に変換する方法は?

  1. AsposeFontConvertTosvg関数を呼び出します。
  2. 結果の名前ファイルは、json.filenameresultに設定されています。
  3. 次に、json.errorcodeが0の場合、結果ファイルへのリンクを取得できます。 json.errorcodeパラメーターが0に等しくなく、したがってファイルにエラーが発生する場合、そのようなエラーに関する情報はjson.errortextに含まれます。

以下は、フォントをTTFからwoff形式に変換するサンプルです。

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

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.