MemoryFontSource class
MemoryFontSource class
Represents the single TrueType font file stored in memory. To learn more, visit the Working with Fonts documentation article.
Inheritance: MemoryFontSource → FontSourceBase
Constructors
| Name | Description | 
|---|---|
| MemoryFontSource(font_data) | Ctor. | 
| MemoryFontSource(font_data, priority) | Ctor. | 
| MemoryFontSource(font_data, priority, cache_key) | Ctor. | 
Properties
| Name | Description | 
|---|---|
| cache_key | The key of this source in the cache. | 
| font_data | Binary font data. | 
| priority | Returns the font source priority. (Inherited from FontSourceBase) | 
| type | Returns the type of the font source. | 
| warning_callback | Called during processing of font source when an issue is detected that might result in formatting fidelity loss. (Inherited from FontSourceBase) | 
Methods
| Name | Description | 
|---|---|
| get_available_fonts() | Returns list of fonts available via this source. (Inherited from FontSourceBase) | 
Examples
Shows how to use a byte array with data from a font file as a font source.
font_bytes = system_helper.io.File.read_all_bytes(MY_DIR + 'Alte DIN 1451 Mittelschrift.ttf')
memory_font_source = aw.fonts.MemoryFontSource(font_data=font_bytes, priority=0)
doc = aw.Document()
doc.font_settings = aw.fonts.FontSettings()
doc.font_settings.set_fonts_sources(sources=[memory_font_source])
self.assertEqual(aw.fonts.FontSourceType.MEMORY_FONT, memory_font_source.type)
self.assertEqual(0, memory_font_source.priority)
See Also
- module aspose.words.fonts
- class FontSourceBase