[config/ucd] Add HB_NO_UNICODE_UNASSIGNED and activate in HB_TINY
Saves another 12kb: $ python ./gen-ucd-table.py ucd.nounihan.grouped.zip > hb-ucd-table.hh && make -j5 CPPFLAGS='-Os -DHB_TINY' -C ~/hb/build/src/ && size ~/hb/build/src/.libs/libharfbuzz_la-hb-ucd.o INFO: Loading UCDXML... INFO: Preparing data tables... INFO: Generating output... INFO: Compression=1: INFO: Dataset=gc FullCost=18612 INFO: Dataset=ccc FullCost=3550 INFO: Dataset=bmg FullCost=1548 INFO: Dataset=sc FullCost=17765 INFO: Dataset=dm FullCost=13325 INFO: Compression=3: INFO: Dataset=gc FullCost=10726 INFO: Dataset=ccc FullCost=2389 INFO: Dataset=bmg FullCost=1052 INFO: Dataset=sc FullCost=13669 INFO: Dataset=dm FullCost=7780 INFO: Compression=5: INFO: Dataset=gc FullCost=8274 INFO: Dataset=ccc FullCost=2055 INFO: Dataset=bmg FullCost=908 INFO: Dataset=sc FullCost=4073 INFO: Dataset=dm FullCost=7780 INFO: Done. Part of https://github.com/harfbuzz/harfbuzz/issues/1652
This commit is contained in:
parent
ccea7fa119
commit
ad97ec9501
@ -109,7 +109,8 @@ The pre-defined configurations are:
|
|||||||
as esoteric or rarely-used shaping features. See the definition for details.
|
as esoteric or rarely-used shaping features. See the definition for details.
|
||||||
|
|
||||||
* `HB_TINY`: Enables both `HB_MINI` and `HB_LEAN` configurations, as well as
|
* `HB_TINY`: Enables both `HB_MINI` and `HB_LEAN` configurations, as well as
|
||||||
disabling thread-safety and debugging, and use size-optimized data tables.
|
disabling thread-safety and debugging, and use even more size-optimized data
|
||||||
|
tables.
|
||||||
|
|
||||||
|
|
||||||
## Tailoring configuration
|
## Tailoring configuration
|
||||||
|
@ -72,6 +72,7 @@ for line in open('hb-common.h'):
|
|||||||
|
|
||||||
DEFAULT = 1
|
DEFAULT = 1
|
||||||
COMPACT = 3
|
COMPACT = 3
|
||||||
|
SLOPPY = 5
|
||||||
|
|
||||||
|
|
||||||
logging.info('Generating output...')
|
logging.info('Generating output...')
|
||||||
@ -105,15 +106,32 @@ datasets = [
|
|||||||
('dm', dm, None, dm_order),
|
('dm', dm, None, dm_order),
|
||||||
]
|
]
|
||||||
|
|
||||||
for compression in (DEFAULT, COMPACT):
|
for compression in (DEFAULT, COMPACT, SLOPPY):
|
||||||
logging.info(' Compression=%d:' % compression)
|
logging.info(' Compression=%d:' % compression)
|
||||||
print()
|
print()
|
||||||
if compression == DEFAULT:
|
if compression == DEFAULT:
|
||||||
print('#ifndef HB_OPTIMIZE_SIZE')
|
print('#ifndef HB_OPTIMIZE_SIZE')
|
||||||
|
elif compression == COMPACT:
|
||||||
|
print('#elif !defined(HB_NO_UCD_UNASSIGNED)')
|
||||||
else:
|
else:
|
||||||
print('#else')
|
print('#else')
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
if compression == SLOPPY:
|
||||||
|
for i in range(len(gc)):
|
||||||
|
if (i % 128) and gc[i] == 'Cn':
|
||||||
|
gc[i] = gc[i - 1]
|
||||||
|
for i in range(len(gc) - 2, -1, -1):
|
||||||
|
if ((i + 1) % 128) and gc[i] == 'Cn':
|
||||||
|
gc[i] = gc[i + 1]
|
||||||
|
for i in range(len(sc)):
|
||||||
|
if (i % 128) and sc[i] == 'Zzzz':
|
||||||
|
sc[i] = sc[i - 1]
|
||||||
|
for i in range(len(sc) - 2, -1, -1):
|
||||||
|
if ((i + 1) % 128) and sc[i] == 'Zzzz':
|
||||||
|
sc[i] = sc[i + 1]
|
||||||
|
|
||||||
|
|
||||||
code = packTab.Code('_hb_ucd')
|
code = packTab.Code('_hb_ucd')
|
||||||
|
|
||||||
for name,data,default,mapping in datasets:
|
for name,data,default,mapping in datasets:
|
||||||
@ -123,11 +141,10 @@ for compression in (DEFAULT, COMPACT):
|
|||||||
|
|
||||||
code.print_c(linkage='static inline')
|
code.print_c(linkage='static inline')
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
if compression != DEFAULT:
|
print('#endif')
|
||||||
print()
|
print()
|
||||||
print('#endif')
|
|
||||||
print()
|
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print("#endif /* HB_UCD_TABLE_HH */")
|
print("#endif /* HB_UCD_TABLE_HH */")
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#define HB_LEAN
|
#define HB_LEAN
|
||||||
#define HB_MINI
|
#define HB_MINI
|
||||||
#define HB_NO_MT
|
#define HB_NO_MT
|
||||||
|
#define HB_NO_UCD_UNASSIGNED
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#endif
|
#endif
|
||||||
|
1161
src/hb-ucd-table.hh
1161
src/hb-ucd-table.hh
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user