preahkumpii has asked for the wisdom of the Perl Monks concerning the following question:
I am working with manipulating text files in Perl, not with Web. I need to be able to take a given string of text, and given a font name and size (ideal other options as well), to output the length of the string in pixels (or whatever unit) as it would appear in the font. I have looked the Tk module and on the web extensively. I cannot find a clear description of its use at all. Here is my sample code:
Thanks for the help. Adam#!/usr/bin/perl use warnings; use strict; use Tk; my $happy = "This is my example sentence"; # I want the measurement of the above string in pixels given a font fa +ce and font size
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: font measurement
by BrowserUk (Patriarch) on Jan 30, 2012 at 16:53 UTC | |
by preahkumpii (Novice) on Jan 31, 2012 at 03:12 UTC | |
by BrowserUk (Patriarch) on Jan 31, 2012 at 05:46 UTC | |
by preahkumpii (Novice) on Jan 31, 2012 at 14:25 UTC | |
by BrowserUk (Patriarch) on Jan 31, 2012 at 17:05 UTC | |
Re: font measurement
by zentara (Archbishop) on Jan 30, 2012 at 15:30 UTC | |
by preahkumpii (Novice) on Jan 30, 2012 at 15:47 UTC | |
by zentara (Archbishop) on Jan 30, 2012 at 17:58 UTC | |
Re: font measurement
by fisher (Priest) on Jan 30, 2012 at 12:23 UTC | |
by preahkumpii (Novice) on Jan 30, 2012 at 12:50 UTC | |
by afoken (Chancellor) on Jan 30, 2012 at 13:31 UTC | |
by fisher (Priest) on Jan 30, 2012 at 13:39 UTC |
Back to
Seekers of Perl Wisdom