Jump to content

Printing font with variable character width (exported from TTF)


pilo
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • 11 months later...

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).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...