[ucd] Save another 1.5kb
https://github.com/harfbuzz/harfbuzz/issues/1652
This commit is contained in:
parent
6d58b45782
commit
5074d665a8
|
@ -31,14 +31,15 @@ ce = {i for i,u in enumerate(ucd) if u['Comp_Ex'] == 'Y'}
|
|||
|
||||
assert not any(v for v in dm.values() if len(v) not in (1,2))
|
||||
dm1 = sorted(set(v for v in dm.values() if len(v) == 1))
|
||||
dm1_array = ['0x%04Xu' % v for v in dm1]
|
||||
dm1_u16_array = ['0x%04Xu' % v for v in dm1 if v[0] <= 0xFFFF]
|
||||
dm1_u32_array = ['0x%04Xu' % v for v in dm1 if v[0] > 0xFFFF]
|
||||
dm1_order = {v:i+1 for i,v in enumerate(dm1)}
|
||||
dm2 = sorted((v, i) for i,v in dm.items() if len(v) == 2)
|
||||
dm2 = [("HB_CODEPOINT_ENCODE3 (0x%04Xu, 0x%04Xu, 0x%04Xu)" %
|
||||
(v+(i if i not in ce and not ccc[i] else 0,)), v)
|
||||
for v,i in dm2]
|
||||
dm2_array = [s for s,v in dm2]
|
||||
l = 1 + len(dm1_array)
|
||||
l = 1 + len(dm1_u16_array) + len(dm1_u32_array)
|
||||
dm2_order = {v[1]:i+l for i,v in enumerate(dm2)}
|
||||
dm_order = {None: 0}
|
||||
dm_order.update(dm1_order)
|
||||
|
@ -89,7 +90,8 @@ print()
|
|||
|
||||
code = packTab.Code('_hb_ucd')
|
||||
sc_array, _ = code.addArray('hb_script_t', 'sc_map', sc_array)
|
||||
dm1_array, _ = code.addArray('hb_codepoint_t', 'dm1_map', dm1_array)
|
||||
dm1_16_array, _ = code.addArray('uint16_t', 'dm1_u16_map', dm1_u16_array)
|
||||
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')
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ _hb_ucd_sc_map[138] =
|
|||
HB_SCRIPT_MARCHEN, HB_SCRIPT_OSAGE,
|
||||
HB_SCRIPT_TANGUT, HB_SCRIPT_NEWA,
|
||||
};
|
||||
static const hb_codepoint_t
|
||||
_hb_ucd_dm1_map[935] =
|
||||
static const uint16_t
|
||||
_hb_ucd_dm1_u16_map[825] =
|
||||
{
|
||||
0x003Bu, 0x004Bu, 0x0060u, 0x00B4u, 0x00B7u, 0x00C5u, 0x02B9u, 0x0300u,
|
||||
0x0301u, 0x0313u, 0x0385u, 0x0386u, 0x0388u, 0x0389u, 0x038Au, 0x038Cu,
|
||||
|
@ -192,20 +192,25 @@ _hb_ucd_dm1_map[935] =
|
|||
0x9A6Au, 0x9B12u, 0x9B6Fu, 0x9C40u, 0x9C57u, 0x9CFDu, 0x9D67u, 0x9DB4u,
|
||||
0x9DFAu, 0x9E1Eu, 0x9E7Fu, 0x9E97u, 0x9E9Fu, 0x9EBBu, 0x9ECEu, 0x9EF9u,
|
||||
0x9EFEu, 0x9F05u, 0x9F0Fu, 0x9F16u, 0x9F3Bu, 0x9F43u, 0x9F8Du, 0x9F8Eu,
|
||||
0x9F9Cu,0x20122u,0x2051Cu,0x20525u,0x2054Bu,0x2063Au,0x20804u,0x208DEu,
|
||||
0x20A2Cu,0x20B63u,0x214E4u,0x216A8u,0x216EAu,0x219C8u,0x21B18u,0x21D0Bu,
|
||||
0x21DE4u,0x21DE6u,0x22183u,0x2219Fu,0x22331u,0x226D4u,0x22844u,0x2284Au,
|
||||
0x22B0Cu,0x22BF1u,0x2300Au,0x232B8u,0x2335Fu,0x23393u,0x2339Cu,0x233C3u,
|
||||
0x233D5u,0x2346Du,0x236A3u,0x238A7u,0x23A8Du,0x23AFAu,0x23CBCu,0x23D1Eu,
|
||||
0x23ED1u,0x23F5Eu,0x23F8Eu,0x24263u,0x242EEu,0x243ABu,0x24608u,0x24735u,
|
||||
0x24814u,0x24C36u,0x24C92u,0x24FA1u,0x24FB8u,0x25044u,0x250F2u,0x250F3u,
|
||||
0x25119u,0x25133u,0x25249u,0x2541Du,0x25626u,0x2569Au,0x256C5u,0x2597Cu,
|
||||
0x25AA7u,0x25BABu,0x25C80u,0x25CD0u,0x25F86u,0x261DAu,0x26228u,0x26247u,
|
||||
0x262D9u,0x2633Eu,0x264DAu,0x26523u,0x265A8u,0x267A7u,0x267B5u,0x26B3Cu,
|
||||
0x26C36u,0x26CD5u,0x26D6Bu,0x26F2Cu,0x26FB1u,0x270D2u,0x273CAu,0x27667u,
|
||||
0x278AEu,0x27966u,0x27CA8u,0x27ED3u,0x27F2Fu,0x285D2u,0x285EDu,0x2872Eu,
|
||||
0x28BFAu,0x28D77u,0x29145u,0x291DFu,0x2921Au,0x2940Au,0x29496u,0x295B6u,
|
||||
0x29B30u,0x2A0CEu,0x2A105u,0x2A20Eu,0x2A291u,0x2A392u,0x2A600u,
|
||||
0x9F9Cu,
|
||||
};
|
||||
static const uint32_t
|
||||
_hb_ucd_dm1_u32_map[110] =
|
||||
{
|
||||
0x20122u,0x2051Cu,0x20525u,0x2054Bu,0x2063Au,0x20804u,0x208DEu,0x20A2Cu,
|
||||
0x20B63u,0x214E4u,0x216A8u,0x216EAu,0x219C8u,0x21B18u,0x21D0Bu,0x21DE4u,
|
||||
0x21DE6u,0x22183u,0x2219Fu,0x22331u,0x226D4u,0x22844u,0x2284Au,0x22B0Cu,
|
||||
0x22BF1u,0x2300Au,0x232B8u,0x2335Fu,0x23393u,0x2339Cu,0x233C3u,0x233D5u,
|
||||
0x2346Du,0x236A3u,0x238A7u,0x23A8Du,0x23AFAu,0x23CBCu,0x23D1Eu,0x23ED1u,
|
||||
0x23F5Eu,0x23F8Eu,0x24263u,0x242EEu,0x243ABu,0x24608u,0x24735u,0x24814u,
|
||||
0x24C36u,0x24C92u,0x24FA1u,0x24FB8u,0x25044u,0x250F2u,0x250F3u,0x25119u,
|
||||
0x25133u,0x25249u,0x2541Du,0x25626u,0x2569Au,0x256C5u,0x2597Cu,0x25AA7u,
|
||||
0x25BABu,0x25C80u,0x25CD0u,0x25F86u,0x261DAu,0x26228u,0x26247u,0x262D9u,
|
||||
0x2633Eu,0x264DAu,0x26523u,0x265A8u,0x267A7u,0x267B5u,0x26B3Cu,0x26C36u,
|
||||
0x26CD5u,0x26D6Bu,0x26F2Cu,0x26FB1u,0x270D2u,0x273CAu,0x27667u,0x278AEu,
|
||||
0x27966u,0x27CA8u,0x27ED3u,0x27F2Fu,0x285D2u,0x285EDu,0x2872Eu,0x28BFAu,
|
||||
0x28D77u,0x29145u,0x291DFu,0x2921Au,0x2940Au,0x29496u,0x295B6u,0x29B30u,
|
||||
0x2A0CEu,0x2A105u,0x2A20Eu,0x2A291u,0x2A392u,0x2A600u,
|
||||
};
|
||||
static const uint64_t
|
||||
_hb_ucd_dm2_map[1025] =
|
||||
|
|
|
@ -148,13 +148,19 @@ hb_ucd_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
|
|||
if (likely (!i)) return false;
|
||||
i--;
|
||||
|
||||
if (i < ARRAY_LENGTH (_hb_ucd_dm1_map))
|
||||
if (i < ARRAY_LENGTH (_hb_ucd_dm1_u16_map) + ARRAY_LENGTH (_hb_ucd_dm1_u32_map))
|
||||
{
|
||||
*a = _hb_ucd_dm1_map[i];
|
||||
if (i < ARRAY_LENGTH (_hb_ucd_dm1_u16_map))
|
||||
*a = _hb_ucd_dm1_u16_map[i];
|
||||
else
|
||||
{
|
||||
i -= ARRAY_LENGTH (_hb_ucd_dm1_u16_map);
|
||||
*a = _hb_ucd_dm1_u32_map[i];
|
||||
}
|
||||
*b = 0;
|
||||
return true;
|
||||
}
|
||||
i -= ARRAY_LENGTH (_hb_ucd_dm1_map);
|
||||
i -= ARRAY_LENGTH (_hb_ucd_dm1_u16_map) + ARRAY_LENGTH (_hb_ucd_dm1_u32_map);
|
||||
|
||||
uint64_t v = _hb_ucd_dm2_map[i];
|
||||
*a = HB_CODEPOINT_DECODE3_1 (v);
|
||||
|
|
Loading…
Reference in New Issue