# Printing font with variable character width (exported from TTF)

**URL:** <https://forum.midibox.org/t/printing-font-with-variable-character-width-exported-from-ttf/19211>\
**Category:** MIOS programming (C)\
**Tags:** font, ttf, glcd\
**Created:** [September 12, 2015, 4:52pm UTC](https://forum.midibox.org/t/printing-font-with-variable-character-width-exported-from-ttf/19211 "2015-09-12T16:52:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pilo](https://forum.midibox.org/letter_avatar_proxy/v4/letter/p/ecb155/32.png) [@pilo](https://forum.midibox.org/u/pilo)\
**Post date:** [September 12, 2015, 4:52pm UTC](https://forum.midibox.org/t/printing-font-with-variable-character-width-exported-from-ttf/19211/1 "2015-09-12T16:52:29Z")

</div>

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

&nbsp;

[font.c](\< _ **base\_url** _ \>/applications/core/interface/file/attachment.php?id=12140)

&nbsp;

 ![IMG0292.JPG.ba3a7cc32d57ab91f401ec5a767183e3.JPG](https://forum.midibox.org/uploads/default/original/2X/8/832350b6850f6507a66e88ea8c029e2e8e6fa637.jpeg)

 ![IMG0294.JPG.159ae4ae67355c123798a4c60d9d3e20.JPG](https://forum.midibox.org/uploads/default/original/2X/4/4fb4be46888be9adc44e73a7c10e29e70569c7bd.jpeg)

 ![IMG0295.JPG.523b43ccde86bf1c8be9fc3e1f4580e0.JPG](https://forum.midibox.org/uploads/default/original/2X/4/442359698194408adf7ca31875ea3ad6943a0e5e.jpeg)

[vfw.tar.gz](http://midibox.org/forums/applications/core/interface/file/attachment.php?id=12147)

---

<div class="post-metadata">

**Author:** ![tago](https://forum.midibox.org/letter_avatar_proxy/v4/letter/t/e8c25b/32.png) [@tago](https://forum.midibox.org/u/tago)\
**Post date:** [September 9, 2016, 10:40am UTC](https://forum.midibox.org/t/printing-font-with-variable-character-width-exported-from-ttf/19211/2 "2016-09-09T10:40:41Z")

</div>

Hi

intresting stuff.

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

---

<div class="post-metadata">

**Author:** ![pilo](https://forum.midibox.org/letter_avatar_proxy/v4/letter/p/ecb155/32.png) [@pilo](https://forum.midibox.org/u/pilo)\
**Post date:** [September 11, 2016, 8:31am UTC](https://forum.midibox.org/t/printing-font-with-variable-character-width-exported-from-ttf/19211/3 "2016-09-11T08:31:05Z")

</div>

Hi

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

&nbsp;

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