Convert WOFF to TTF |.NET
The information below is to describe how to use the Aspose.Font for .NET to convert fonts from Web Open Font Format
to True Type font
.
Apply the next namespaces at the head of the file:
using Aspose.Font.Sources;
using Aspose.Font.Ttf;
using System;
using System.IO;
Conversion fundamentals are available in How to convert the font into the desired format? chapter.
To fulfil the conversion from WOFF
to TTF
font you need to follow the next steps:
-
Open
Woff
font file.// Open woff font string fontPath = Path.Combine(DataDir, "Montserrat-Regular.woff"); FontDefinition fontDefinition = new FontDefinition(FontType.TTF, new FontFileDefinition("woff", new FileSystemStreamSource(fontPath))); Font font = Font.Open(fontDefinition);
-
Specify the output setting.
// Ttf output settings string outPath = Path.Combine(OutputDir, "WoffToTtf_out1.ttf"); FileStream outStream = File.Create(outPath);
-
Use SaveToFormat() method of the base abstract Font class instance to transform font and save results.
// Convert woff to ttf font.SaveToFormat(outStream, FontSavingFormats.TTF);
If you need more examples of the solution you may check Aspose.Font.Examples.sln solution, in the net-examples folder of the Aspose.Font Documentation Github repository.
To try the functionality you can also go to our free web Font Conversion application application from Aspose.