It is usually called font metrics.
It depends on what toolkit you are using, but yes you usually can find what is called the "bounding box" or bbox of the text. The thing to watch out for is the fact that labels tend to be text oriented, so that height is actually the number of text lines, like 1, 2 , or 3; wheras width is the actual pixel width of the entire string. So you might get a height as 1, but width as 240.
You can look at Gtk2::Label for the complexity. It can be done, but usually you design for size flexibility, where label wrap length varies depending on the size of the main window. Also see Tk font metrics
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.