Loading and Extracting Data | .NET

Load CFF Font from Disc

Aspose.Font for .NET API lets you read CFF Font types from files stored in your digital storage. CFF font files stored on disc can be loaded by using the following steps.

1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-.NET
2string fileName = dataDir + "OpenSans-Regular.cff"; //Font file name with full path
3
4FontDefinition fd = new FontDefinition(FontType.CFF, new FontFileDefinition("cff", new FileSystemStreamSource(fileName)));
5CffFont ttfFont = Aspose.Font.Font.Open(fd) as CffFont;

Load CFF Font from Byte Array

You can also load CFF fonts from stream using the following code sample.

1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-.NET
2byte[] fontMemoryData = File.ReadAllBytes(dataDir + "OpenSans-Regular.cff");
3FontDefinition fd = new FontDefinition(FontType.CFF, new FontFileDefinition("cff", new ByteContentStreamSource(fontMemoryData)));
4CffFont cffFont = Aspose.Font.Font.Open(fd) as CffFont;
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.