Laden und Extrahieren von Daten | C++

Laden Sie die CFF-Schriftart von der Disc

Die Aspose.Font for C++ API ermöglicht das Laden von CFF-Schriftarten aus Disc-Dateien auf Ihrem Computer. Die folgenden Schritte können zum Laden einer CFF-Schriftartdatei verwendet werden:

1For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-C
2System::String fileName = dataDir + u"OpenSans-Regular.cff";
3//Font file name with full path
4    
5System::SharedPtr<FontDefinition> fd = System::MakeObject<FontDefinition>(Aspose::Font::FontType::CFF, System::MakeObject<FontFileDefinition>(u"cff", System::MakeObject<FileSystemStreamSource>(fileName)));
6System::SharedPtr<CffFont> ttfFont = System::DynamicCast_noexcept<Aspose::Font::Cff::CffFont>(Aspose::Font::Font::Open(fd));

Laden Sie die CFF-Schriftart aus dem Byte-Array

Mit dem folgenden Codebeispiel kann eine CFF-Schriftartdatei aus dem Stream geladen werden.

1For complete examples and data files, please go to https://github.com/aspose-font/Aspose.Font-for-C
2System::ArrayPtr<uint8_t> fontMemoryData = System::IO::File::ReadAllBytes(dataDir + u"OpenSans-Regular.cff");
3System::SharedPtr<FontDefinition> fd = System::MakeObject<FontDefinition>(Aspose::Font::FontType::CFF, System::MakeObject<FontFileDefinition>(u"cff", System::MakeObject<ByteContentStreamSource>(fontMemoryData)));
4System::SharedPtr<CffFont> cffFont = System::DynamicCast_noexcept<Aspose::Font::Cff::CffFont>(Aspose::Font::Font::Open(fd));
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.