Aspose::Words::Fonts::MemoryFontSource class
Contents
[
Hide
]MemoryFontSource class
Represents the single TrueType font file stored in memory. To learn more, visit the Working with Fonts documentation article.
class MemoryFontSource : public Aspose::Words::Fonts::FontSourceBase
Methods
Method | Description |
---|---|
get_CacheKey() const | The key of this source in the cache. |
get_FontData() const | Binary font data. |
get_Priority() const | Returns the font source priority. |
get_Type() override | Returns the type of the font source. |
get_WarningCallback() const | Called during processing of font source when an issue is detected that might result in formatting fidelity loss. |
GetAvailableFonts() | Returns list of fonts available via this source. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
MemoryFontSource(const System::ArrayPtr<uint8_t>&) | Ctor. |
MemoryFontSource(const System::ArrayPtr<uint8_t>&, int32_t) | Ctor. |
MemoryFontSource(const System::ArrayPtr<uint8_t>&, int32_t, const System::String&) | Ctor. |
set_WarningCallback(const System::SharedPtr<Aspose::Words::IWarningCallback>&) | Setter for Aspose::Words::Fonts::FontSourceBase::get_WarningCallback. |
static Type() |
Examples
Shows how to use a byte array with data from a font file as a font source.
ArrayPtr<uint8_t> fontBytes = System::IO::File::ReadAllBytes(MyDir + u"Alte DIN 1451 Mittelschrift.ttf");
auto memoryFontSource = MakeObject<MemoryFontSource>(fontBytes, 0);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({memoryFontSource}));
ASSERT_EQ(FontSourceType::MemoryFont, memoryFontSource->get_Type());
ASSERT_EQ(0, memoryFontSource->get_Priority());
See Also
- Class FontSourceBase
- Namespace Aspose::Words::Fonts
- Library Aspose.Words for C++