Browse our Products

Aspose.Font for .NET 25.6 Release Notes

Major Features

Added support for converting fonts from Compact Font Format (CFF) to OpenType font format (OTF).

You can use method Aspose.Font.Font.Convert or method Aspose.Font.Font.SaveToFormat to convert font from CFF to OTF format.

Next code snippets show both cases.

Conversion from CFF to OTF format using method Aspose.Font.Font.Convert

    // Open CFF font
    string fontPath = Path.Combine(DataDir, "CenturyGothic.cff");
    FontDefinition fontDefinition = new FontDefinition(FontType.CFF, new FontFileDefinition("cff", new FileSystemStreamSource(fontPath)));
    Font font = Font.Open(fontDefinition);
 
    // Convert font into OpenType format and cast font returned to Aspose.Font.Ttf.TtfFont
    Aspose.Font.Ttf.TtfFont destFont = font.Convert(FontType.OTF) as Aspose.Font.Ttf.TtfFont;
 
    // Change name of converted font
    destFont.FontName = "CenturyGothic_Converted";
 
    // OTF output settings
    string outPath = Path.Combine(OutputDir, "CffToOtf_out.otf");
 
    // Save resultant font with font name changed
    destFont.Save(outPath);

Conversion from CFF to OTF format using method Aspose.Font.Font.SaveToFormat

    // Open CFF font
    string fontPath = Path.Combine(DataDir, "Montserrat-Regular.cff");
    FontDefinition fontDefinition = new FontDefinition(FontType.CFF, new FontFileDefinition(new FileSystemStreamSource(fontPath)));
    Font font = Font.Open(fontDefinition);
 
    // OTF output settings
    string outPath = Path.Combine(OutputDir, "Montserrat-Regular.otf");
    FileStream outStream = File.Create(outPath);
    
    // Converts a font into OTF format and saves the converted font in a stream.
    font.SaveToFormat(outStream, FontSavingFormats.OTF);

List of Issues Covering all Changes in this Release

KeySummaryCategory
FONTNET-775Support for converting font from CFF format to OTF formatFeature
FONTNET-175Open and Re-Save font (TTF) - output file is corruptedBug
FONTNET-615OTF to TTF conversion yields invalid fontBug

Public API and Backwards Incompatible Changes

Added APIs

  • Enumeration member Aspose.Font.FontSavingFormats.OTF

Got Queries?

If you have any query related to Aspose.Font for .NET API, please feel free to write to reach us on Aspose.Font forum. We’ll be glad to assist you with your inquiries.