Caricamento e estrazione di dati | C ++

Carica il carattere CFF dal disco

Aspose.Font per API C ++ consente di caricare i caratteri CFF dai file del disco sul tuo computer. I seguenti passaggi possono essere utilizzati per caricare un file di carattere CFF:

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));

Carica il carattere CFF dall’array di byte

Un file di carattere CFF può essere caricato dal flusso utilizzando il seguente campione di codice.

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));

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.