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 typeFont object
TTFAspose.Font.Ttf.TtfFont
Type1Aspose.Font.Type1.Type1Font
CFFAspose.Font.Cff.CffFont
OTFAspose.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.
                
            

The full range of examples for using Aspose.Font for C++ is placed in Aspose.Font.Examples.CPP.sln solution, in the cpp-examples folder of the Aspose.Font Documentation GitHub repository.

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.