Commit 625a3eb1 authored by Paul Eggert's avatar Paul Eggert
Browse files

* xfont.c (xfont_open): Avoid unnecessary tests.

parent bc7b6697
2011-04-05 Paul Eggert <eggert@cs.ucla.edu>
* xfont.c (xfont_text_extents): Remove var that was set but not used.
(xfont_open): Avoid unnecessary tests.
* composite.c (composition_gstring_put_cache): Use unsigned integer.
......@@ -844,22 +844,25 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
font->average_width = XINT (val) / 10;
if (font->average_width < 0)
font->average_width = - font->average_width;
if (font->average_width == 0
&& encoding->ascii_compatible_p)
else
{
int width = font->space_width, n = pcm != NULL;
if (font->average_width == 0
&& encoding->ascii_compatible_p)
{
int width = font->space_width, n = pcm != NULL;
for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
width += pcm->width, n++;
if (n > 0)
font->average_width = width / n;
for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
width += pcm->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;
}
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment