From f8daeef4c4451084a781db3a8a04807c0f0051ef Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 3 Jan 2018 14:27:34 +0000 Subject: [PATCH] [use] Simplify more --- src/gen-use-table.py | 11 +---- src/hb-ot-shape-complex-use-table.cc | 62 +++++++++++++++++----------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/src/gen-use-table.py b/src/gen-use-table.py index b361507e1..5391f27eb 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -352,12 +352,6 @@ def map_to_use(data): defaults = ('O', 'No_Block') data = map_to_use(data) -# Remove the outliers -singles = {} -for u in [0x034F, 0x25CC]: - singles[u] = data[u] - del data[u] - print "/* == Start of generated table == */" print "/*" print " * The following table is generated by running:" @@ -459,12 +453,9 @@ print "hb_use_get_categories (hb_codepoint_t u)" print "{" print " switch (u >> %d)" % page_bits print " {" -pages = set([u>>page_bits for u in starts+ends+singles.keys()]) +pages = set([u>>page_bits for u in starts+ends]) for p in sorted(pages): print " case 0x%0Xu:" % p - for u,d in singles.items (): - if p != u>>page_bits: continue - print " if (unlikely (u == 0x%04Xu)) return %s;" % (u, d[0]) for (start,end) in zip (starts, ends): if p not in [start>>page_bits, end>>page_bits]: continue offset = "use_offset_0x%04xu" % start diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index e150303ea..a67ef0611 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -75,7 +75,13 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 00C0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, /* 00D0 */ O, O, O, O, O, O, O, GB, -#define use_offset_0x0900u 80 +#define use_offset_0x0348u 80 + + + /* Combining Diacritical Marks */ + O, O, O, O, O, O, O, CGJ, + +#define use_offset_0x0900u 88 /* Devanagari */ @@ -188,7 +194,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 0DE0 */ O, O, O, O, O, O, B, B, B, B, B, B, B, B, B, B, /* 0DF0 */ O, O, VPst, VPst, O, O, O, O, -#define use_offset_0x1000u 1352 +#define use_offset_0x1000u 1360 /* Myanmar */ @@ -204,7 +210,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1080 */ B, B, MBlw, VPst, VPre, VAbv, VAbv, VMPst, VMPst, VMPst, VMPst, VMPst, VMPst, VMBlw, B, VMPst, /* 1090 */ B, B, B, B, B, B, B, B, B, B, VMPst, VMPst, VPst, VAbv, O, O, -#define use_offset_0x1700u 1512 +#define use_offset_0x1700u 1520 /* Tagalog */ @@ -237,7 +243,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 17D0 */ FM, VAbv, H, FM, O, O, O, O, O, O, O, O, B, VAbv, O, O, /* 17E0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1900u 1752 +#define use_offset_0x1900u 1760 /* Limbu */ @@ -281,7 +287,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, /* 1A90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x1b00u 2168 +#define use_offset_0x1b00u 2176 /* Balinese */ @@ -317,7 +323,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1C30 */ FAbv, FAbv, FAbv, FAbv, VMPre, VMPre, FM, CMBlw, O, O, O, O, O, O, O, O, /* 1C40 */ B, B, B, B, B, B, B, B, B, B, O, O, O, B, B, B, -#define use_offset_0x1cd0u 2504 +#define use_offset_0x1cd0u 2512 /* Vedic Extensions */ @@ -326,20 +332,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O, /* 1CF0 */ O, O, VMPst, VMPst, VMAbv, O, O, VMPst, VMAbv, VMAbv, O, O, O, O, O, O, -#define use_offset_0x1df8u 2552 +#define use_offset_0x1df8u 2560 /* Combining Diacritical Marks Supplement */ O, O, O, FM, O, O, O, O, -#define use_offset_0x2008u 2560 +#define use_offset_0x2008u 2568 /* General Punctuation */ O, O, O, O, ZWNJ, ZWJ, O, O, /* 2010 */ GB, GB, GB, GB, GB, O, O, O, -#define use_offset_0x2060u 2576 +#define use_offset_0x2060u 2584 /* 2060 */ WJ, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, @@ -348,14 +354,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O, /* 2080 */ O, O, FM, FM, FM, O, O, O, -#define use_offset_0x20f0u 2616 +#define use_offset_0x20f0u 2624 /* Combining Diacritical Marks for Symbols */ /* 20F0 */ VMAbv, O, O, O, O, O, O, O, -#define use_offset_0xa800u 2624 +#define use_offset_0x25c8u 2632 + + + /* Geometric Shapes */ + O, O, O, O, GB, O, O, O, + +#define use_offset_0xa800u 2640 /* Syloti Nagri */ @@ -442,7 +454,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst, /* AAF0 */ O, O, O, O, O, VMPst, H, O, -#define use_offset_0xabc0u 3384 +#define use_offset_0xabc0u 3400 /* Meetei Mayek */ @@ -452,14 +464,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O, /* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0xfe00u 3448 +#define use_offset_0xfe00u 3464 /* Variation Selectors */ /* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, -#define use_offset_0x10a00u 3464 +#define use_offset_0x10a00u 3480 /* Kharoshthi */ @@ -470,7 +482,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 10A30 */ B, B, B, B, O, O, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H, /* 10A40 */ B, B, B, B, B, B, B, B, -#define use_offset_0x11000u 3536 +#define use_offset_0x11000u 3552 /* Brahmi */ @@ -491,7 +503,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O, -#define use_offset_0x11100u 3728 +#define use_offset_0x11100u 3744 /* Chakma */ @@ -529,7 +541,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw, /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O, -#define use_offset_0x11280u 4048 +#define use_offset_0x11280u 4064 /* Multani */ @@ -557,7 +569,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, /* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O, -#define use_offset_0x11400u 4296 +#define use_offset_0x11400u 4312 /* Newa */ @@ -580,7 +592,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O, /* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -#define use_offset_0x11580u 4520 +#define use_offset_0x11580u 4536 /* Siddham */ @@ -623,7 +635,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O, /* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O, -#define use_offset_0x11a00u 4968 +#define use_offset_0x11a00u 4984 /* Zanabazar Square */ @@ -642,7 +654,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11A80 */ B, B, B, B, O, O, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, O, O, O, -#define use_offset_0x11c00u 5128 +#define use_offset_0x11c00u 5144 /* Bhaiksuki */ @@ -663,7 +675,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O, -#define use_offset_0x11d00u 5312 +#define use_offset_0x11d00u 5328 /* Masaram Gondi */ @@ -675,7 +687,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, O, O, O, O, O, O, O, O, /* 11D50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, -}; /* Table items: 5408; occupancy: 73% */ +}; /* Table items: 5424; occupancy: 73% */ USE_TABLE_ELEMENT_TYPE hb_use_get_categories (hb_codepoint_t u) @@ -683,9 +695,9 @@ hb_use_get_categories (hb_codepoint_t u) switch (u >> 12) { case 0x0u: - if (unlikely (u == 0x034Fu)) return CGJ; if (hb_in_range (u, 0x0028u, 0x003Fu)) return use_table[u - 0x0028u + use_offset_0x0028u]; if (hb_in_range (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u]; + if (hb_in_range (u, 0x0348u, 0x034Fu)) return use_table[u - 0x0348u + use_offset_0x0348u]; if (hb_in_range (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u]; break; @@ -699,10 +711,10 @@ hb_use_get_categories (hb_codepoint_t u) break; case 0x2u: - if (unlikely (u == 0x25CCu)) return GB; if (hb_in_range (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u]; if (hb_in_range (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u]; if (hb_in_range (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u]; + if (hb_in_range (u, 0x25C8u, 0x25CFu)) return use_table[u - 0x25C8u + use_offset_0x25c8u]; break; case 0xAu: