Subject: Re: bug#20727: 24.5; Font fallback doesn't work for the Emoji range

From: Eli Zaretskii <[email-masked]>
Date: Sat, 13 Jun 2015 21:31:32 +0300

> Date: Sat, 13 Jun 2015 10:10:05 -0700
> From: Paul Eggert <[email-masked]>
> CC: [email-masked], [email-masked], 
>  [email-masked]
> 
> Eli Zaretskii wrote:
> > Actually, an even better solution might be this: we explicitly specify
> > fixed-medium font with iso10646-1 registry for these popular
> > characters_before_  Symbola.  This is justified, I think, since the
> > standard-fontset-spec on X specifies a fixed-medium font, so fit is
> > iso10646-1 variant supports these commonly-used punctuation
> > characters, it is a better candidate than Symbola, while the latter
> > will still be used as fallback.
> >
> > WDYT?  Could you try this on your system and see if it work?
> 
> I'd be happy to try, but I'm afraid this is an area I don't know well

Neither do I, so please bear with me.

> and I 
> don't see why the existing code doesn't already do what you'r suggesting. 
> setup-default-fontset invokes (set-fontset-font "fontset-default" ... "Symbola" 
> nil 'prepend), and later invokes (set-fontset-font "fontset-default" nil '(nil . 
> "iso10646-1") nil 'prepend), so doesn't that mean that the iso10646-1 fonts are 
> prepended before Symbola and so should take priority over Symbola already?

No, not according to my understanding.  The latter part is fallback
for when nothing is specified as either the script or the character
range, which is not the case we are discussing.

> Anyway, If you can send me a patch along the lines you're thinking, I can try it.

Here's an example of the 1st idea.  If it works well, we can exempt
more ranges from Symbola (if you could tell me where to download the
fixed-medium font, I could look at its coverage to decide which other
ranges to exempt):

diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 696940e..cb32daa 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -697,7 +697,11 @@ (defun setup-default-fontset ()
   ;; covered well by Symbola.
   (dolist (symbol-subgroup
            '((#x0250 . #x02AF)	;; IPA Extensions
-             (#x2000 . #x206F)	;; General Punctuation
+             (#x2000 . #x2012)	;; General Punctuation
+             (#x2015 . #x2017)
+             (#x201F . #x202F)
+             (#x2031 . #x2038)
+             (#x203B . #x206F)
              (#x2070 . #x209F)	;; Superscripts and Subscripts
              (#x20A0 . #x20CF)	;; Currency Symbols
              (#x2100 . #x214F)	;; Letterlike Symbols

The second idea is to add

  (set-fontset-font "fontset-default" '(#x2013 . #x2014)
                    "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso10646-1"
		    nil 'prepend)
  (set-fontset-font "fontset-default" '(#x2018 . #x201E)
                    "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso10646-1"
		    nil 'prepend)
  (set-fontset-font "fontset-default" '(#x2039 . #x203A)
                    "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso10646-1"
		    nil 'prepend)

(and similarly for other ranges where that font has coverage) to
setup-default-fontset _after_ the Symbola portion.