diff options
| author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2019-04-24 12:31:37 +0900 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2019-04-24 12:31:37 +0900 |
| commit | 5f4e8e2e088de9fb76cb631077c6eddd3219f594 (patch) | |
| tree | abb80bc8ec36c28d4eef08b92db90a142f641be6 /src | |
| parent | 1828e9a9b7481572448284a8e5925bf97f2145f7 (diff) | |
| download | emacs-5f4e8e2e088de9fb76cb631077c6eddd3219f594.tar.gz | |
Don't link libXft when using cairo
* configure.ac: Check cairo early. Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.
Diffstat (limited to 'src')
| -rw-r--r-- | src/menu.c | 2 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xrdb.c | 4 | ||||
| -rw-r--r-- | src/xsettings.c | 58 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
5 files changed, 38 insertions, 30 deletions
diff --git a/src/menu.c b/src/menu.c index 7f46e68e73e..e82c8570595 100644 --- a/src/menu.c +++ b/src/menu.c @@ -687,7 +687,7 @@ digest_single_submenu (int start, int end, bool top_level_items) ASET (menu_items, i + MENU_ITEMS_PANE_NAME, pane_name); } -#elif defined (USE_LUCID) && defined (HAVE_XFT) +#elif defined (USE_LUCID) && (defined USE_CAIRO || defined HAVE_XFT) if (STRINGP (pane_name)) { pane_name = ENCODE_UTF_8 (pane_name); diff --git a/src/xfns.c b/src/xfns.c index dbc5e10c415..9075491e978 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3487,7 +3487,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) { const char *names[] = { -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT /* This will find the normal Xft font. */ "monospace-10", #endif diff --git a/src/xrdb.c b/src/xrdb.c index 35de446cb7a..0950b706699 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -383,7 +383,7 @@ x_load_resources (Display *display, const char *xrm_string, XrmDatabase db; char line[256]; -#if defined USE_MOTIF || !defined HAVE_XFT || !defined USE_LUCID +#if defined USE_MOTIF || !(defined USE_CAIRO || defined HAVE_XFT) || !defined USE_LUCID const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"; #endif @@ -456,7 +456,7 @@ x_load_resources (Display *display, const char *xrm_string, sprintf (line, "Emacs.dialog*.background: grey75"); XrmPutLineResource (&rdb, line); -#if !defined (HAVE_XFT) || !defined (USE_LUCID) +#if !(defined USE_CAIRO || defined HAVE_XFT) || !defined (USE_LUCID) sprintf (line, "Emacs.dialog*.font: %s", helv); XrmPutLineResource (&rdb, line); sprintf (line, "*XlwMenu*font: %s", helv); diff --git a/src/xsettings.c b/src/xsettings.c index 947d5cfb7b6..3e9012e3ab1 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -45,9 +45,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <gconf/gconf-client.h> #endif -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT +#ifdef USE_CAIRO +#include <fontconfig/fontconfig.h> +#else /* HAVE_XFT */ #include <X11/Xft/Xft.h> #endif +#endif static char *current_mono_font; static char *current_font; @@ -83,7 +87,7 @@ dpyinfo_valid (struct x_display_info *dpyinfo) /* Store a monospace font change event if the monospaced font changed. */ -#if defined HAVE_XFT && (defined HAVE_GSETTINGS || defined HAVE_GCONF) +#if (defined USE_CAIRO || defined HAVE_XFT) && (defined HAVE_GSETTINGS || defined HAVE_GCONF) static void store_monospaced_changed (const char *newfont) { @@ -102,7 +106,7 @@ store_monospaced_changed (const char *newfont) /* Store a font name change event if the font name changed. */ -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT static void store_font_name_changed (const char *newfont) { @@ -117,7 +121,7 @@ store_font_name_changed (const char *newfont) XCAR (first_dpyinfo->name_list_element)); } } -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ /* Map TOOL_BAR_STYLE from a string to its corresponding Lisp value. Return Qnil if TOOL_BAR_STYLE is not known. */ @@ -157,7 +161,7 @@ store_tool_bar_style_changed (const char *newstyle, XCAR (dpyinfo->name_list_element)); } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT #define XSETTINGS_FONT_NAME "Gtk/FontName" #endif #define XSETTINGS_TOOL_BAR_STYLE "Gtk/ToolbarStyle" @@ -174,7 +178,7 @@ enum { }; struct xsettings { -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT FcBool aa, hinting; int rgba, lcdfilter, hintstyle; double dpi; @@ -191,7 +195,7 @@ struct xsettings #define GSETTINGS_SCHEMA "org.gnome.desktop.interface" #define GSETTINGS_TOOL_BAR_STYLE "toolbar-style" -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT #define GSETTINGS_MONO_FONT "monospace-font-name" #define GSETTINGS_FONT_NAME "font-name" #endif @@ -224,7 +228,7 @@ something_changed_gsettingsCB (GSettings *settings, g_variant_unref (val); } } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT else if (strcmp (key, GSETTINGS_MONO_FONT) == 0) { val = g_settings_get_value (settings, GSETTINGS_MONO_FONT); @@ -253,14 +257,14 @@ something_changed_gsettingsCB (GSettings *settings, g_variant_unref (val); } } -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ } #endif /* HAVE_GSETTINGS */ #ifdef HAVE_GCONF #define GCONF_TOOL_BAR_STYLE "/desktop/gnome/interface/toolbar_style" -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT #define GCONF_MONO_FONT "/desktop/gnome/interface/monospace_font_name" #define GCONF_FONT_NAME "/desktop/gnome/interface/font_name" #endif @@ -286,7 +290,7 @@ something_changed_gconfCB (GConfClient *client, const char *value = gconf_value_get_string (v); store_tool_bar_style_changed (value, first_dpyinfo); } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT else if (strcmp (key, GCONF_MONO_FONT) == 0) { const char *value = gconf_value_get_string (v); @@ -297,12 +301,12 @@ something_changed_gconfCB (GConfClient *client, const char *value = gconf_value_get_string (v); store_font_name_changed (value); } -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ } #endif /* HAVE_GCONF */ -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT /* Older fontconfig versions don't have FC_LCD_*. */ #ifndef FC_LCD_NONE @@ -315,7 +319,7 @@ something_changed_gconfCB (GConfClient *client, #define FC_LCD_FILTER "lcdfilter" #endif -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ /* Find the window that contains the XSETTINGS property values. */ @@ -440,7 +444,7 @@ parse_settings (unsigned char *prop, if (bytes_parsed > bytes) return settings_seen; want_this = strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0; -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT if ((nlen > 6 && memcmp (name, "Xft/", 4) == 0) || strcmp (XSETTINGS_FONT_NAME, name) == 0) want_this = true; @@ -490,7 +494,7 @@ parse_settings (unsigned char *prop, dupstring (&settings->tb_style, sval); settings->seen |= SEEN_TB_STYLE; } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT else if (strcmp (name, XSETTINGS_FONT_NAME) == 0) { dupstring (&settings->font, sval); @@ -553,7 +557,7 @@ parse_settings (unsigned char *prop, else settings->seen &= ~SEEN_LCDFILTER; } -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ else want_this = false; settings_seen += want_this; @@ -604,16 +608,18 @@ static void apply_xft_settings (struct x_display_info *dpyinfo, struct xsettings *settings) { -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT FcPattern *pat; struct xsettings oldsettings; bool changed = false; memset (&oldsettings, 0, sizeof (oldsettings)); pat = FcPatternCreate (); +#ifdef HAVE_XFT XftDefaultSubstitute (dpyinfo->display, XScreenNumberOfScreen (dpyinfo->screen), pat); +#endif FcPatternGetBool (pat, FC_ANTIALIAS, 0, &oldsettings.aa); FcPatternGetBool (pat, FC_HINTING, 0, &oldsettings.hinting); #ifdef FC_HINT_STYLE @@ -713,7 +719,9 @@ apply_xft_settings (struct x_display_info *dpyinfo, }; char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; +#ifdef HAVE_XFT XftDefaultSet (dpyinfo->display, pat); +#endif store_config_changed_event (Qfont_render, XCAR (dpyinfo->name_list_element)); Vxft_settings @@ -725,7 +733,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, } else FcPatternDestroy (pat); -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ } /* Read XSettings from the display for DPYINFO. @@ -748,7 +756,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p) current_tool_bar_style = map_tool_bar_style (settings.tb_style); xfree (settings.tb_style); } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT if (settings.seen & SEEN_FONT) { if (send_event_p) @@ -850,7 +858,7 @@ init_gsettings (void) g_variant_unref (val); } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT val = g_settings_get_value (gsettings_client, GSETTINGS_MONO_FONT); if (val) { @@ -868,7 +876,7 @@ init_gsettings (void) dupstring (¤t_font, g_variant_get_string (val, NULL)); g_variant_unref (val); } -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ #endif /* HAVE_GSETTINGS */ } @@ -903,7 +911,7 @@ init_gconf (void) g_free (s); } -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT s = gconf_client_get_string (gconf_client, GCONF_MONO_FONT, NULL); if (s) { @@ -932,7 +940,7 @@ init_gconf (void) GCONF_FONT_NAME, something_changed_gconfCB, NULL, NULL, NULL); -#endif /* HAVE_XFT */ +#endif /* USE_CAIRO || HAVE_XFT */ #endif /* HAVE_GCONF */ } @@ -1055,7 +1063,7 @@ If this variable is nil, Emacs ignores system font changes. */); doc: /* Font settings applied to Xft. */); Vxft_settings = empty_unibyte_string; -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT Fprovide (intern_c_string ("font-render-setting"), Qnil); #if defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) Fprovide (intern_c_string ("system-font-setting"), Qnil); diff --git a/src/xterm.c b/src/xterm.c index 0b83263a0e6..e85e8e35d44 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12733,7 +12733,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->supports_xdbe = true; #endif -#ifdef HAVE_XFT +#if defined USE_CAIRO || defined HAVE_XFT { /* If we are using Xft, the following precautions should be made: |
