aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfont.c
diff options
context:
space:
mode:
authorKenichi Handa2008-05-27 01:45:00 +0000
committerKenichi Handa2008-05-27 01:45:00 +0000
commit4f64a16487a6698413b526236d892c1a3f2da552 (patch)
tree6475dd20cd599bdc72ecd7d0bea3599f9669d13e /src/xfont.c
parent35611703323d2eb4db7db059c1899b5e1ea83576 (diff)
downloademacs-4f64a16487a6698413b526236d892c1a3f2da552.tar.gz
emacs-4f64a16487a6698413b526236d892c1a3f2da552.zip
(xfont_open): Fix calculation of font->average_width.
Diffstat (limited to 'src/xfont.c')
-rw-r--r--src/xfont.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/xfont.c b/src/xfont.c
index f84312413ca..e6f0bde5114 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -613,8 +613,14 @@ xfont_open (f, entity, pixel_size)
613 for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) 613 for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
614 if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL) 614 if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
615 width += pcm->width, n++; 615 width += pcm->width, n++;
616 font->average_width = width / n; 616 if (n > 0)
617 font->average_width = width / n;
617 } 618 }
619 if (font->average_width == 0)
620 /* No easy way other than this to get a reasonable
621 average_width. */
622 font->average_width
623 = (xfont->min_bounds.width + xfont->max_bounds.width) / 2;
618 } 624 }
619 625
620 BLOCK_INPUT; 626 BLOCK_INPUT;