Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/harfbuzz/src/gen-arabic-pua.py @ 3:2c135c81b16c
MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:44:09 +0200 |
| parents | b50eed0cc0ef |
| children |
comparison
equal
deleted
inserted
replaced
| 0:6015a75abc2d | 3:2c135c81b16c |
|---|---|
| 1 #!/usr/bin/env python3 | |
| 2 | |
| 3 """usage: ./gen-arabic-pua.py | |
| 4 """ | |
| 5 | |
| 6 import packTab | |
| 7 | |
| 8 | |
| 9 print ("/* == Start of generated table == */") | |
| 10 print ("/*") | |
| 11 print (" * The following table is generated by running:") | |
| 12 print (" *") | |
| 13 print (" * ./gen-arabic-pua.py") | |
| 14 print (" *") | |
| 15 print (" */") | |
| 16 print () | |
| 17 print ("#ifndef HB_OT_SHAPER_ARABIC_PUA_HH") | |
| 18 print ("#define HB_OT_SHAPER_ARABIC_PUA_HH") | |
| 19 print () | |
| 20 | |
| 21 code = packTab.Code('_hb_arabic') | |
| 22 | |
| 23 for p in ("ArabicPUASimplified.txt", "ArabicPUATraditional.txt"): | |
| 24 with open (p, encoding='utf-8') as f: | |
| 25 fields = [l.split('\t') for l in f if l[:1] != '#'] | |
| 26 data = {int(fs[1], 16):int(fs[0], 16) for fs in fields} | |
| 27 sol = packTab.pack_table(data, compression=9) | |
| 28 sol.genCode(code, f'pua_{p[9:13].lower()}_map') | |
| 29 | |
| 30 code.print_c(linkage='static inline') | |
| 31 | |
| 32 print () | |
| 33 print ("#endif /* HB_OT_SHAPER_ARABIC_PUA_HH */") | |
| 34 print () | |
| 35 print ("/* == End of generated table == */") |
