|
Can I Draw Scaled Text? |
chanochambure
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"??? |
dthompson
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 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: ALLEGRO_TRANSFORM tr; al_identity_transform(&tr); al_scale_transform(&tr, 2, 2); al_use_transform(&tr); al_draw_text(font, al_map_rgb_f(1,1,1), 0, 0, 0, "t h i c c");
______________________________________________________ |
chanochambure
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! |
|