pilo

Printing font with variable character width (exported from TTF)

3 posts in this topic

Hi everyone!

I thought it might be a good idea to be able to print variable width font on GLCD.

I wrote a simple example using this (see pictures and code in vfw.tar.gz). I don't think it was done before with MIOS? (I made a quick search).

The font bitmap are exported from TTF file using a very quick (and ugly) C program based on Freetype (it might be Linux only... Freetype was an easy option for me, and a good font rasterizer). It takes as input the TTF file and a size, which is then exported as a .c file, which can then be included inside MIOS app (one file per font and size).

 

font.c

 

IMG_0292.JPG

IMG_0294.JPG

IMG_0295.JPG

vfw.tar.gz

Edited by pilo

Share this post


Link to post
Share on other sites

Hi @pilo

intresting stuff.

It looks like you can print multiple font faces and sizes on the same dispaly. Is this already implemented in MIOS?

Share this post


Link to post
Share on other sites

Hi @tago

Yes, you can print text using different font faces and sizes. It's not part of MIOS, but works by using bitmap drawing MIOS functions.

It's still a bitmap font system, TTF have to be exported to bitmap, so it takes a little bit of memory for each font faces and size. Also it's not a full featured font system, for example it doesn't support kerning (could be added, but will take even more memory).

 

If you want I could set up a better example (the one I posted was just a quick test).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now