[emoji] Fix emoji table generation

Previously, the last of each range having Extended_Pictograph property
was not processed as so. Ouch!

Test:

$ echo x > null; hb-shape null -u U+1f43b,U+200d,U+2744,U+fe0f

Before:
[gid0=0+1000|gid0=2+1000]

After:
[gid0=0+1000|gid0=0+1000]

Caught by https://github.com/harfbuzz/harfbuzz/issues/3017
This commit is contained in:
Behdad Esfahbod 2021-06-09 15:10:52 -06:00
parent bd5502f09f
commit 855a3f478e
2 changed files with 36 additions and 30 deletions

View File

@ -61,7 +61,7 @@ for typ, s in ranges.items():
arr = dict() arr = dict()
for start,end in s: for start,end in s:
for i in range(start,end): for i in range(start, end + 1):
arr[i] = 1 arr[i] = 1
sol = packTab.pack_table(arr, 0, compression=3) sol = packTab.pack_table(arr, 0, compression=3)

View File

@ -24,36 +24,42 @@
#include "hb-unicode.hh" #include "hb-unicode.hh"
static const uint8_t static const uint8_t
_hb_emoji_u8[448] = _hb_emoji_u8[544] =
{ {
0, 0, 0, 0, 33, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 17, 50, 20, 21, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,118,152,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 6, 0, 7, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84,118, 0, 0, 0, 9, 0, 0, 10, 11, 12, 13, 14, 13, 15, 16, 17, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 20, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 3, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8, 7, 9, 10, 11, 0, 13, 13, 13, 13, 23, 24, 25, 26, 27, 28, 13, 13, 13, 13, 13, 29,
0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 13, 13, 13, 13, 30, 31, 13, 13, 13, 32, 13, 13, 0, 33, 0, 34,
7, 7, 7, 14, 15, 16, 17, 18, 19, 20, 7, 7, 7, 7, 7, 21, 35, 36, 37, 13, 38, 39, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0,
7, 7, 7, 7, 22, 23, 7, 7, 7, 24, 7, 14, 0, 25, 0, 26, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 30,
27, 28, 29, 14, 30, 31, 7, 7, 7, 7, 7, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 22, 0, 0, 0, 0, 0, 0, 0, 16, 0, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240, 1, 0, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 2, 0, 0,240, 3, 0, 6, 0, 0,
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,254, 7, 3, 0, 0, 0, 12, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0,128, 0, 0, 0,254, 15, 7, 4, 0, 0, 0, 0, 0, 0, 0,
159,255,243,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 12, 64, 0, 1, 0, 0, 0, 0, 0, 0,120,
31, 0,255,255,255,255,255,255, 31,255, 3, 0, 0, 0, 8, 0, 191,255,247,255,255,255,255,255,255,255,255,255,255,255,255,255,
0, 0, 24, 0,120, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 63, 0,255,255,255,255,255,255, 63,255, 87, 32, 2, 1, 24, 0,
0, 0, 0, 0, 0, 0, 16, 0, 96, 0, 0, 8, 0, 0, 0, 0, 144, 80,184, 0,248, 0, 0, 0, 0, 0,224, 0, 2, 0, 1,128,
255,255,255,255,255,255,255,127, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0,224, 0, 0, 24, 0, 0, 0, 0,
0, 0, 0, 0, 0,240, 1, 64, 0, 0,254, 3, 0,224,255,255, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 32,
255,255,255,255, 31, 0, 0, 0,254,127, 0, 0, 0, 0,252,115, 0, 0,128, 2, 0, 0, 0, 0, 0,224, 0, 0, 0,128, 0, 0,
0,254,255,255,255,255,255,255,255,255,255,255,255,255,255, 3, 0, 0, 0, 0, 0,240, 3,192, 0, 64,254, 7, 0,224,255,255,
255,255,255,255,255,255,255, 31,192,255,255,255,255,255,255,255, 255,255,255,255, 63, 0, 0, 0,254,255, 0, 4, 0,128,252,247,
255,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,127, 0,254,255,255,255,255,255,255,255,255,255,255,255,255,255, 7,
0, 0,224,255,255,255,255,127, 0,112, 0, 0, 0, 0, 0, 0, 255,255,255,255,255,255,255, 63,192,255,255,255,255,255,255,255,
0,127, 0,124, 0, 0, 0, 0, 0,127, 0, 0, 0,192,255,255, 255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,255,
0,240,255,255,255,255,255,243,159,255,255,255,255,255,255,255, 0, 0,224,255,255,255,255,255, 0,240, 0, 0, 0, 0, 0, 0,
0,255, 0,252, 0, 0, 0, 0, 0,255, 0, 0, 0,192,255,255,
0,240,255,255,255,255,255,247,191,255,255,255,255,255,255,255,
}; };
static inline unsigned static inline unsigned
@ -69,7 +75,7 @@ _hb_emoji_b1 (const uint8_t* a, unsigned i)
static inline uint_fast8_t static inline uint_fast8_t
_hb_emoji_is_Extended_Pictographic (unsigned u) _hb_emoji_is_Extended_Pictographic (unsigned u)
{ {
return u<131069u?_hb_emoji_b1(192+_hb_emoji_u8,((_hb_emoji_u8[64+(((_hb_emoji_b4(_hb_emoji_u8,u>>6>>4))<<4)+((u>>6)&15u))])<<6)+((u)&63u)):0; return u<131070u?_hb_emoji_b1(224+_hb_emoji_u8,((_hb_emoji_u8[64+(((_hb_emoji_b4(_hb_emoji_u8,u>>6>>4))<<4)+((u>>6)&15u))])<<6)+((u)&63u)):0;
} }