+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
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;