Subject: Re: bug#52542: 29.0.50; Emoji makes lines taller

From: Eli Zaretskii <[email-masked]>
Date: Sat, 18 Dec 2021 08:38:09 +0200

> From: Rudolf Adamkovič <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 17 Dec 2021 22:57:54 +0100
> 
> > Your expectations are unfounded, IMO.  Emacs cannot possibly change
> > the fonts you have on your system, and cannot truncate glyphs of the
> > Emoji characters if they are taller than the font used for the default
> > face.  So it has no alternative but to make the line's height larger.
> 
> Interesting.  I based my expectation on the built-in Terminal
> application on macOS.  It uses the same default font as Emacs, yet
> emojis do not change the height of its lines.

If you can look into its sources and tell what is it doing, we could
perhaps use some of those ideas, if they fit how Emacs works with
fonts.  The main issue here is not the default font, it's the font
used for Emoji; I believe it's a different font in both cases.

> Cannot Emacs, when defaulting to "Apple Color Emoji", make the emojis a
> bit smaller?  Terminal seems to do that.

The Emoji come out as small or as large as the font tells us: the
metrics of each glyph are dictated by the font.  Emacs selects an
Emoji (and any other) font's size to match as well as possible the
size of the default face's font, so Emacs attempts to make the size
the same up front.  It is possible that we somehow miscalculate the
size, or fail to find the right match, or something like that.  But
once the font matching the default face's size is selected, Emacs
never changes the metrics of the font glyphs as provided by the font.