- Online Community Forums » Programming Questions » Can I Draw Scaled Text?

This thread is locked; no one can reply to it. rss feed Print
Can I Draw Scaled Text?
Member #15,725
September 2014

Hi everybody,

There is a way to draw scaled text in both axes?

For TTF, i can resize the textsize with size parameter; but on Bitmap Font, i'm trying to resize the loaded bitmap to make my font smallest but al_grab_font_from_bitmap return me False.

I think when my bitmap was resized, i lost the bounding box line.


Anyone have any idea to make it work? or give me another solution to "scaled text"???

Member #5,749
April 2005

Scaling your bitmap font before passing it to al_grab_font_from_bitmap won't work. This function requires pixel-perfect precision from the passed bitmap; scaling it beforehand will do weird things with the gaps between the characters. If you've enabled texture smoothing, the gaps will actually become blurred - meaning you have absolutely no chance :P

The best way of dealing with this would be to load your bitmap font normally, then use transformations to scale the result of al_draw_text.

For example, to scale your text to twice the size:

al_scale_transform(&tr, 2, 2);

al_draw_text(font, al_map_rgb_f(1,1,1), 0, 0, 0, "t h i c c");

Website. It was
This isn't a game!

Member #15,725
September 2014

Thanks dthompson, i'm using doing a transform in scale and position. And after drawing setting identity transform.

Thanks for the tip! :o

Go to: