From: Behdad Esfahbod Date: Thu, 20 Jun 2019 00:34:12 +0000 (-0700) Subject: [ucd] Print out table sizes X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1a2384a5244ea3ea63ca94eb095c4add2cd451d;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [ucd] Print out table sizes --- diff --git a/src/gen-ucd-table.py b/src/gen-ucd-table.py index 967e000..c98c715 100755 --- a/src/gen-ucd-table.py +++ b/src/gen-ucd-table.py @@ -3,19 +3,22 @@ from __future__ import print_function, division, absolute_import import io, os.path, sys, re +import logging +logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO) if len (sys.argv) != 2: print("usage: ./gen-ucd-table ucd.nonunihan.grouped.xml", file=sys.stderr) sys.exit(1) - # https://github.com/harfbuzz/packtab import packTab import packTab.ucdxml +logging.info('Loading UCDXML...') ucdxml = packTab.ucdxml.load_ucdxml(sys.argv[1]) ucd = packTab.ucdxml.ucdxml_get_repertoire(ucdxml) +logging.info('Preparing data tables...') gc = [u['gc'] for u in ucd] ccc = [int(u['ccc']) for u in ucd] @@ -71,6 +74,7 @@ DEFAULT = 1 COMPACT = 3 +logging.info('Generating output...') print("/* == Start of generated table == */") print("/*") print(" * The following table is generated by running:") @@ -83,8 +87,6 @@ print() print("#ifndef HB_UCD_TABLE_HH") print("#define HB_UCD_TABLE_HH") print() - -print() print('#include "hb.hh"') print() @@ -95,7 +97,16 @@ dm1_32_array, _ = code.addArray('uint32_t', 'dm1_u32_map', dm1_u32_array) dm2_array, _ = code.addArray('uint64_t', 'dm2_map', dm2_array) code.print_c(linkage='static inline') +datasets = [ + ('gc', gc, 'Cn', gc_order), + ('ccc', ccc, 0, None), + ('bmg', bmg, 0, None), + ('sc', sc, 'Zzzz', sc_order), + ('dm', dm, None, dm_order), +] + for compression in (DEFAULT, COMPACT): + logging.info(' Compression=%d:' % compression) print() if compression == DEFAULT: print('#ifndef HB_OPTIMIZE_SIZE') @@ -105,11 +116,10 @@ for compression in (DEFAULT, COMPACT): code = packTab.Code('_hb_ucd') - packTab.pack_table(gc, 'Cn', mapping=gc_order, compression=compression).genCode(code, 'gc') - packTab.pack_table(ccc, 0, compression=compression).genCode(code, 'ccc') - packTab.pack_table(bmg, 0, compression=compression).genCode(code, 'bmg') - packTab.pack_table(sc, 'Zzzz', mapping=sc_order, compression=compression).genCode(code, 'sc') - packTab.pack_table(dm, None, mapping=dm_order, compression=compression).genCode(code, 'dm') + for name,data,default,mapping in datasets: + sol = packTab.pack_table(data, default, mapping=mapping, compression=compression) + logging.info(' Dataset=%-8s FullCost=%d' % (name, sol.fullCost)) + sol.genCode(code, name) code.print_c(linkage='static inline') @@ -123,3 +133,4 @@ print() print("#endif /* HB_UCD_TABLE_HH */") print() print("/* == End of generated table == */") +logging.info('Done.') diff --git a/src/hb-ucd-table.hh b/src/hb-ucd-table.hh index ae339ec..e9d0975 100644 --- a/src/hb-ucd-table.hh +++ b/src/hb-ucd-table.hh @@ -10,7 +10,6 @@ #ifndef HB_UCD_TABLE_HH #define HB_UCD_TABLE_HH - #include "hb.hh" static const hb_script_t