From 9e61a91616145bbbe14ba0c97ba0f9d1354a8812 Mon Sep 17 00:00:00 2001 From: Arias800 <24809312+Arias800@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:30:36 +0200 Subject: [PATCH] Add font embedding on Linux --- devine/core/utilities.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/devine/core/utilities.py b/devine/core/utilities.py index d0ddf78..95c5b7f 100644 --- a/devine/core/utilities.py +++ b/devine/core/utilities.py @@ -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 {}