Closed pveiga2 closed 1 month ago
Hi @pveiga2 I completely agree. Unfortunately I'm stuck with this font in this major version because removing it or replacing it with a font that has a smaller character set would be a BC break that impacts many users. I will keep this issue open for the next major so we don't forget.
In the meantime if anyone has any suggestions for fonts with a high character set vs. small file size ratio, please post them here. As a reference: the current default font is "Noto Sans CJK JP" (noto_sans.otf), contains 65535 characters and is 16.4MB. The alternative font I provide "Open Sans" (open_sans.ttf) contains 938 characters and is 217.4kB. I need something that covers most use cases but has an acceptable small file size.
One thing to note is the possibility a compatible font is already provided on the system. For example, we add exactly the same font in our web2print Docker image to enable wkhtmltopdf to work, installing this lib means it's installed twice.
Considering the amount of daily installations of your package, the proposed changes could make a huge difference in the necessary "computing footprint".
I wonder how many percent of generated QR codes have labels and how any of those have UTF-8 character?
Maybe it is enough to add a small check:
Combined with the idea of @pveiga2 to have a new suggested composer package, re-defining the default font, the BC impact should be rather small for a new major version.
Any improvement here?
We need to reduce our vendor size and encountered that endroid qr-code size is 16,8MB due fonts
No unfortunately not so if it is really a problem I suggest you create a fork and remove the font. Good luck
@endroid Does that mean you do not consider this change?
Last month alone this package was installed 1.1 million times. The sheer amount of computing resources that could be saved, docker image sizes, Github CI caches ... all that for a feature that is likely not required by many people would be a nice win.
@kevinpapst you can remove the font via a post-install hook. https://github.com/liborm85/composer-vendor-cleaner
The font is removed in the latest version.
Thanks @endroid for tackling the issue 👍
Looking forward for the time I am out of the 50% percentile who cannot yet use it, due to the 8.2+ requirement 😁
Too bad, be patient. But I can tell you're not missing out on any new features yet ;)
First of all, thank you for this great work! I'd like to suggest a size optimization.
While inspecting through the sources, I noticed the NotoSans Font is only used as a fallback for the Label component. Out of the approximately 16.8 MB the endroid/qr-code takes, 16MB alone are due to this font file.
I think this is a bit too much, considering that :
Suggestions:
Thank you for your time ;)