MemoryFontSource constructor
Contents
[
Hide
]MemoryFontSource(font_data)
Ctor.
def __init__(self, font_data: bytes):
...
Parameter | Type | Description |
---|---|---|
font_data | bytes | Binary font data. |
MemoryFontSource(font_data, priority)
Ctor.
def __init__(self, font_data: bytes, priority: int):
...
Parameter | Type | Description |
---|---|---|
font_data | bytes | Binary font data. |
priority | int | Font source priority. See the FontSourceBase.priority property description for more information. |
MemoryFontSource(font_data, priority, cache_key)
Ctor.
def __init__(self, font_data: bytes, priority: int, cache_key: str):
...
Parameter | Type | Description |
---|---|---|
font_data | bytes | Binary font data. |
priority | int | Font source priority. See the FontSourceBase.priority property description for more information. |
cache_key | str | The key of this source in the cache. See MemoryFontSource.cache_key property description for more information. |
Examples
Shows how to use a byte array with data from a font file as a font source.
with open(MY_DIR + 'Alte DIN 1451 Mittelschrift.ttf', 'rb') as file:
font_bytes = file.read()
memory_font_source = aw.fonts.MemoryFontSource(font_bytes, 0)
doc = aw.Document()
doc.font_settings = aw.fonts.FontSettings()
doc.font_settings.set_fonts_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 MemoryFontSource