summaryrefslogtreecommitdiff
path: root/src/xfont.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xfont.c')
-rw-r--r--src/xfont.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/xfont.c b/src/xfont.c
index 8a3cacdd9f5..eaa1a3ea59b 100644
--- a/src/xfont.c
+++ b/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;