aboutsummaryrefslogtreecommitdiffstats
path: root/Lib/defconQt/util/glyphList.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/defconQt/util/glyphList.py')
-rw-r--r--Lib/defconQt/util/glyphList.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/defconQt/util/glyphList.py b/Lib/defconQt/util/glyphList.py
new file mode 100644
index 0000000..7c16268
--- /dev/null
+++ b/Lib/defconQt/util/glyphList.py
@@ -0,0 +1,21 @@
+import re
+
+_parseGL_RE = re.compile("([A-Za-z_0-9.]+);([0-9A-F]{4})")
+
+
+def parseGlyphList(path):
+ GL2UV = {}
+ with open(path) as file:
+ for line in file:
+ if not line or line[:1] == '#':
+ continue
+ m = _parseGL_RE.match(line)
+ if not m:
+ print("warning: syntax error in glyphlist: %s".format(
+ repr(line[:20])))
+ glyphName = m.group(1)
+ if glyphName in GL2UV:
+ print("warning: glyphName redefined in glyphList: {}".format(
+ glyphName))
+ GL2UV[glyphName] = int(m.group(2), 16)
+ return GL2UV