Won't it slow my game if I use FreeType lib and convert 2 fonts from .ttf instead of using preloaded BitmapFont .png? Or may be FreeType so fast, that I can use fonts both ways? All I need is to change color and size of my text. P.S. I use 3 fonts in my project
If you use a font rendering engine like FreeType, then the most common mistake is to re-render strings every frame. This is pointless, because when you render a string, it will usually be on the screen unchanged for at least a few seconds.
When you want to display a text, render that text to a texture once and then draw that texture instead of re-rendering the text. When you do this, the cost of text-rendering will only apply the first time you need to render a given string with given settings. On any subsequent frame, the cost of displaying that string is the same as for drawing any other sprite of that size.
A solution which I found quite handy in various projects was to have a
TextRenderingCache class to manage cached font renderings. It usually has a hash table with string plus render settings (font, color, size, etc.) as key and a texture with the rendering as value. When a given rendering is requested from the TextRenderingCache class, it checks if it already has that rendering, and if not it creates one. Dropping renderings from the hash-map which were not used for several seconds to avoid memory leakage is optional (some games need this, some do not).
By the way: FreeType already comes with a rendering cache system. But it is only used when you use it explicitly.
Yes, Freetype is reasonable. If you use .png files, you have to make one for EVERY size and EVERY color, and that may occupy 10 times the space a .ttf file takes up. Goodbye, free space on android and iOS devices. Moreover, you just have to get 1 .ttf file, and that's it. Hope I helped you!