Load and Extract Data | .NET
Contents
[
Hide
Show
]Load Type1 Font from Disc
Aspose.Font for .NET API lets you read Type1 Font types from files stored in your digital storage. Type1 font files stored on disc can be loaded by using the following steps.
- Construct the full file path for the Type1 font (e.g.,
string fileName = Path.Combine(dataDir, "courier.pfb");). This ensures correct path handling across platforms. - Create a
FontFileDefinitiondescribing the.pfbformat and aFileSystemStreamSourcefor the file, then build aFontDefinitionwithFontType.Type1 - Open the font using
Aspose.Font.Font.Open(fd)and cast the result toType1Font
1// For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-.NET
2string fileName = dataDir + "courier.pfb"; //Font file name with full path
3
4FontDefinition fd = new FontDefinition(FontType.Type1, new FontFileDefinition("pfb", new FileSystemStreamSource(fileName)));
5Type1Font font = Aspose.Font.Font.Open(fd) as Type1Font;