Re: GtkSpinButton Patch



Thus spake Donald Ryan Willhoit:
> On Tue, 2 May 2000, Nils Barth wrote:
> > Wouldn't it simply be best to take the maximum width of all numerical
> > characters in the font, in case of weird fonts?
> > It's not that hard, is it?
> 
> No... it shouldn't be.  In addition to i18n issues (as you mentioned),
> there is another problem, see below. 
> 
> > That is, set the width of the box to be:
> > max_number_of_digits*max(width(0..9))
> > + (if applicable) width(decimal delimiter) + (if applicable) width("-")
> > 
> >   does it allow instead a (2) for -2, or a red 2 or whatever (though
> >   these are ugly).
> > 
> > Are there any further i18n questions? Do we only want to render Roman
> > numerals?
> 
> There's actually another issue here.  When we get to things like GtkEntry
> we can't possibly check every single possible renderable character - it
> feels like there should be a GDK function that gets the maximum
> advance for the font...  Of course if everything gets switched to Pango I
> don't know how that effects thing's yet...
> 
> (gdk_font_get_max_advance()??)

Good point; I wasn't thinking ahead.
Okay, so something like:
max_number_of_digits*gdk_font_get_max_advance()
or such, where max_num_digits also counts a - and a decimal.

> > Side note: kernel-traffic's latest issue had a note on a possible
> > problem with a simple MAX a la GLib,
> 
> On the other hand I can just write code that doesn't have functions inside
> macros - always a safer thing :)
> 
> So I'll send a big patch in a couple days for the other stuff.  I'll be
> careful only to use variables in MAX and concerning character widths: I'll
> write something similar to what I did rather than putting loops in
> everywhere, b/c I really feel that the code for finding the max width
> belongs elsewhere.

Agreed; I was thinking that digits were a bit special, but regardless,
font metric code doesn't belong here.
Actually, what's the case in Asian languages, where most characters
are really big, but digits are Roman? Might we end up with double-wide 
spin-buttons, large enough to accomodate idiograms?
Would we need a gdk_font_get_max_DIGIT_advance or such, or would it
behave properly?

-- 
  -nils
Public key: http://www.fas.harvard.edu/~nbarth/pub-key.txt



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