Subject: Re: bug#76967: 30.1; Specific UTF-8 characters causes misalignments on PGTK

From: Eli Zaretskii <[email-masked]>
Date: Fri, 14 Mar 2025 09:12:50 +0200

> Date: Thu, 13 Mar 2025 20:45:57 +0000
> From: artur <[email-masked]>
> Cc: [email-masked], Manuel Giraud <[email-masked]>
> 
>  > When you say "using font so-and-so", do you mean the font used for 
> the
>  > default face?
> 
> I meant for the default face, yes.
> 
>  > Maybe you should look at what font is used on Braille or CJK 
> characters
>  > with "C-u C-x =" when you see such misalignment. With fontsets, Emacs
>  > tries really hard to find a suitable glyph for a given character even
>  > using a different font which, most probably, will have a different 
> width
>  > and cause misalignment.
> 
>  > If so, please check whether the problematic characters are rendered
>  > using some different font. E.g., I'd expect Braille or CJK characters
>  > to use a different font.
> 
> And you are absolutely right to believe this - seems as if with 
> Departure
> Mono, separator blocks are being rendered with FreeSerif. Not really
> surprised why it was breaking now. However, in foot it finds the correct
> glyph in with the same font? Looks like Emacs was *very* eager to 
> replace
> the glyph even if a matching one existed...

I think Emacs ought to try to use the default font where it can do the
job.  Can you use some font-viewing utility to check if the default
face's font has glyphs for the problematic characters, when Emacs uses
a different font for them?  If Emacs ignores existing glyphs of the
default font and uses a different font, there could be a way of
dealing with these problems.  But in general, we can only ensure
alignment if glyphs from the same font are used for the characters.