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:

  1. 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);

  2. Specify the output setting.

        // Ttf output settings
        string outPath = Path.Combine(OutputDir, "WoffToTtf_out1.ttf");
        FileStream outStream = File.Create(outPath);

  3. 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);