Commit 705c63a7c5917fc78912daccb08706d664fc428f

Darren Embry 2023-11-22T15:25:42

simplify error handling

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/bin/zeroslash.py b/bin/zeroslash.py
index 1dbc37d..0ff9c46 100755
--- a/bin/zeroslash.py
+++ b/bin/zeroslash.py
@@ -12,14 +12,10 @@ def copyChar(font, sourceCharName, destCharName, encoding=-1):
         if encoding < 0:
             raise Exception("%s not found and no encoding specified" % destCharName)
         font.createChar(encoding, destCharName)
-    print(sourceCharName)
-    sourceChar = font[sourceCharName]
-    if not sourceChar:
+    if not (sourceCharName in font):
         raise Exception("%s not found" % sourceCharName)
-    print(destCharName)
+    sourceChar = font[sourceCharName]
     destChar = font[destCharName]
-    if not destChar:
-        raise Exception("%s not found" % destCharName)
     pen = destChar.glyphPen(replace=True)
     sourceChar.draw(pen)
     pen = None                  # finalize pen drawing