FolderFontSource class

FolderFontSource class

Represents the folder that contains TrueType font files. To learn more, visit the Working with Fonts documentation article.

Inheritance: FolderFontSourceFontSourceBase

Constructors

NameDescription
FolderFontSource(folder_path, scan_subfolders)Ctor.
FolderFontSource(folder_path, scan_subfolders, priority)Ctor.

Properties

NameDescription
folder_pathPath to the folder.
priorityReturns the font source priority.
(Inherited from FontSourceBase)
scan_subfoldersDetermines whether or not to scan the subfolders.
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 local system folder which contains fonts as a font source.

# Create a font source from a folder that contains font files.
folder_font_source = aw.fonts.FolderFontSource(FONTS_DIR, False, 1)

doc = aw.Document()
doc.font_settings = aw.fonts.FontSettings()
doc.font_settings.set_fonts_sources([folder_font_source])

self.assertEqual(FONTS_DIR, folder_font_source.folder_path)
self.assertEqual(False, folder_font_source.scan_subfolders)
self.assertEqual(aw.fonts.FontSourceType.FONTS_FOLDER, folder_font_source.type)
self.assertEqual(1, folder_font_source.priority)

See Also