Creating a font for mathematical text


I’m still working on my game for my students and I need to display mathematical expressions. I don’t want to use images because I want to generate random content at some point.

So I tried to change a tga font ta add a line over numbers so I can write something like sqrt(12+x), using the actual square root symbol.

But the result is not very good.

My problem is that I don’t understand how blender knows where a character begins and end in the tga image. I assume it is liked to the size of the square around the @ symbol, but I don’t really understand.

You can try “$rst” with the attach file. to see what you get.

So if you have any Idea…



I think this thread may interest you, it is about colorizing letters, but the same principles should work with your problem:

The letters in your “own font” may be any objects, so the square root should be easy. Maybe it is even possible to some way parent or constrait the number to be squared to the square root symbol, or opposite, to get it always size right…

That’s very interesting. I’m going to investigate it.

I’m not very far with my font set, but that’s just that the letters are not cut correctly.

In fact one of the main problem is to connect “letters”. For example in the attach file, I use the “UVW” to do the line of the fraction, but they are not connected. But in the tga file, there is no space between them…


I return to this subject because I still cannot figure how blender decides what part of the tga font correspond to what letter and how it decides what are their bounds.

From what I’ve found on internet, tga fonts are usually made by putting each letter in a fixed size box. But even if I put each character in the corresponding box, some of them are not correctly displayed (one of the side is not shown for example).

And when some characters are attached (a line goes accross 3 characters), but when they are displayed side by side, there is a small gap between each other.

I don’t really understand why we have to highlight the “@” character for the uv/mapping. Obviously it does not give blender the size of each cell, because some of them are bigger. So what’s the point?

I thought that maybe blender seeks for the other occurence of the “@” character and use this to calculate the size of the cells, but if it was the case, the bigger the square used in the uv/mapping windows, the smaller the cells would be. But it is not the case.

So does it tells to blender to increase the bound around a character with that many pixels?

I think I just noticed something in Blender font images…see that line of “static” at the very top of the image? Various pixels of seemingly random intensity. I think that Blender uses these pixels to determine how wide a letter should be. Putting the UVs on the “@” is likely because an @ is usually the largest glyph in a normal font.


It may not be an issue with your font at all. Try going into edit mode and scaling your plane down a bit. Blender might be throwing the gap in for you.

I know that if you remove the static then it doesn’t work so Toomai could be on to something.

I’ve tried scaling down or up the plane, scaling down or up the uv-projection, but the gap never goes away. Maybe there is something with the statics, but I have absolutly no idea of their meaning…

Have you tried scaling in edit mode? As in, not in object mode? And yes, the “static” tells Blender where characters are :wink:

Thanks for this tuto, and for the scaling in edit mode! It helps a lot. Do you know where I can find things about the static because I wonder how it works.

Anyway, thanks a lot guys.

From what I’ve seen, the size must be defined for each letter in the static because if I replace a “small” letter such as “i” by a bigger one “O”, the new letter is never correctly drawn. So I think I might have to create a .ttf and then generate the tga with ftblender.