Font converter | API Solution for C++

Overview

Creating interfaces would be much simpler if there was only one universal font format. However, given the variety of devices, environments, operating systems, and applications where fonts are used, we have numerous font formats tailored to specific needs. Each format has its advantages and disadvantages; some are more suitable for web pages and applications, while others excel in publishing. To ensure optimal rendering across different platforms, it’s often necessary to convert fonts from one format to another.

For certain tasks, a web application may suffice. For instance, if you simply need to convert a text document to another font type, Aspose offers an application within its ecosystem to fulfill this need. Try the Font Conversion application to see whether it fits your purposes.

In case your issues are not covered with the web application, and you need a more solid solution, here is the tool aimed to simplify the conversion process for you. The Aspose.Font for C++ library is a solution that allows you to convert fonts between popular formats:

It is a flexible and easy-to-use library designed to work with different font files like TrueType CFF, OpenType, and Type1. Apart from converting fonts, it offers some more manipulations with fonts like reading font information, reading glyphs and metrics information, detecting Latin symbols in fonts, etc.

Supported font formats

The next formats are supported by the font converter from Aspose:

FormatDescription
TrueType (TTF)It is one of the most popular formats between Mac Os and Microsoft Windows operating systems. True type fonts have .ttf extension. Fonts of the TrueType family are easy to scale any size on computers and other devices like printers, smartphones, etc. The most famous representatives of TTF fonts are Times Roman, Helvetica, and Courier families.
Web Open Font Format (WOFF)This font format is developed for web pages. Basically, it is TrueType or OpenType font altered by adding HTML metadata and by applied compression. The format is supported by all major browsers.
Web Open Font Format version 2.0 (WOFF2)The next generation of WOFF. It gives you a 30% average compression gain in comparison to WOFF. It is not that widespread though yet.
Embedded OpenType format (EOT)These are made by Microsoft and supported by Internet explorer fonts used on the web. Because of compression, the font files are smaller. EOT also provides some copyright protection because of subsetting.
Type 1 format(also known as PostScript, PS1, T1, Adobe Type 1, Multiple Master, or MM). This format is developed by Adobe Systems for professional digital typesetting. This system uses the PostScript file format to encode font information. As this font type is outdated and is not supported in many modern environments like mobile devices and web browsers, it will not have been supported anymore by Adobe by 2023. The company recommends using the Open type instead.
Compact Font Format (CFF)It is also known as Type 2 font format, or CFF/Type 2 font format. With this format, you can store different fonts together in one unit called Fontset. As it allows sharing data between fonts, and defaulting frequently occurring data it provides you with notable space-saving.
Scalable Vector Graphics (SVG)SVG is a file format used to display vector-based graphics and images on the web. SVG fonts, also known as SVG-in-OpenType or SVGOT fonts, are a specific type of font format within SVG. Each character in an SVG font is defined as a separate SVG path or shape so SVG fonts can be scaled without losing quality.

All of the formats are supported for reading and a few of them for writing.

Formats supported for reading and/or writing

FormatReadWrite
TTFticktick
CFFtick
WOFFticktick
WOFF2ticktick
Type 1tick
EOTtick
SVGtick

Available font conversions

You can convert any supported font format into one of the writable formats available. Explore the font pairs currently supported for conversion by the Aspose solution here. Click on the links to access additional information and examples demonstrating the usage of the library through code snippets.

How to convert the font into the desired format?

  1. Load font from any of the supported formats and get reference on-base Aspose.Font.Font object which represents this font.
  2. Save just loaded font into another format with the help of the SaveToFormat() method of the base abstract Font class instance. SaveToFormat() method takes two arguments: output stream and FontSavingFormats enumeration for choosing the output font format. Method SaveToFormat() allows you to save fonts into any of the output formats supported.

Below is the sample which converts font from TTF to WOFF2 format.

                
            

Other Supported Conversions

Conversions from other formats can be accomplished in a similar way.

CFF (Compact Font Format)
EOT (Embedded Open Type)
Type1 (Type1 Font)

How to get the solution?

If you are interested in getting the library, go to Aspose.Font for C++ product page. There you will find more opportunities that the solution gives you. You can download a free trial from or buy the product there.

If you have any troubles or questions left, feel free to post them at the Aspose.Font.Product Family section of the Free Support Forum and within a few hours our support team will clear everything up for you.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.