[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 5ab0830: Provide workaround for xftfont rendering
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] emacs-25 5ab0830: Provide workaround for xftfont rendering problem |
Date: |
Sun, 22 May 2016 16:20:55 +0000 (UTC) |
branch: emacs-25
commit 5ab083034ca221a7b4f00156a0efece84da999d8
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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)
---
src/xftfont.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/xftfont.c b/src/xftfont.c
index 7926325..34c6f7d 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -395,6 +395,24 @@ xftfont_open (struct frame *f, Lisp_Object entity, int
pixel_size)
font->ascent = xftfont->ascent;
font->descent = xftfont->descent;
+ /* The following workaround is unnecessary on most systems, and
+ causes annoying differences in glyph height between regular and
+ bold fonts (see bug#22383). However, with some fonts, such as
+ monaco, removing the workaround results in overlapping vertical
+ space of a line, see bug#23360. As long as the way to reconcile
+ these opposites is not known, we provide a user option to work
+ around the problem. */
+ if (pixel_size >= 5
+ && xft_font_ascent_descent_override)
+ {
+ /* The above condition is a dirty workaround because
+ XftTextExtents8 behaves strangely for some fonts
+ (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. */
+ if (font->ascent < extents.y)
+ font->ascent = extents.y;
+ if (font->descent < extents.height - extents.y)
+ font->descent = extents.height - extents.y;
+ }
font->height = font->ascent + font->descent;
if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0)
@@ -733,6 +751,12 @@ syms_of_xftfont (void)
DEFSYM (QCembolden, ":embolden");
DEFSYM (QClcdfilter, ":lcdfilter");
+ DEFVAR_BOOL ("xft-font-ascent-descent-override",
+ xft_font_ascent_descent_override,
+ doc: /* Non-nil means override the ascent and descent values
for Xft font driver.
+This is needed with some fonts to correct vertical overlap of glyphs. */);
+ xft_font_ascent_descent_override = 0;
+
ascii_printable[0] = 0;
xftfont_driver = ftfont_driver;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 5ab0830: Provide workaround for xftfont rendering problem,
Eli Zaretskii <=