summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py')
-rwxr-xr-xBuild/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py
index cdf81fe7524..912b1d7ea2c 100755
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py
@@ -133,8 +133,8 @@ what = ["INDIC_SYLLABIC_CATEGORY", "INDIC_MATRA_CATEGORY"]
what_short = ["ISC", "IMC"]
print ('#pragma GCC diagnostic push')
print ('#pragma GCC diagnostic ignored "-Wunused-macros"')
+cat_defs = []
for i in range (2):
- print ()
vv = sorted (values[i].keys ())
for v in vv:
v_no_and = v.replace ('_And_', '_')
@@ -146,10 +146,17 @@ for i in range (2):
raise Exception ("Duplicate short value alias", v, all_shorts[i][s])
all_shorts[i][s] = v
short[i][v] = s
- print ("#define %s_%s %s_%s %s/* %3d chars; %s */" %
- (what_short[i], s, what[i], v.upper (),
- ' '* ((48-1 - len (what[i]) - 1 - len (v)) // 8),
- values[i][v], v))
+ cat_defs.append ((what_short[i] + '_' + s, what[i] + '_' + v.upper (), str (values[i][v]), v))
+
+maxlen_s = max ([len (c[0]) for c in cat_defs])
+maxlen_l = max ([len (c[1]) for c in cat_defs])
+maxlen_n = max ([len (c[2]) for c in cat_defs])
+for s in what_short:
+ print ()
+ for c in [c for c in cat_defs if s in c[0]]:
+ print ("#define %s %s /* %s chars; %s */" %
+ (c[0].ljust (maxlen_s), c[1].ljust (maxlen_l), c[2].rjust (maxlen_n), c[3]))
+print ()
print ('#pragma GCC diagnostic pop')
print ()
print ("#define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M)")
@@ -249,14 +256,14 @@ print ("}")
print ()
print ("#undef _")
for i in range (2):
- print
+ print ()
vv = sorted (values[i].keys ())
for v in vv:
print ("#undef %s_%s" %
(what_short[i], short[i][v]))
print ()
-print ()
print ('#endif')
+print ()
print ("/* == End of generated table == */")
# Maintain at least 30% occupancy in the table */