Load and Extract Data | C++ | Aspose.Font
Contents
[
Hide
Show
]Load Type1 Font from Disc
Aspose.Font for C++ 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.
- Create a new object of FontDefinition class
- Use FontType as Type1 and FontFileDefinition as pfb
- Define a Type1Font object and open the font file from FontDefinition object defined in the earlier step
1For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-C
2System::String fileName = dataDir + u"courier.pfb";
3//Font file name with full path
4
5System::SharedPtr<FontDefinition> fd = System::MakeObject<FontDefinition>(Aspose::Font::FontType::Type1, System::MakeObject<FontFileDefinition>(u"pfb", System::MakeObject<FileSystemStreamSource>(fileName)));
6System::SharedPtr<Type1Font> font = System::DynamicCast_noexcept<Aspose::Font::Type1::Type1Font>(Aspose::Font::Font::Open(fd));