From 4ff4b66df8da175d8df292d12a30ab50285b6917 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 8 Oct 2016 22:03:51 +0300 Subject: [PATCH] Allow selection of font for symbols as in Emacs 24.x * src/fontset.c (syms_of_fontset) : New boolean variable. (face_for_char): Use it to fall back to pre-Emacs 25.1 behavior when selecting fonts for displaying symbol and punctuation characters. (Bug#24644) * etc/NEWS: Mention the new variable. --- etc/NEWS | 15 +++++++++++++-- src/fontset.c | 13 ++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 274226b9fd9..8c27289d5e0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -24,8 +24,19 @@ This is a bug-fix release with (almost) no new features. `find-function-after-hook'. +++ -*** New basic face 'fixed-pitch-serif', for a fixed-width font with serifs. -The Info-quoted and tex-verbatim faces now default to inheriting from it. +** New basic face 'fixed-pitch-serif', for a fixed-width font with serifs. +The Info-quoted and tex-verbatim faces now default to inheriting from +it. + +--- +** New variable 'use-default-font-for-symbols' for backward compatibility. +This variable allows to get back pre-Emacs 25 behavior whereby the +font for displaying symbol and punctuation characters was always +selected according to your fontset setup. Emacs 25 by default tries +to use the default face's font for such characters, disregarding the +fontsets if the default font supports these characters. Set this +variable to nil to disable the new behavior and get back the old +behavior. * Installation Changes in Emacs 25.1 diff --git a/src/fontset.c b/src/fontset.c index dc037a807cd..74e7df5ae09 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -883,7 +883,8 @@ face_for_char (struct frame *f, struct face *face, int c, if (ASCII_CHAR_P (c) || CHAR_BYTE8_P (c)) return face->ascii_face->id; - if (c > 0 && EQ (CHAR_TABLE_REF (Vchar_script_table, c), Qsymbol)) + if (use_default_font_for_symbols /* let the user disable this feature */ + && c > 0 && EQ (CHAR_TABLE_REF (Vchar_script_table, c), Qsymbol)) { /* Fonts often have characters for punctuation and other symbols, even if they don't match the 'symbol' script. So @@ -2112,6 +2113,16 @@ This affects how a composite character which contains such a character is displayed on screen. */); Vuse_default_ascent = Qnil; + DEFVAR_BOOL ("use-default-font-for-symbols", use_default_font_for_symbols, + doc: /* +If non-nil, use the default face's font for symbols and punctuation. + +By default, Emacs will try to use the default face's font for +displaying symbol and punctuation characters, disregarding the +fontsets, if the default font can display the character. +Set this to nil to make Emacs honor the fontsets instead. */); + use_default_font_for_symbols = 1; + DEFVAR_LISP ("ignore-relative-composition", Vignore_relative_composition, doc: /* Char table of characters which are not composed relatively. -- 2.39.2