pimoroni-pico icon indicating copy to clipboard operation
pimoroni-pico copied to clipboard

Font Creation

Open peardox opened this issue 1 year ago • 5 comments
trafficstars

A load of hte samples use fonts

Are these generated by some common app ? If so what is it? Specifically some app that outputs the CPP + HPP ?

If it's common then it should be mantioned in an easily accessible place

If not (and there is no app that does close to the cpp+hpp) then I guess I could write one - but don't wanna re-invent the wheel

Hoping there's something already (I'm lazy)

peardox avatar Sep 19 '24 16:09 peardox

There’s PGFUtil but it’s intended to create fonts for loading in MicroPython, though it shouldn’t be a huge stretch to convert those to hpp. It’s also in desperate need of TLC - https://github.com/gadgetoid/pgfutil

Gadgetoid avatar Sep 19 '24 16:09 Gadgetoid

Yeah, that was an extrapalation of the desired functionality. Language awareness - would be easy to make one that uses a template for max flexibility...

peardox avatar Sep 19 '24 16:09 peardox

Found some Chinese utility but - well, it's all Chinese

So - started rolling my own. Finally got as far as being able to render a TTF/OTF accurately to the screen and then on to a bitmap

test This is a sample 32pt Segoe UI font (Win System font) - note the max rect is 33 high (from 32pt? fonts...)

test This one's dogica - a 8pt render of a free font for small systems (need to DL + zoom image I guess)

The grey checkerbox is the rectangle for the char and the pink one is where the actal TTF gets rendered to Could have an option to force monospace so e.g. Segoe was all same width Space could be saved by only storing the pink area + an offset (possibly not worth it?) Could also add in colour option for things like Emotes and hand-drawn glyphs

Currently Windows, Mac + Linux is Easy (FMX allows all mainstream OSes). Pi a little harder but do-able (I think) - would need Lazarus

peardox avatar Sep 30 '24 03:09 peardox

I used BMFont in the past to generate textures for OpenGL. Not sure how applicable it will be to Pimoroni bitmap fonts.

Slion avatar Dec 03 '24 06:12 Slion

Found a tool to convert bmfont to cpp; https://github.com/bibendovsky/bmfont_to_cpp

Slion avatar Dec 03 '24 21:12 Slion