/* xftfont.c -- XFT font driver.
- Copyright (C) 2006-2015 Free Software Foundation, Inc.
+ Copyright (C) 2006-2016 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <X11/Xft/Xft.h>
#include "lisp.h"
-#include "dispextern.h"
#include "xterm.h"
#include "frame.h"
#include "blockinput.h"
-#include "character.h"
#include "charset.h"
#include "composite.h"
-#include "fontset.h"
#include "font.h"
#include "ftfont.h"
colors[0].pixel = fg->pixel = xgcv.foreground;
if (bg)
colors[1].pixel = bg->pixel = xgcv.background;
- XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors,
- bg ? 2 : 1);
+ x_query_colors (f, colors, bg ? 2 : 1);
fg->color.alpha = 0xFFFF;
fg->color.red = colors[0].red;
fg->color.green = colors[0].green;
font->ascent = xftfont->ascent;
font->descent = xftfont->descent;
- if (pixel_size >= 5)
+ /* 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
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;