Convert WOFF2 to WOFF | API Solution for C++
From this article, you will find out how to convert fonts from
WOFF format with the help of the Aspose solution.
Make sure you’ve learned the conversion fundamentals in How to convert the font into the desired format? section.
Then to fulfill
WOFF conversion you will need to take these three steps:
- Open the
- Write the output setting for the
- Convert and save the font result.
Let’s briefly explain the code above:
First, it defines the file path for the input font file and creates a FontDefinition* object using this file path. This object specifies the font type (
WOFF2) and the location of the font file.
Then, it opens the font using the Aspose::Font::Font::Open() Method, which creates a Font object from the FontDefinition.
With the next code line, it defines the output file path and creates a new file stream using the System::IO::File::Create() Method.
Finally, it saves the font to the
Web Open Font Format file using the SaveToFormat() Method and passes the output file stream and the specified format (
WOFF) as parameters.