At Thu, 26 Apr 2001 23:24:43 +0900,
Tomohiro KUBOTA wrote:
> 
> Interesting.  Do you think it is possible to determine font0_idx
> automatically by sorting the value of PIXEL_SIZE * AVERAGE_WIDTH ?

On one hand, that might be possible (although not completely trivial
to do correctly), on the other hand, what I was trying to suggest was
an order of magnitude simpler.

Let me try to reformulate more precisely:

- the font order is fixed, for instance, whatever the encoding:
  (m)font1 < (m)font2 < (m)font3 < (m)font < (m)font4 < (m)font5 
   < (m)font6 < (m)font7. In other words, font0_idx is a constant, 
  and the default font is approximately in the middle of the font
  list.
- the font order has nothing to do with actual font SIZE. It only
  reflects the font cycling order (where the current font is changed 
  by using Shift-KP_Add and Shift-KP_Substract). 
- when changing fonts, if the next font is not defined or cannot
  be loaded, it should be skipped, and the next one in the cycling
  order should be considered, unless the extremity of the font list has
  been reached. 
    For instance, suppose that the current font is font4, and the
    value of font6 is a loadable font, but not font5 nor font7. The
    first time Shift-KP_Add is pressed, the font should be changed to
    font6 (since font5 is not defined, or cannot be loaded), the next 
    time it should stay to font6 (since font7 cannot be loaded, 
    and there is no further font to consider).
- obviously, the default font should always be correctly defined (failure
  to load it could be treated as a special case)

Basically, this is exactly the font cycling behaviour of versions up
to 2.7.5, with the addition that fonts that cannot be loaded should be
skipped when changing fonts. No font `size' related computation is 
involved. 

About the patch you submitted in your other message: the algorithm you
use to determine the index of the default font will only yield a
meaningful result when other font resource values (font1, font2,
etc...) are already ordered in increasing font size order. Which seems
to me like a rather strong assumption to begin with.
For more correctness, you would actually want to sort all specified
fonts. But this would become even "heavier" (quoting the end of your
other message). My opinion is that the improvement (font cycling order
and font size order are always identical) is not worth the extra 
complexity. 

/***************************
   Maxime Froment
   [EMAIL PROTECTED]
 ***************************/

Reply via email to