This website requires JavaScript.
Explore
Help
Register
Sign In
shadowfacts
/
fonttools
Watch
1
Star
0
Fork
0
You've already forked fonttools
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
fonttools
/
Lib
/
fontTools
/
otlLib
/
optimize
/
__main__.py
7 lines
104 B
Python
Raw
Normal View
History
Unescape
Escape
Add optional compaction of GPOS PairPos subtables in otlLib.optimize.gpos See pull request: https://github.com/fonttools/fonttools/pull/2326 The new module `otlLib.optimize.gpos` provides `compact` functions that can reduce the file size of GPOS PairPos lookups by splitting subtables in a smart way to avoid storing zero-valued pairs. The compaction methods are called from `otlLib.builder` and `varLib.merger` so that static and variable fonts can benefit from the optimization at compile time. The new module `otlLib.optimize` is also executable, to allow running the optimization on existing fonts. The optimization is a trade-off because on the one hand it can reduce significantly the byte size of the GPOS table (up to 50% in random Google Fonts) but on the other hand it adds to the compilation time and may make fonts very slightly bigger once compressed to WOFF2 (because WOFF2 doesn't mind about zero values and compresses them very well). As such, the optimization is off by default, and you can activate it by providing the environment variable `FONTTOOLS_GPOS_COMPACT_MODE=5` for example (values from 0 = off to 9 = max file size savings, but many more subtables).
2021-05-28 16:46:20 +01:00
import
sys
from
fontTools
.
otlLib
.
optimize
import
main
Blacken code
2022-12-13 11:26:36 +00:00
if
__name__
==
"
__main__
"
:
sys
.
exit
(
main
(
)
)
Reference in New Issue
Copy Permalink