aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2016-05-22 19:20:28 +0300
committerEli Zaretskii2016-05-22 19:20:28 +0300
commit5ab083034ca221a7b4f00156a0efece84da999d8 (patch)
tree28c9128c12ce1fbc3df7576044fe2ea38b65fb9f /src
parentc9f7ec736b78bef5359b6da03296277c535e8e89 (diff)
downloademacs-5ab083034ca221a7b4f00156a0efece84da999d8.tar.gz
emacs-5ab083034ca221a7b4f00156a0efece84da999d8.zip
Provide workaround for xftfont rendering problem
* src/xftfont.c (syms_of_xftfont) <xft-font-ascent-descent-override>: New variable. (xftfont_open): Use it to work around problems with rendering some fonts. (Bug#23360)
Diffstat (limited to 'src')
-rw-r--r--src/xftfont.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/xftfont.c b/src/xftfont.c
index 7926325419c..34c6f7d3e42 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -395,6 +395,24 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
395 395
396 font->ascent = xftfont->ascent; 396 font->ascent = xftfont->ascent;
397 font->descent = xftfont->descent; 397 font->descent = xftfont->descent;
398 /* The following workaround is unnecessary on most systems, and
399 causes annoying differences in glyph height between regular and
400 bold fonts (see bug#22383). However, with some fonts, such as
401 monaco, removing the workaround results in overlapping vertical
402 space of a line, see bug#23360. As long as the way to reconcile
403 these opposites is not known, we provide a user option to work
404 around the problem. */
405 if (pixel_size >= 5
406 && xft_font_ascent_descent_override)
407 {
408 /* The above condition is a dirty workaround because
409 XftTextExtents8 behaves strangely for some fonts
410 (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. */
411 if (font->ascent < extents.y)
412 font->ascent = extents.y;
413 if (font->descent < extents.height - extents.y)
414 font->descent = extents.height - extents.y;
415 }
398 font->height = font->ascent + font->descent; 416 font->height = font->ascent + font->descent;
399 417
400 if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0) 418 if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0)
@@ -733,6 +751,12 @@ syms_of_xftfont (void)
733 DEFSYM (QCembolden, ":embolden"); 751 DEFSYM (QCembolden, ":embolden");
734 DEFSYM (QClcdfilter, ":lcdfilter"); 752 DEFSYM (QClcdfilter, ":lcdfilter");
735 753
754 DEFVAR_BOOL ("xft-font-ascent-descent-override",
755 xft_font_ascent_descent_override,
756 doc: /* Non-nil means override the ascent and descent values for Xft font driver.
757This is needed with some fonts to correct vertical overlap of glyphs. */);
758 xft_font_ascent_descent_override = 0;
759
736 ascii_printable[0] = 0; 760 ascii_printable[0] = 0;
737 761
738 xftfont_driver = ftfont_driver; 762 xftfont_driver = ftfont_driver;