aboutsummaryrefslogtreecommitdiffstats
path: root/src/xftfont.c
diff options
context:
space:
mode:
authorChong Yidong2012-08-16 14:35:13 +0800
committerChong Yidong2012-08-16 14:35:13 +0800
commit032a42c88d421ee434e783e29bf2cde3d6a81e7b (patch)
tree24fa7910668c8e4c92da4cd50d753a9a0358c64d /src/xftfont.c
parent1c308380b6f29e389dc10d418b9203a74d64dce2 (diff)
downloademacs-032a42c88d421ee434e783e29bf2cde3d6a81e7b.tar.gz
emacs-032a42c88d421ee434e783e29bf2cde3d6a81e7b.zip
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)
414 ascii_printable[ch] = ' ' + ch; 414 ascii_printable[ch] = ' ' + ch;
415 } 415 }
416 BLOCK_INPUT; 416 BLOCK_INPUT;
417
418 /* Unfortunately Xft doesn't provide a way to get minimum char
419 width. So, we set min_width to space_width. */
420
417 if (spacing != FC_PROPORTIONAL 421 if (spacing != FC_PROPORTIONAL
418#ifdef FC_DUAL 422#ifdef FC_DUAL
419 && spacing != FC_DUAL 423 && spacing != FC_DUAL
420#endif /* FC_DUAL */ 424#endif /* FC_DUAL */
421 ) 425 )
422 { 426 {
423 font->min_width = font->average_width = font->space_width 427 font->min_width = font->max_width = font->average_width
424 = xftfont->max_advance_width; 428 = font->space_width = xftfont->max_advance_width;
425 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); 429 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents);
426 } 430 }
427 else 431 else
428 { 432 {
429 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents); 433 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents);
430 font->space_width = extents.xOff; 434 font->min_width = font->max_width = font->space_width
435 = extents.xOff;
431 if (font->space_width <= 0) 436 if (font->space_width <= 0)
432 /* dirty workaround */ 437 /* dirty workaround */
433 font->space_width = pixel_size; 438 font->space_width = pixel_size;
@@ -470,10 +475,6 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
470#endif /* HAVE_LIBOTF */ 475#endif /* HAVE_LIBOTF */
471 xftfont_info->ft_size = ft_face->size; 476 xftfont_info->ft_size = ft_face->size;
472 477
473 /* Unfortunately Xft doesn't provide a way to get minimum char
474 width. So, we use space_width instead. */
475 font->min_width = font->space_width;
476
477 font->baseline_offset = 0; 478 font->baseline_offset = 0;
478 font->relative_compose = 0; 479 font->relative_compose = 0;
479 font->default_ascent = 0; 480 font->default_ascent = 0;
@@ -764,6 +765,8 @@ syms_of_xftfont (void)
764 DEFSYM (QCembolden, ":embolden"); 765 DEFSYM (QCembolden, ":embolden");
765 DEFSYM (QClcdfilter, ":lcdfilter"); 766 DEFSYM (QClcdfilter, ":lcdfilter");
766 767
768 ascii_printable[0] = 0;
769
767 xftfont_driver = ftfont_driver; 770 xftfont_driver = ftfont_driver;
768 xftfont_driver.type = Qxft; 771 xftfont_driver.type = Qxft;
769 xftfont_driver.get_cache = xfont_driver.get_cache; 772 xftfont_driver.get_cache = xfont_driver.get_cache;