>> ($x, $y) = $Label->GetTextExtentPoint32($string); > > Upon further experimentation, there is something not quite right with > that. The width it returns is too wide. There seems to be some sort > of per-character skew -- short strings are very accurate; longer > strings get progressively worse.
<snip> > Why do the longer fields have a large error in the computed width? My guess is that it has to do with kerning. Try it with a monospace font (or other non-kerning font) and see you still have the problem. If you don't, there's nothing we can do about it, because the problem is in Microsoft code, not Win32::GUI code. If you're not familiar with kerning, look here: http://en.wikipedia.org/wiki/Kerning From MSDN: The GetTextExtentPoint32 function uses the currently selected font to compute the dimensions of the string. The width and height, in logical units, are computed without considering any clipping. Because some devices kern characters, the sum of the extents of the characters in a string may not be equal to the extent of the string. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/