Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Textfield with variable size

Credits go to Edgar Reynaldo, jmasterx, and Peter Hull for helping out!
This thread is locked; no one can reply to it. rss feed Print
Textfield with variable size
nico_c++
Member #16,940
January 2019

I have a problem. I am designing my own menu classes and so on.
I have now a string in a textfield. And i want to draw this text in a filled rectangle. How do I get the size of the rectangle exactly around the text.
For example is the "M" bigger than the "I", so there isnt a perfect formula.
Is it possible to recognize colors in the display, to recognize the text, or maybe to display the text shaped to the height and width of the rectangle? Of course I would prefer the first method, because then I could use my own fontsize, like I want it.
Pleeease help me :((
Greetings from Germany

Peter Hull
Member #1,136
March 2001

Does al_get_text_width do what you want?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

jmasterx
Member #11,410
October 2009

nico_c++
Member #16,940
January 2019

Yeaah thank you so much!!

Go to: