GNU bug report logs - #73752
29.4; Ligatures are randomly rendered with extra spaces

Previous Next

Package: emacs;

Reported by: xuan <at> xlk.me

Date: Fri, 11 Oct 2024 21:40:02 UTC

Severity: normal

Merged with 54646

Found in versions 29.0.50, 29.4

Fixed in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Visuwesh <visuweshm <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 73752 <at> debbugs.gnu.org, xuan <at> xlk.me
Subject: bug#73752: 29.4; Ligatures are randomly rendered with extra spaces
Date: Tue, 29 Oct 2024 16:29:48 +0530
[திங்கள் அக்டோபர் 28, 2024] Eli Zaretskii wrote:

>> From: Visuwesh <visuweshm <at> gmail.com>
>> Cc: luangruo <at> yahoo.com,  73752 <at> debbugs.gnu.org,  xuan <at> xlk.me
>> Date: Mon, 28 Oct 2024 21:48:26 +0530
>> 
>> > You need to catch this situation in some reproducible recipe.  Because
>> > up front I don't understand how is this possible: we cache each
>> > composition with its font object, which includes the font size (and
>> > also slant, weight, etc.), so a different variant of the same font
>> > ought to match only cache entries that use the exact same font.  Or
>> > maybe I don't understand well enough what
>> > composition_gstring_put_cache does to compute the hash of a
>> > glyph-string header (which is the hash key for a composition)?
>> 
>> Is this hash dependent on the font driver?
>
> No.  Only the font used for the composed characters is recorded, not
> the font backend which opened it.  But fonts are managed by the font
> backend, so maybe there's some leakage by that way.

OK, thanks.  I wonder if we could compare the value returned by
font-info if something has gone wrong with the font object used to
compute the hash for the glyph?  

>> Also, do we clear the composition cache when all the GUI frames of an
>> Emacs daemon are deleted?
>
> No, we don't, not directly.  But we clear the face cache, and that
> removes the data of the fonts referred by the face cache from the
> composition cache.  So it's quite possible the composition cache is
> left empty when all the frames are deleted.

Thanks that would explain it but then...

>> The misalignment goes away when I close all
>> the GUI frames of the daemon, and open a fresh new GUI frame.
>
> Next time this happens, try one of these two:
>
>   M-: (clear-face-cache t) RET
>   M-: (clear-composition-cache) RET
>
> and see if any of them corrects the problematic display.

neither of them helped in the past.  I tried to if they help again but
failed to reproduce the problem today.

> Btw, how frequently do you use different frames, 

Quite often, I would say.  I usually have two frames but it can go
upwards of 5 to 6 if I have a mouse attached to my laptop.

> and how likely are you to have different definitions for the same
> faces on different frames in the same Emacs session at the same time?

I don't quite understand this question.  Are you asking if I have any
"frame-specific" face attributes i.e., non-nil FRAME argument in
set-face-attribute?  If so, no.

>> > But how can this happen?  Without a reproducible recipe, which can be
>> > reproduced without waiting for too long, it is very hard to
>> > investigate this.
>> 
>> I have no idea.  This is not easy to reproduce and seems to be heavily
>> dependent on the configuration.  Although I use a Cairo build (with
>> Lucid toolkit), the misalignment is not as severe as OP says and it
>> takes a lot more time to reproduce as well.  I could never come up with
>> a reproducer that takes less time.
>
> The only way I see to investigate this is to wait for this to happen,
> then attach GDB to Emacs and look at the problematic compositions in
> the cache, comparing them to the corresponding compositions in a fresh
> Emacs session.  I can tell what to look for with GDB, if that helps.

That would help.  But given how hard it is to reproduce this issue on my
end, I don't know when I can get back...

> If we see that two compositions that should be identical differ by
> their font objects, say, we'd at least have a lead and a starting
> point for further debugging.




This bug report was last modified 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.