summaryrefslogtreecommitdiffstats
path: root/gfx/harfbuzz/src/gen-arabic-pua.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /gfx/harfbuzz/src/gen-arabic-pua.py
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/harfbuzz/src/gen-arabic-pua.py')
-rwxr-xr-xgfx/harfbuzz/src/gen-arabic-pua.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/gfx/harfbuzz/src/gen-arabic-pua.py b/gfx/harfbuzz/src/gen-arabic-pua.py
new file mode 100755
index 0000000000..4cf290087d
--- /dev/null
+++ b/gfx/harfbuzz/src/gen-arabic-pua.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+
+"""usage: ./gen-arabic-pua.py
+"""
+
+import packTab
+
+
+print ("/* == Start of generated table == */")
+print ("/*")
+print (" * The following table is generated by running:")
+print (" *")
+print (" * ./gen-arabic-pua.py")
+print (" *")
+print (" */")
+print ()
+print ("#ifndef HB_OT_SHAPER_ARABIC_PUA_HH")
+print ("#define HB_OT_SHAPER_ARABIC_PUA_HH")
+print ()
+
+code = packTab.Code('_hb_arabic')
+
+for p in ("ArabicPUASimplified.txt", "ArabicPUATraditional.txt"):
+ with open (p, encoding='utf-8') as f:
+ fields = [l.split('\t') for l in f if l[:1] != '#']
+ data = {int(fs[1], 16):int(fs[0], 16) for fs in fields}
+ sol = packTab.pack_table(data, compression=9)
+ sol.genCode(code, f'pua_{p[9:13].lower()}_map')
+
+code.print_c(linkage='static inline')
+
+print ()
+print ("#endif /* HB_OT_SHAPER_ARABIC_PUA_HH */")
+print ()
+print ("/* == End of generated table == */")