Font Conversion. Advanced details | C++

[ ]

In some cases, there is a sense to read/modify converted font data before saving the font.

Method Aspose::Font::Font::Convert(Aspose::Font::FontType fontType) was designed for such cases. This method converts a font into the type specified and returns the object inherited from Aspose::Font::Font class which corresponds to FontType value, passed into Convert() method.

The next table shows a map of coherence between FontType values and objects, inherited from the base Aspose::Font::Font class.

Font type Font object
TTF Aspose.Font.Ttf.TtfFont
Type1 Aspose.Font.Type1.Type1Font
CFF Aspose.Font.Cff.CffFont
OTF Aspose.Font.Ttf.TtfFont

Use resultant font object to access/change font properties before saving resultant font or instead of saving resultant font.

At the current moment method Convert() supports conversion only into TrueType font format (FontType::TTF), so it always returns the object of type TtfFont as a result of conversion independently of the source font used.

Next code snippet loads CFF font CenturyGothic from disk, converts it into TrueType format, and changes the name of the converted font to “CenturyGothic_Converted”.

Fulfill the next actions:

  1. Open the font.
  2. Convert the font into TrueType format.
  3. Change the name of the converted font.
  4. Notify the output settings.
  5. Save the resultant with the just changed name.
C++ code example CFF conversion
Input file
Upload a file you want to convert
Output format
Select the target format