Add font embedding on Linux

This commit is contained in:
Arias800 2024-06-12 18:30:36 +02:00 committed by GitHub
parent 09eda16882
commit 9e61a91616
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -284,8 +284,16 @@ def get_system_fonts() -> dict[str, Path]:
for n in range(0, total_fonts)
for name, filename, _ in [winreg.EnumValue(key, n)]
}
elif sys.platform == "linux":
import subprocess
return {
# fc-list should be installed by default on every system.
name.strip() if ":" not in name else name.split(":")[0].strip() : Path(path)
for font in subprocess.getstatusoutput("fc-list")[1].split("\n")
for path, name in [font.split(":", 1)]
}
else:
# TODO: Get System Fonts for Linux and mac OS
# TODO: Get System Fonts for mac OS
return {}