Free Support Forum - aspose.com

Converting EOT to TTF fonts with C++ library possible?

Is this Asponse.Font C++ library able to covert Microsofts *.EOT to *.TTF font format?
The EOT font is using the Monotype MTX compression internal.

References:


@goehte

Yes, Aspose.Font for C++ is able to save from any font format to TTF or WOFF formats. However, if you face any issue, please feel free to let us know.

@goehte

Adding more to our previous response, following is the code snippet to achieve your requirements:

System::String dataDir = RunExamples::GetDataDir_Data();
System::ArrayPtr<uint8_t> fontMemoryData = System::IO::File::ReadAllBytes(dataDir + u"EuroSansPro - Lig.eot");

System::SharedPtr<FontDefinition> fd = System::MakeObject<FontDefinition>(Aspose::Font::FontType::TTF, System::MakeObject<FontFileDefinition>(u"eot", System::MakeObject<ByteContentStreamSource>(fontMemoryData)));
System::SharedPtr<TtfFont> ttfFont = System::DynamicCast_noexcept<Aspose::Font::Ttf::TtfFont>(Aspose::Font::Font::Open(fd));

System::String outputFile = RunExamples::GetDataDir_Data() + u"EuroSansPro - Lig.ttf";
ttfFont->Save(outputFile);

However some limitations are present:

  • The font file will open as ttfFont, but then the trimmed font will be saved

So, in output TTF font, not all initial font tables will be presented, but only those that Aspose.Font can handle i.e. these are head, cmap, glyf, cvt, fpgm, prep, hea, hmtx, loca, maxp and other tables.

In case you notice any issue with your font files, please share them with us so that we may further proceed to assist you accordingly.