Page 1 of 1

Format of .BIN fonts.

Posted: Mon Nov 07, 2022 8:59 pm
by AndyGadget
Francesco, you mentioned some time back you intended to provide a way of generating .BIN files to use as Annex custom fonts.
Doing a hex dump of one it does appear to be a fairly simple bitmapped file.
I know you've got a lot on your plate at the moment, but could you possibly give some detail on the format of a .BIN font file?

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 6:31 am
by BeanieBots
Seconded.

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 10:55 am
by cicciocb
Thirded :D

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 1:53 pm
by AndyGadget
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Nov 07, 2022 8:59 pm . . . it does appear to be a fairly simple bitmapped file.
And there again, maybe not :lol:
Looks like it's continuous, not byte constrained data, with the first block (434 bytes in the TomThumb font) pointing to offsets in the main data block.

That's like the Arduino GFX Glyph library format these originated from, but I was hoping they'd be decompressed for Annex use.
Ah well :D

Francesco, does your cryptic comment mean you don't know either? :o
(You were using someone else's code to convert these?)

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 4:01 pm
by cicciocb
No, it was simply a joke.
The format is simply the GFXfont format, (the include .h files simply converted in .bin) but using a simple little trick to have all in the same contiguous memory space.
In fact these fonts contains several tables (3, if I remember well) that can be allocated in different memory places when imported in the code as .h
What I did is simply put these tables in sequence with an offset reference and computing back the absolute memory address when loaded in memory.
This has been done to be compatible with the original tft_espi functions and font format.

The problem is that I forgot how I did and I need to find where is the program I did for the conversion.

The good news is that I'm working on the WS28B12 and I want implement text scrolling so I'm motivated in the research

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 6:24 pm
by cicciocb
I have a good news for you :D

Always using the web simulator, I created a little example and written a simple procedure in the sketch available here
https://wokwi.com/projects/347765374091002450

You will find the instructions with an already included font in the tab "sketch.ino"

Enjoy and let me know; you could also share the converted fonts on the forum.

cicciocb

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 8:28 pm
by AndyGadget
Francesco, you're a marvel!
I'll have a go with this tomorrow.

Re: Format of .BIN fonts.

Posted: Tue Nov 08, 2022 10:21 pm
by AndyGadget
. . . or even tonight.

Just tried running through the process for making an Annex font from a TTF and it works perfectly. :D