-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|81|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Showcase Home -> Functions Libraries


 
HoboBen
Created : 17 December 2017
Edited : 17 December 2017
Language : Python, C

Bakefont3



bakefont3 on GitHub
Screenshots
 
bakefont3 is a python3 module for rasterising font glyphs into a RGBA texture atlas and exporting metrics and kerning information, and a C library for loading that information.

 

Comments


Sunday, 17 December 2017, 17:50
Jayenkai
That looks alarmingly complicated!
Sunday, 17 December 2017, 18:08
HoboBen
It's not so bad. It's like a big spritesheet!

Look up "a" -> get its position in the spritesheet and what offset to draw it at

Look up "a", "b" -> find out that when you draw them one after each other you need to tweak it so that b moves left one pixel to look nice
Thursday, 21 December 2017, 09:22
HoboBen
I've done a full OpenGL example now that uses the data for basic layout and kerning and also does a fancy/ugly gradient (you can change the colours in real time)

(images are zoomed in!)





The OpenGL example is about 680 lines, that includes shaders, OpenGL stuff, using bakefont to load saved data
Thursday, 21 December 2017, 09:45
Jayenkai
Yup, looks alarmingly complicated
I stuck with a monospaced font, lazy as I am.
Friday, 22 December 2017, 08:12
HoboBen
For sure, making this was a bit of a detour from what I was originally working on!

But now that it's finished, I can download a font from fonts.google.com, plop it in, and get results straight away!


Friday, 22 December 2017, 08:14
Jayenkai
Kickass!