Skip to content

Commit

Permalink
feat: add get_font interface
Browse files Browse the repository at this point in the history
  • Loading branch information
NCBM committed Apr 5, 2024
1 parent 1727ee1 commit 20bd244
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fontra.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ def update_fontrefs_index():
_update_fontref_index(fn, face)


def get_font(name: str, style: str, lookup_langindex: bool = True) -> FontRef:
"""Get info for loading correct font faces."""
if lookup_langindex:
return _indexed_fontrefs[_indexed_langnames[name]][style]
return _indexed_fontrefs[name][style]


update_system_fontdirs()
update_fontfiles_index()
update_fontrefs_index()
Expand Down

0 comments on commit 20bd244

Please sign in to comment.