FileFontSource constructor

FileFontSource(file_path)

Ctor.

def __init__(self, file_path: str):
    ...
ParameterTypeDescription
file_pathstrPath to font file.

FileFontSource(file_path, priority)

Ctor.

def __init__(self, file_path: str, priority: int):
    ...
ParameterTypeDescription
file_pathstrPath to font file.
priorityintFont source priority. See the FontSourceBase.priority property description for more information.

FileFontSource(file_path, priority, cache_key)

Ctor.

def __init__(self, file_path: str, priority: int, cache_key: str):
    ...
ParameterTypeDescription
file_pathstrPath to font file.
priorityintFont source priority. See the FontSourceBase.priority property description for more information.
cache_keystrThe key of this source in the cache. See FileFontSource.cache_key property description for more information.

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