Aspose::Words::Fonts::MemoryFontSource::MemoryFontSource constructor
Contents
[
Hide
]MemoryFontSource::MemoryFontSource(const System::ArrayPtr<uint8_t>&) constructor
Ctor.
Aspose::Words::Fonts::MemoryFontSource::MemoryFontSource(const System::ArrayPtr<uint8_t> &fontData)
| Parameter | Type | Description |
|---|---|---|
| fontData | const System::ArrayPtr<uint8_t>& | Binary font data. |
Examples
Shows how to use a byte array with data from a font file as a font source.
System::ArrayPtr<uint8_t> fontBytes = System::IO::File::ReadAllBytes(get_MyDir() + u"Alte DIN 1451 Mittelschrift.ttf");
auto memoryFontSource = System::MakeObject<Aspose::Words::Fonts::MemoryFontSource>(fontBytes, 0);
auto doc = System::MakeObject<Aspose::Words::Document>();
doc->set_FontSettings(System::MakeObject<Aspose::Words::Fonts::FontSettings>());
doc->get_FontSettings()->SetFontsSources(System::MakeArray<System::SharedPtr<Aspose::Words::Fonts::FontSourceBase>>({memoryFontSource}));
ASSERT_EQ(FontSourceType::MemoryFont, memoryFontSource->get_Type());
ASSERT_EQ(0, memoryFontSource->get_Priority());
See Also
- Class MemoryFontSource
- Namespace Aspose::Words::Fonts
- Library Aspose.Words for C++
MemoryFontSource::MemoryFontSource(const System::ArrayPtr<uint8_t>&, int32_t) constructor
Ctor.
Aspose::Words::Fonts::MemoryFontSource::MemoryFontSource(const System::ArrayPtr<uint8_t> &fontData, int32_t priority)
| Parameter | Type | Description |
|---|---|---|
| fontData | const System::ArrayPtr<uint8_t>& | Binary font data. |
| priority | int32_t | Font source priority. See the Priority property description for more information. |
Examples
Shows how to use a byte array with data from a font file as a font source.
System::ArrayPtr<uint8_t> fontBytes = System::IO::File::ReadAllBytes(get_MyDir() + u"Alte DIN 1451 Mittelschrift.ttf");
auto memoryFontSource = System::MakeObject<Aspose::Words::Fonts::MemoryFontSource>(fontBytes, 0);
auto doc = System::MakeObject<Aspose::Words::Document>();
doc->set_FontSettings(System::MakeObject<Aspose::Words::Fonts::FontSettings>());
doc->get_FontSettings()->SetFontsSources(System::MakeArray<System::SharedPtr<Aspose::Words::Fonts::FontSourceBase>>({memoryFontSource}));
ASSERT_EQ(FontSourceType::MemoryFont, memoryFontSource->get_Type());
ASSERT_EQ(0, memoryFontSource->get_Priority());
See Also
- Class MemoryFontSource
- Namespace Aspose::Words::Fonts
- Library Aspose.Words for C++
MemoryFontSource::MemoryFontSource(const System::ArrayPtr<uint8_t>&, int32_t, const System::String&) constructor
Ctor.
Aspose::Words::Fonts::MemoryFontSource::MemoryFontSource(const System::ArrayPtr<uint8_t> &fontData, int32_t priority, const System::String &cacheKey)
| Parameter | Type | Description |
|---|---|---|
| fontData | const System::ArrayPtr<uint8_t>& | Binary font data. |
| priority | int32_t | Font source priority. See the Priority property description for more information. |
| cacheKey | const System::String& | The key of this source in the cache. See CacheKey property description for more information. |
See Also
- Class MemoryFontSource
- Namespace Aspose::Words::Fonts
- Library Aspose.Words for C++