Re: PangoFontMetrics: approximate_[char|digit]_width



Sven Neumann <sven gimp org> writes: 
> Well, in that case I'd expect approximate_char_width to be 
> max_char_width actually to assure that whatever string the user
> enters, the entry is set up wide enough to show it completely.
> If I understand the code in pangox.c correctly, you are 
> calculating some sort of average char width. Is this correct?

The problem is that the max char width can be really huge.  The
majority of the time it would be far too big (given how pangox.c works
- max may be correct for other backends).

If the entry isn't quite wide enough, entries do scroll, its not
disaster. So this approximate width is intended to just take a good
average guess.

> > approximate_digit_width is doing the same but for the decimal digits
> > only, so it amounts to width ("0123456789") / 10.
> 
> Especially in this case (most prominently GtkSpinButtons) I'd 
> say that using a max value would make much more sense than 
> using an average.
> 

You're probably right here, since the max of those 10 digits won't
ever be huge, as the max of the characters may be.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]