summaryrefslogtreecommitdiff
path: root/src/xftfont.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-08-16 14:35:13 +0800
committerChong Yidong <cyd@gnu.org>2012-08-16 14:35:13 +0800
commit032a42c88d421ee434e783e29bf2cde3d6a81e7b (patch)
tree24fa7910668c8e4c92da4cd50d753a9a0358c64d /src/xftfont.c
parent1c308380b6f29e389dc10d418b9203a74d64dce2 (diff)
downloademacs-032a42c88d421ee434e783e29bf2cde3d6a81e7b.tar.gz
For Xft and X font backends, set omitted max_width font fields.
* src/xfont.c (xfont_open): * src/xftfont.c (xftfont_open): Set the font's max_width field. * src/font.h (struct font): Update comments.
Diffstat (limited to 'src/xftfont.c')
-rw-r--r--src/xftfont.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/xftfont.c b/src/xftfont.c
index 2f8125393bc..34c6a8fa0b4 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -414,20 +414,25 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
ascii_printable[ch] = ' ' + ch;
}
BLOCK_INPUT;
+
+ /* Unfortunately Xft doesn't provide a way to get minimum char
+ width. So, we set min_width to space_width. */
+
if (spacing != FC_PROPORTIONAL
#ifdef FC_DUAL
&& spacing != FC_DUAL
#endif /* FC_DUAL */
)
{
- font->min_width = font->average_width = font->space_width
- = xftfont->max_advance_width;
+ font->min_width = font->max_width = font->average_width
+ = font->space_width = xftfont->max_advance_width;
XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents);
}
else
{
XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents);
- font->space_width = extents.xOff;
+ font->min_width = font->max_width = font->space_width
+ = extents.xOff;
if (font->space_width <= 0)
/* dirty workaround */
font->space_width = pixel_size;
@@ -470,10 +475,6 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
#endif /* HAVE_LIBOTF */
xftfont_info->ft_size = ft_face->size;
- /* Unfortunately Xft doesn't provide a way to get minimum char
- width. So, we use space_width instead. */
- font->min_width = font->space_width;
-
font->baseline_offset = 0;
font->relative_compose = 0;
font->default_ascent = 0;
@@ -764,6 +765,8 @@ syms_of_xftfont (void)
DEFSYM (QCembolden, ":embolden");
DEFSYM (QClcdfilter, ":lcdfilter");
+ ascii_printable[0] = 0;
+
xftfont_driver = ftfont_driver;
xftfont_driver.type = Qxft;
xftfont_driver.get_cache = xfont_driver.get_cache;