Convert WOFF2 to WOFF | API Solution for C++
From this article, you will find out how to convert fonts from WOFF2
to 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 WOFF2
to WOFF
conversion you will need to take these three steps:
- Open the
WOFF2
font file. - Write the output setting for the
WOFF
format. - 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.
Other examples and documentation are also always available in Aspose.Font.Examples.CPP.sln solution, in the cpp-examples of the Aspose.Font Documentation Github repository.
Also, get to the Font Conversion application from Aspose to try the functionality.