FontSourceBase class
FontSourceBase class
This is an abstract base class for the classes that allow the user to specify various font sources. To learn more, visit the Working with Fonts documentation article.
Properties
Name | Description |
---|---|
priority | Returns the font source priority. |
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. |
Methods
Name | Description |
---|---|
as_file_font_source() | Cast FontSourceBase object to FileFontSource. |
as_folder_font_source() | Cast FontSourceBase object to FolderFontSource. |
as_memory_font_source() | Cast FontSourceBase object to MemoryFontSource. |
as_stream_font_source() | Cast FontSourceBase object to StreamFontSource. |
as_system_font_source() | Cast FontSourceBase object to SystemFontSource. |
get_available_fonts() | Returns list of fonts available via this source. |
Examples
Shows how to use a font file in the local file system as a font source.
file_font_source = aw.fonts.FileFontSource(file_path=MY_DIR + 'Alte DIN 1451 Mittelschrift.ttf', priority=0)
doc = aw.Document()
doc.font_settings = aw.fonts.FontSettings()
doc.font_settings.set_fonts_sources(sources=[file_font_source])
self.assertEqual(MY_DIR + 'Alte DIN 1451 Mittelschrift.ttf', file_font_source.file_path)
self.assertEqual(aw.fonts.FontSourceType.FONT_FILE, file_font_source.type)
self.assertEqual(0, file_font_source.priority)
See Also
- module aspose.words.fonts