Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: third_party/harfbuzz-ng/src/gen-arabic-joining-table.py

Issue 6052008: harfbuzz: check in harfbuzz-ng, add gyp define to use it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/harfbuzz-ng/src/check-libstdc++.sh ('k') | third_party/harfbuzz-ng/src/hb.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 import sys
4
5 header = sys.stdin.readline (), sys.stdin.readline ()
6 while sys.stdin.readline ().find ('##################') < 0:
7 pass
8
9
10 print "/* == Start of generated table == */"
11 print "/*"
12 print " * The following table is generated by running:"
13 print " *"
14 print " * ./gen-arabic-joining-table.py < ArabicShaping.txt"
15 print " *"
16 print " * on the ArabicShaping.txt file with the header:"
17 print " *"
18 for line in header:
19 print " * %s" % (line.strip())
20 print " */"
21
22 print "static const uint8_t joining_table[] ="
23 print "{"
24
25
26 min_u = 0x110000
27 max_u = 0
28 num = 0
29 last = -1
30 block = ''
31 for line in sys.stdin:
32
33 if line[0] == '#':
34 if line.find (" characters"):
35 block = line[2:].strip ()
36 continue
37
38 fields = [x.strip () for x in line.split (';')]
39 if len (fields) == 1:
40 continue
41
42 u = int (fields[0], 16)
43 if u == 0x200C or u == 0x200D:
44 continue
45 if u < last:
46 raise Exception ("Input data character not sorted", u)
47 min_u = min (min_u, u)
48 max_u = max (max_u, u)
49 num += 1
50
51 if block:
52 print "\n /* %s */\n" % block
53 block = ''
54
55 if last != -1:
56 last += 1
57 while last < u:
58 print " JOINING_TYPE_X, /* %04X */" % last
59 last += 1
60 else:
61 last = u
62
63 if fields[3] in ["ALAPH", "DALATH RISH"]:
64 value = "JOINING_GROUP_" + fields[3].replace(' ', '_')
65 else:
66 value = "JOINING_TYPE_" + fields[2]
67 print " %s, /* %s */" % (value, '; '.join(fields))
68
69 print
70 print " JOINING_TYPE_X /* dummy */"
71 print "};"
72 print
73
74 print "#define JOINING_TABLE_FIRST 0x%04x" % min_u
75 print "#define JOINING_TABLE_LAST 0x%04x" % max_u
76 print
77
78 print "/* == End of generated table == */"
79
80 occupancy = num * 100 / (max_u - min_u + 1)
81 # Maintain at least 40% occupancy in the table */
82 if occupancy < 40:
83 raise Exception ("Table too sparse, please investigate: ", occupancy)
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/check-libstdc++.sh ('k') | third_party/harfbuzz-ng/src/hb.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698