Convert WOFF to TTF |Java

[ ]

The information below is to describe how to use the Aspose.Font for Java to convert fonts from Web Open Font Format to True Type font.

Use the following statements:

    package com.aspose.font;

    import java.nio.file.Files;
    import java.nio.file.Paths;

    import com.aspose.font.ByteContentStreamSource;
    import com.aspose.font.FileSystemStreamSource;
    import com.aspose.font.Font;
    import com.aspose.font.FontDefinition;
    import com.aspose.font.FontFileDefinition;
    import com.aspose.font.FontSavingFormats;
    import com.aspose.font.FontType;
    import com.aspose.font.TtfFont;

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 = Paths.get(getDataDir(), "Montserrat-Regular.woff").toString();
        FontDefinition fontDefinition = new FontDefinition(FontType.TTF, new FontFileDefinition("woff", new FileSystemStreamSource(fontPath)));
        Font font =;

  2. Specify the output setting.

        // Ttf output settings
        String outPath = Paths.get(getOutputDir(), "WoffToTtf_out1.ttf").toString();
        FileOutputStream outStream = new FileOutputStream(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);