ロード、抽出、TTF |から保存します。ネット

ディスクからTrueTypeフォントをロードします

.NET APIのAspose.Fontでは、デジタルストレージに保存されているファイルからTrueTypeフォントタイプを読み取ることができます。ディスクに保存されているTrueTypeフォントファイルは、次の手順を使用してロードできます。

読み込み機能は、 フォントをロードする方法と呼ばれる別の段落で完全に説明されています。

1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-.NET
2string fileName= dataDir + "Montserrat-Regular.ttf"; //Font file name with full path
3
4FontDefinition fd = new FontDefinition(FontType.TTF, new FontFileDefinition("ttf", new FileSystemStreamSource(fileName)));
5TtfFont ttfFont = Aspose.Font.Font.Open(fd) as TtfFont;

TTFフォントを保存します

TTFファイルをロードしたら、フォントファイルを使用して、パラメーターを更新し、ファイルをディスクに保存することができます。 .NETのASPOSE.FONTを使用すると、次の手順を使用してTTFファイルをディスクに保存できます。

 1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-.NET
 2//byte array to load Font from
 3string dataDir = RunExamples.GetDataDir_Data();
 4            
 5byte[] fontMemoryData = File.ReadAllBytes(dataDir + "Montserrat-Regular.ttf");
 6FontDefinition fd = new FontDefinition(FontType.TTF, new FontFileDefinition("ttf", new ByteContentStreamSource(fontMemoryData)));
 7TtfFont ttfFont = Aspose.Font.Font.Open(fd) as TtfFont;
 8
 9//Work with data from just loaded TtfFont object
10
11//Save TtfFont to disk
12//Output Font file name with full path
13string outputFile = RunExamples.GetDataDir_Data() + "Montserrat-Regular_out.ttf";
14
15ttfFont.Save(outputFile);

その他の例については、 net-examplesフォルダーの aspos.font.fontドキュメントgithubリポジトリの aspose.font.examples.sln solution(2)にご覧ください。

また、無料のオンライン フォント操作アプリケーションを確認して、Webソリューションで機能を実装する方法を確認してください。

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.