Hi,
I had written Alexander Mai:
:: The problem only occurs for fonts where the 'default_char' attribute is
:: bogus. In our app we're using
::
:: "-*-helvetica-*-r-*-*-12-*-*-*-*-*-*-*"
::
:: for most panels, but
::
:: "-adobe-*-bold-r-normal-*-12-*-*-*-m-*"
::
:: for the text widgets that display files. It's only for the adobe font
:: that 'default_char' is dangerously bogus (it's 21904). For the helvetica
:: font, 'default_char' is 32 and for
::
:: "-b&h-lucidatypewriter-bold-r-normal-sans-12-120-*"
::
:: 'default_char' is 0; this latter case is handled adequately by the
:: existing hack in _XmTextNextX. This is all on a RedHat 6.2 box with a
:: standard XFree86 3.3.6 installation.
After going over the lesstif code some more yesterday, it looks like the
proper place to address this problem is in the FontInit routine in
Xm/TextOut.c, rather than in _XmTextNextX. At line 278, there's code
in there to calculate the average character width for the newly selected
font. Before that, I'd insert code to test that the font's default_char
is reasonable and set it to something reasonable if it isn't. Maybe
[...]
OutFont(o) = fs;
if( fs->default_char < fs->min_char_or_byte2 ||
fs->default_char > fs->max_char_or_byte2 )
{
if( 32 >= fs->min_char_or_byte2 )
fs->default_char = 32
else
fs->default_char = fs->min_char_or_byte2;
}
Out_FontAverageWidth(o) =
[...]
Currently this default_char is only used in _XmTextNextX, but it still
seems like this is a safer fix in the long run, in case it does end up
getting used somewhere else.
TomP
-------------------------------------------------------------------------
Tom Pollard [EMAIL PROTECTED]
Schrodinger, Inc. 201-433-2014 x102
-------------------------------------------------------------------------