Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Get font info OUT of a widget

by mpersico (Scribe)
on Mar 22, 2013 at 04:06 UTC ( #1024865=perlquestion: print w/replies, xml ) Need Help??
mpersico has asked for the wisdom of the Perl Monks concerning the following question:

Plenty of examples out there showing how to create a font and set a widget to use it, but how do I GEt the font information OUT of an existing widget? I want to know its size (height), so that given how many lines I have, I can intelligently resize the height.


Replies are listed 'Best First'.
Re: Get font info OUT of a widget
by kcott (Chancellor) on Mar 22, 2013 at 05:36 UTC

    G'day mpersico,

    Whenever you post a question here that's asking for information related to a module, please ensure you specify which module you are referring to. Vague references to fonts and widgets (as you have here) give no hint as to which of the many Perl GUI modules you're using. Providing a link to the module is even better — see What shortcuts can I use for linking?.

    I noted a few of your past nodes asked about Tk. Assuming that's what you're still using, the information you want can be found in the Tk Font documentation. This lists a number of methods which seem to do what you want, e.g. fontMetrics(), fontMeasure(), etc.

    -- Ken

      Eeek. That was bad form. I know better than that...
Re: Get font info OUT of a widget (ask, configure)
by Anonymous Monk on Mar 22, 2013 at 04:46 UTC

    ask the widget for the information, use configure

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1024865]
Approved by kcott
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-02-22 13:23 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (293 votes). Check out past polls.