FileFontSource class

FileFontSource class

Represents the single TrueType font file stored in the file system. To learn more, visit the Working with Fonts documentation article.

Inheritance: FileFontSourceFontSourceBase

Constructors

NameDescription
FileFontSource(file_path)Ctor.
FileFontSource(file_path, priority)Ctor.
FileFontSource(file_path, priority, cache_key)Ctor.

Properties

NameDescription
cache_keyThe key of this source in the cache.
file_pathPath to the font file.
priorityReturns the font source priority.
(Inherited from FontSourceBase)
typeReturns the type of the font source.
warning_callbackCalled during processing of font source when an issue is detected that might result in formatting fidelity loss.
(Inherited from FontSourceBase)

Methods

NameDescription
get_available_fonts()Returns list of fonts available via this source.
(Inherited from FontSourceBase)

Examples

Shows how to use a font file in the local file system as a font source.

file_font_source = aw.fonts.FileFontSource(MY_DIR + "Alte DIN 1451 Mittelschrift.ttf", 0)

doc = aw.Document()
doc.font_settings = aw.fonts.FontSettings()
doc.font_settings.set_fonts_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