summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2018-12-13 12:29:29 +0000
committerKhaled Hosny <khaledhosny@eglug.org>2018-12-13 12:29:29 +0000
commiteb2c647ff693bf3218fd1772f11a008bfbc975e7 (patch)
treebd661a1d081b9ca0817b4cc1668aa3b941aa7916 /tools
parent8b8d0e848a38d9a8bc65dcf11c8b7bd84a63e3d0 (diff)
parentd2975902a87d3f4a6ff5806c35686c40af48ae70 (diff)
downloadpango-eb2c647ff693bf3218fd1772f11a008bfbc975e7.tar.gz
Merge branch 'issue-322' into 'master'
Issue #322 - Vertical text doesn't fall back to rotated versions of horizontal glyphs when necessary Closes #322 See merge request GNOME/pango!28
Diffstat (limited to 'tools')
-rwxr-xr-xtools/gen-vertical-orientation-U-table.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/gen-vertical-orientation-U-table.py b/tools/gen-vertical-orientation-U-table.py
new file mode 100755
index 00000000..4697b319
--- /dev/null
+++ b/tools/gen-vertical-orientation-U-table.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+#coding:utf-8
+import os
+import sys
+
+if len(sys.argv) != 2:
+ print('usage;./' + os.path.basename(__file__) + ' VerticalOrientation.txt')
+ sys.exit(1)
+
+#pick up all data from text
+data = []
+f = open(sys.argv[1], 'r')
+for line in f:
+ line = line.split("#")[0].strip()
+ if len(line) == 0:
+ continue
+
+ coderange, vo = line.split(";")
+ vo = vo.strip()
+
+ codes = coderange.split("..")
+ if len(codes) == 1:
+ st = int(codes[0], 16)
+ ed = st
+ else:
+ st = int(codes[0], 16)
+ ed = int(codes[1], 16)
+
+ data.append([st, ed, vo])
+f.close()
+
+
+#compress all data, replace Tu to U and Tr to R.
+compressed = []
+t = []
+for d in data:
+ if d[2] == 'Tu': d[2] = 'U'
+ if d[2] == 'Tr': d[2] = 'R'
+
+ if t == []:
+ t = d
+ else:
+ if t[2] == d[2] and t[1] + 1 == d[0]:
+ t[1] = d[1]
+ else:
+ compressed.append(t)
+ t = d
+compressed.append(t)
+
+
+#dump vo=U
+for d in compressed:
+ if d[2] == 'U':
+ print('{0x%04X, 0x%04X},' % tuple(d[0:2]))