1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-06 14:02:07 -08:00

(xfont_open): Fix calculation of font->average_width.

This commit is contained in:
Kenichi Handa 2008-05-27 01:45:00 +00:00
parent 3561170332
commit 4f64a16487
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2008-05-27 Kenichi Handa <handa@m17n.org>
* xfont.c (xfont_open): Fix calculation of font->average_width.
2008-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
* casefiddle.c (casify_object): Try to guess better whether the

View file

@ -613,8 +613,14 @@ xfont_open (f, entity, pixel_size)
for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
width += pcm->width, n++;
font->average_width = width / n;
if (n > 0)
font->average_width = width / n;
}
if (font->average_width == 0)
/* No easy way other than this to get a reasonable
average_width. */
font->average_width
= (xfont->min_bounds.width + xfont->max_bounds.width) / 2;
}
BLOCK_INPUT;