-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compress fonts down to 50-70% and speed-up LCD prints ?? #39
Labels
Comments
eltomjan
changed the title
Compress fonts to 50-70% ??
Compress fonts down to 50-70% and speed-up LCD prints ??
Mar 13, 2024
Hi @eltomjan and thanks for the issue I need to get my head around what you propose, which is not easy as I'm not versed into XOR compression. I have limited bandwidth right now. About the UI: a simple checkbox when exporting would do, if you get motivated to propose a PR? |
PR is prepared (import with default, but optional UnXor).
Now whole font is a bitmap, last byte is size of block, offset in glyphs point to bit (but also substracted by supposed average position to fit in I16 in case).
And nice is even tiny fonts are compressed a bit (no increase), but checked only 3 added to test.
C# version would need refactor or start again from scratch and should be possibly translated to JS to work inside page too(?)
As there is optimisation - array holding sum of (1) bits so that you can just compare 2 sums instead of checking all bits for each block size...
And block size is same for whole font (char is indexed by glyphs to bit level and changing block size for each char may not bring big benefit except more complex code).
Also Arduino version is not updated yet (works with previous where each char has own block size and glyph index is replaced by char size, that needs to be summed to get right position).
It is funny - there is smalles font which have 179B bitmap and it is shrinked to 170B also :-)
In case there should be probably working a compression in C# and import here.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What do you think about XOR compression ?
Real font example with graphics in comments (v1, now there is improved v2).
https://github.com/eltomjan/ETEhomeTools/blob/master/ArduinoSimulator/Font_big.h
PR for original LCD
adafruit/Adafruit_ILI9340#19
Here graphical demo showing these blocks inside real font
https://eltomjan.github.io/JStoolsSPAdemos/FontPacker/webLog.htm
Log created by a demo C processing text font https://github.com/eltomjan/ETEhomeTools/tree/master/TextFontPackerDemo
I can create PR, but page is quite complex and not sure if there are any "global" changes already ?
Also do not know where to add it to UI - options could be checkbox(-es), new buttons, auto import of packed/plain, etc. ?
PC simulation
https://github.com/eltomjan/ETEhomeTools/tree/master/ArduinoSimulator
Old C# packer to generate fonts (now updated to improved v2)
https://github.com/eltomjan/ETEhomeTools/tree/master/CSharp/GFXpack
Some older generator / list of compression results
https://github.com/eltomjan/ETEhomeTools/blob/02c368e44a83ed0c4cb7ae59315b8c681f98fe11/gfxXorPacker.cpp#L332
The text was updated successfully, but these errors were encountered: