Add a simple function for listing basic font data
This commit is contained in:
parent
8a607fa34c
commit
ccc3bee9af
1 changed files with 9 additions and 0 deletions
|
|
@ -502,5 +502,14 @@ def s(name: str, d: Descriptor) -> None:
|
|||
s('Bold-Italic:', ff['bi'])
|
||||
|
||||
|
||||
def list_fonts(monospaced: bool = True) -> dict[str, list[dict[str, str]]]:
|
||||
ans: dict[str, list[dict[str, str]]] = {}
|
||||
for key, descriptors in all_fonts_map(monospaced)['family_map'].items():
|
||||
entries = ans.setdefault(key, [])
|
||||
for d in descriptors:
|
||||
entries.append({'family': d['family'], 'psname': d['postscript_name'], 'path': d['path'], 'style': d['style']})
|
||||
return ans
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
develop()
|
||||
|
|
|
|||
Loading…
Reference in a new issue