The ttf is converted to web friendly woff and woff2 formats. While multiple formats are made available, a client will use only the best option it supports. So if the client supports woff2, it’ll only download that one.
Edited by future me: woff2 is actually not currently generated by Lime
That’s a question that’s been raised a few times in the community. Something to note, is web-servers typically employ compression without you needing to do anything special. The two common forms are Gzip and Brotli, with Brotli being the newer and generally superior.
With the standard build:
openfl build html5
Compressing the resulting 3.1MB js file with web-like compression squashes it down to:
- Gzip 493KB
- Brotli 360KB
You might also use the -final flag when building for your html5 target, to optimise it. It’ll take longer, but it makes a big difference. Just be careful to test, as sometimes this may have some consequences (such as when using reflections and dynamic references in your code).
openfl build html5 -final
That alone reduces a 3.1MB file down to 1.1MB in my testing.
Compressed, that 1.1MB file becomes:
- Gzip 255KB
- Brotli 203KB
Results may vary from web-server to web-server, as different compression level settings can be defined. The above were simply the gzip and brotli defaults on my system (no specified compression level).
