* xfont.c (xfont_open): Avoid unnecessary tests.
This commit is contained in:
parent
bc7b669731
commit
625a3eb1e2
2 changed files with 17 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
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.
|
||||
|
||||
|
|
29
src/xfont.c
29
src/xfont.c
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue