import sys from collections import OrderedDict import packTab
if len (sys.argv) != 3:
sys.exit (__doc__)
f = open(sys.argv[1])
header = [f.readline () for _ in range(10)]
ranges = OrderedDict() for line in f.readlines():
line = line.strip() ifnot line or line[0] == '#': continue
rang, typ = [s.strip() for s in line.split('#')[0].split(';')[:2]]
rang = [int(s, 16) for s in rang.split('..')] if len(rang) > 1:
start, end = rang else:
start = end = rang[0]
if typ notin ranges:
ranges[typ] = [] if ranges[typ] and ranges[typ][-1][1] == start - 1:
ranges[typ][-1] = (ranges[typ][-1][0], end) else:
ranges[typ].append((start, end))
print ("/* == Start of generated table == */")
print ("/*")
print (" * The following tables are generated by running:")
print (" *")
print (" * ./gen-emoji-table.py emoji-data.txt")
print (" *")
print (" * on file with this header:")
print (" *") for l in header:
print (" * %s" % (l.strip()))
print (" */")
print ()
print ("#ifndef HB_UNICODE_EMOJI_TABLE_HH")
print ("#define HB_UNICODE_EMOJI_TABLE_HH")
print ()
print ('#include "hb-unicode.hh"')
print ()
for typ, s in ranges.items(): if typ != "Extended_Pictographic": continue
arr = dict() for start,end in s: for i in range(start, end + 1):
arr[i] = 1
print ()
print ("#endif /* HB_UNICODE_EMOJI_TABLE_HH */")
print ()
print ("/* == End of generated table == */")
# Generate test file.
sequences = [] with open(sys.argv[2]) as f: for line in f.readlines(): if"#" in line:
line = line[:line.index("#")] if";"in line:
line = line[:line.index(";")]
line = line.strip()
line = line.split(" ") if len(line) < 2: continue
sequences.append(line)
with open("../test/shape/data/in-house/tests/emoji-clusters.tests", "w") as f: for sequence in sequences:
f.write("../fonts/AdobeBlank2.ttf;--no-glyph-names --no-positions --font-funcs=ot")
f.write(";" + ",".join(sequence))
f.write(";[" + "|".join("1=0"for c in sequence) + "]\n")
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.