Search code examples
delphifiremonkeydelphi-xe6

How to adjust Font Size according text viewable in a TButton.Text using Firemonkey?


I am using buttons to display product names in a matrix using TGridLayout.

The problem is that commonly Items contains 3 or 4 words and in my language (Portuguese) some words tend to be long.

I would like that somehow I could calculate the size of the font, decreasing it, in order to make all the text show up automatically (of course there is also a decrease limit, anything below 9 or 8 point for the font turn to be difficult to read).

The wordwrap property is turned on to have many lines, and use the most possible space for the text.


Solution

  • I don't know if you're programming for an Android/iOS app, but you can't change the fontsize of a button. I've had the same problem, my solution was to make an abbreviation of the words. And then i put labels above it to explain the abbreviations.