Subject: bug#24560: 25.1; With `--font 7x13', wrong font is used for Unicode characters

From: Eli Zaretskii <[email-masked]>
Date: Thu, 29 Sep 2016 18:30:37 +0300

Adding Handa-san to this discussion, in the hope that he could shed
some light on this issue.

> From: Vladimir Panteleev <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 28 Sep 2016 21:58:20 +0000
> 
> On 2016-09-28 20:16, Eli Zaretskii wrote:
> > Are you sure the 7x13 font installed on your system supports all those
> > characters?  Emacs won't switch to a different font if the default
> > font supports the character it needs to display.
> 
> As I mentioned in my bug report and as is visible in the screenshots,
> the characters are indeed present in the font and are rendered correctly
> in other applications. Only Emacs exhibits this problem.
> 
> > Or could it be that some customizations, either yours or site-wide,
> > force Emacs to use other fonts for the above characters?
> 
> This problem is reproducible with "emacs -Q", without any
> customizations, on all distributions I've tried.

Then I guess there's some factor at work here that I don't quite
figure out.  Maybe the Emacs font selection algorithm doesn't like
that font for some reason?

If you start Emacs with 12x13 font or 8x13, does Emacs display more
characters than 7x13 before it switches to another font?

> Here is a complete recipe using a live CD, to remove any possibility of
> user or site customization:
> 
> 1. Get the Antergos live ISO (
> https://antergos.com/download/antergos-live-iso/ ) and boot from it
> (e.g. in a VM).
> 2. Choose "Start Antergos live".
> 3. Choose "Try It".
> 4. Install Emacs and urxvt (in a terminal, run "pacman -S emacs
> rxvt-unicode").
> 5. Run "emacs -Q --font 7x13".
> 6. M-x view-hello-file
> 7. Observe that Cyrillic characters are rendered in a 12x13 font.
> 8. Run "urxvt -fn 7x13".
> 9. Copy some Cyrillic characters from Emacs and paste them in urxvt.
> 10. Observe that urxvt renders the Cyrillic characters correctly, in the
> correct font.
> 
> This is not specific to Arch / Antegros: The problem is also
> reproducible on Ubuntu and Fedora Workstation Live CDs, though you may
> have to also install some font packages (xorg-x11-fonts-misc for
> Fedora), and Emacs uses the 8x13 font for Cyrillic characters (so the
> problem is less obvious). urxvt still uses the correct font there.
> 
> >> I have found that evaluating the Sexpr:
> >>
> >> (set-fontset-font "fontset-default" 'unicode "-misc-fixed-*-*-*--13-*-*-*-*-70-iso10646-1")
> >>
> > 
> > Don't do that, this setting will cause all kinds of surprises.  To
> > customize the fonts, use specific character codepoint ranges, and only
> > specify font for a range if the font support most or all of that
> > range.
> 
> Noted. However, immediately lacking a better concrete workaround, I
> don't have a better option at my disposal.

Hopefully, Handa-san will have some advice here.