Microsoft True Type Font Decoding

I am working on an embedded platform (STM32F407) with TFT LCD as a display (480x800px) and would like to make my user interface somewhat customizable for the end user. I thought that the best source for fonts would be windows that are compatible as the most common.

My current implementation uses my own custom drawn font in binary format, and a descriptor table giving the character width and ascii value but drawing my own font differently is tedious.

I would like to read in the True Type Font file from the SD card and be able to use glyphs of different sizes in it, but I have not seen a direct implementation of how to achieve this magic. Can someone point me to a good c / C ++ example of what I'm looking for?

Even better, as a way to remove kinks, I would like to make a simple gcc command-line program that will output my input with the selected font, using "#" as pixels. That way, I can just worry about the implementation, and not about any random errors that may appear.

Can anybody help me?

+4
source share
2 answers

As duskwuff says: TTF is primarily a vector format, you will need to write a renderer. It is better to use an image file to define the font, or use a bitmap font format such as FNT (Windows) or BDF (UNIX).

Here is my answer to my question: AngelCode BMFont and Usage . This allows you to select selective characters from the set char, mix the font, and export the image with the map file to each character. Easy to use.

+1
source

Perhaps you can use the Freetype library.

+4
source

All Articles