-
-
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
Import XOR packed #40
base: master
Are you sure you want to change the base?
Conversation
Done !!!
Not sure if design fits nice and do not like useless jQuery - trying live without :-) Just in case short description of current format:
Glyphs offset now points to bit (almost)
Compressor is almost 1:1 picked from latest C# version, btw there is also small optimisation - to speedup check of non-/zero blocks - array holding sum of 1-s and I can compare 2 sum indexes instead of iterate all bits again and again. |
let glyphsOutput = 'const GFXglyph ' + name + 'Glyphs[] PROGMEM = {\n' | ||
glyphsOutput += glyphs.join('\n') + '\n};\n\n' | ||
glyphsOutput += '{' + glyphs.join("\n{") + '\n};\n\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glyphs
is an array of arrays now so I don't think that works 🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot tell looking to code, but if it would not...
Anyway I changed your logic here a bit - I am using array with data as I am changing offsets too so maybe it looks a bit different then before, also formatting was dropped at least for xored (simplicity).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, but even with plain JS you can do miracles :-)
glyphs
(93) [Array(6), Array(6), Array(6), ...]
0: (6) [45, 4, 34, 10, 5, "-33 },// 0x21 '!'"]
1: (6) [-102, 13, 12, 16, 2, `-33 },// 0x22 '"'`]
glyphs.join("\n{")
'45,4,34,10,5,-33 },// 0x21 \'!\'\n{-102,13,12,16,2,-33 },// 0x22 \'"\'\n{33,25,34,26,0,-33 },// 0x23 \'#\'\n{193,22,40,25,2,-35 },// 0x24 \'$\'\n{439,36,34,40,3,-33 },// 0x25 \'%\'\n{435,28,34,31,2,-33 },// 0x26 \'&\'\n{227,4,12,7,2,-33 },// 0x27 \'\'\'\n{268,11,43,15,3,-33 },// 0x28...
Would tell there is default toString() for small arrays and comma default separator(?) - by fortune there is nothing like [object Array]\n[object]...
one would expect 👍
Also glyphs.toString()
does almost same except LFs.
And if someone want to play with, may check ArduinoSimulator repo I used to build / test Arduino version - simple port of Arduino to C# (form) / C++ made in good old VS 2008(?) Express
But there is tricky Harvard architecture - you cannot distinguish program/data memory so real Atmel may not work same everytime.
Or pack / improve compression in C# GFXpack repo, great is CharBox/Row there show nice text version of data inside, you can edit by changing particular byte in arrays or say Xor even in Immediate window.
Sorry @eltomjan for not coming back to you early on this — it's complicated to find personal time to contribute these days. 💪🏼 Thanks for the hard work on that.
👉🏼 What I would still need from you if you don't mind:
Thank you! |
Made also a demo in meantime here eltomjan.github.io ... Adafruit-GFX-Font-Customiser.htm. I respect your preferences - this great repo is your...
In short my usecase was out of FLASH (32kB), but client wanted better UI, big fonts and extend logic... |
Finished test in Wokwi simulator (FreeSerifBoldItalic9pt7b) https://wokwi.com/projects/394882822504014849 XorPack changes commit (change from default GFX to XorPacked font on ILI9341) - changed files are in project folder(s) |
In case you do not have time, just give me instructions how to update PR and I can do that. |
Made import preview, with optional UnXor - nice to see under the hood sometimes :-)
And there are 2 old fonts from ArduinoSimulator project in test folder.
Got lof of problems trying to add export - quite random bugs in the middle of some chars.
At the moment have only C# compression recovered from unfinished version (created 7 years ago...).
There is a special logic - GFXglyph / bitmapOffset holds bit size of char or compressed data now.
In case compression fail (size increase) there is full size and original bitmap is used
There were multiple compression versions like row bitmap array and column data bitmap and some others forgotten, but suppose bit 1 prefix was best version as it was latest I used in my old project.
#39
Let me know if you prefer JS compression implementation or if C# (/cmd project) will be enough.
Here temporary C# packer version
https://github.com/eltomjan/ETEhomeTools/tree/master/CSharp/GFXpack