Here is the answer to my question from Juliusz Chroboczek:

ANK> I recently discovered that using your font server and/or
ANK> xfsft-based TrueType rasteriser with Lesstif causes Lesstif to
ANK> dump core. As it has turned aout, the problem is caused by the
ANK> fact, that TrueType fonts have min_bounds.width =
ANK> -max_bounds.width in XFontStruct.

This is correct.

ANK> Lesstif calculates average character width in font using formula
ANK> (min_width+max_width)/2 which obviously produces 0 in result.

This is not.

ANK> Is it legal to have characters with negative width in
ANK> left-to-right fonts?

Yes, unfortunately.  I believe that this is an error in the X11
specifications, and most clients do not know how to deal with
negative-width glyphs (this is the case at least of Emacs/Mule and the
``Arabox'' Arabic version of Motif).  I am thinking of making all
advance widths positive in a future version of XFree86.

ANK> If that is legal, what is the better way to calculate avarage
ANK> character width for font?

The safe way is to use the average width font property if present (but
even this might be zero for mixed-direction fonts), and to use the
width of `x' if not available; if the font contains no `x', use half
the maximum width.  Please read the XLFD document, which you should
find in the directory `xc/doc/hardcopy' of your X11 distribution (make
sure you have the X11R6 version).

Note, however, that there is no good language-independent way of
determining the average width.  Any method you use is an
approximation, and therefore the use of average widths should be
avoided whenever possible.

Sincerely,

                                        J.

Reply via email to