Subject: Re: bug#57962: 29.0.50; Odd font choices

From: Eli Zaretskii <[email-masked]>
Date: Sun, 16 Oct 2022 14:17:55 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sun, 16 Oct 2022 12:58:18 +0200
> 
> I've poked around some more here, experimenting with different fonts
> with -fn, and the thing is that everything works as expected with most
> fonts (i.e., the height of `fixed-pitch' and `default' fonts are the
> same, which is the problem, really) -- but with the default font in
> Ubuntu, "Ubuntu Mono", that's not the case.
> 
> So Emacs has chosen these two fonts for `default' and `fixed-pitch',
> respectively:
> 
>     ftcrhb:-DAMA-Ubuntu Mono-regular-normal-normal-*-48-*-*-*-m-0-iso10646-1 (#x2C)
>     ftcrhb:-PfEd-DejaVu Sans Mono-regular-normal-normal-*-48-*-*-*-m-0-iso10646-1 (#x26)
> 
> Is there something more Emacs could be doing to try to ensure that it
> picks equal-sized fonts?  By somehow looking at actual font metrics?

When we select a suitable font, we generally avoid opening a font,
because that's expensive.  So looking at the metrics is not possible,
unless we actually open each font.

But I don't think I understand what is going on here: these two fonts
are of the same size -- 48 -- so how come the glyphs have different
sizes?  And how different are they?  Can you look at the character
metrics inside gui_produce_glyphs and tell what we get from each font?

> (I guess we're currently just saying "give me this font in size 48"?

I think so, yes.  But if the font spec doesn't specify a size, maybe
we get different sizes?  Although the fact that both are "48" seems to
say we do get the same size?

> And that the actual size of the glyphs may vary between fonts?)

Not sure how this can happen, but I'm not enough of an expert on
fonts, sorry.