Wait, I'm loading the font in another thread, using al_load_font() right?
Then when I want to draw the font, Allegro takes the characters that I want to draw and render them on runtime.
From where Allegro takes the characters ? I have no idea, I have being reading about faces and stuff like that about the FreeType library, what I know is when I want to draw my text allegro is doing two things, when in fact should just do one thing, draw the text.
So far I think there are 3 process with fonts.
Loading the font from a File - slow
Caching the font that I want to draw - slow
Draw the font - fast
We're doing 3 processes with only two functions. If process Nº1 and Nº2 were done at the same time when calling al_load_font there wouldn't be any problem. But that is not possible, because:
Each face contains hundreds, if not thousands of distinct glyph images. Since typical text only uses a fraction of a face's glyphs, loading all glyphs at once is nearly never a good idea. Instead, it's better to only retrieve and store the ones we need more often.
I don't know if that has something to do whit the topic, but I think so.
So as you said "Whether you precache x glyphs or cache x glyphs on the fly, the total time to cache x glyphs is the same." The different with precache x glyphs from cache x glyphs on the fly is that I can do it on another thread, whitout interrupting the game.
Basically precache x glyphs would be separated form the drawing process so you can process that step on another thread.
The suggestion that people is giving my now is: "draw first the text and then is going to be fast", that's ok, but I cannot draw text on a second thread, and my game isn't based on "Loading" screens. Everything is happening on runtime, so if something haven't been loaded simply isn't shown.
The bad thing with fonts, is that even if you have loaded the font from a file isn't completely "prepared" as normal bitmaps, sounds etc... The only way would be placing a loading screen, load bitmas and other things, load the font, draw some letters and the move on. But my current implementation doesn't allow me to do that.
Edit: Reading Elias's post