File 0001-Make-SHX-font-support-optional.patch of Package bCNC
From 25e661b87c828d41e80b225751f7d599a997393e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 25 Jun 2024 21:22:05 +0200
Subject: [PATCH] Make SHX font support optional
The text plugin also supports truetype fonts (TTF), no need to bail out.
---
bCNC/plugins/text.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/bCNC/plugins/text.py b/bCNC/plugins/text.py
index b2ca268..8873b9e 100644
--- a/bCNC/plugins/text.py
+++ b/bCNC/plugins/text.py
@@ -6,7 +6,11 @@
from CNC import CNC, Block
from ToolsPage import Plugin
from PIL.FontFile import FontFile
-from shxparser.shxparser import ShxFont,ShxPath
+try:
+ from shxparser.shxparser import ShxFont,ShxPath
+except ModuleNotFoundError:
+ ShxFont = None
+
from svgelements import Arc
__author__ = "Filippo Rivato"
__email__ = "f.rivato@gmail.com"
@@ -86,6 +90,9 @@ class Tool(Plugin):
else:
block.append(f"(Text: {textToWrite})")
if fontFileName.upper().endswith(".SHX") :
+ if not ShxFont:
+ app.setStatus(_("Text abort: SHX font support not available"))
+ return
try :
shx = ShxFont(fontFileName)
paths = ShxPath()
--
2.49.0