Hello,
Using Aspose.Font .NET, i would like to convert CFF font to a TTF one.
Based on documentation, the Font.Convert or Font.SaveAsFormat can do that (only to TTF format).
But when i try to convert this CFF font AAAAAC+GastonDemo.zip (9.4 KB)
i get an exception :
String reference not set to an instance of a String. (Parameter ‘s’) at System.Text.Encoding.GetBytes(String s).
using this code snippet :
FontDefinition fd = new FontDefinition(FontType.CFF, new FileSystemStreamSource(fontPath));
var cffFont = Font.Open(fd) as CffFont;
TtfFont realTTFFont = (TtfFont) cffFont.Convert(FontType.TTF);
realTTFFont.Save(fontPath + ".realTTFFont.ttf");
The same on this TTF font (with OpenType outline), i want to save it as a real TTF file : Generic0-Regular.zip (6.1 KB)
using this code snippet :
FontDefinition fd = new FontDefinition(FontType.TTF, new FontFileDefinition("ttf", new FileSystemStreamSource(fontPath)));
var ttfFont = Font.Open(fd) as TtfFont;
if (ttfFont.CffFont != null)
{
var cffFont = ttfFont.CffFont;
var realTTF = (TtfFont) cffFont.Convert(FontType.TTF);
realTTF.Save(fontPath+"realttf.ttf");
}
Can you help me on this ?
Thanks