Subject: bug#39554: 27.0.50; cairo not composing sequences

From: Eli Zaretskii <[email-masked]>
Date: Wed, 12 Feb 2020 21:59:37 +0200

[Please keep the bug number on the CC list.]

> From: James Cloos <[email-masked]>
> Date: Wed, 12 Feb 2020 13:51:53 -0500
> 
> >>>>> "EZ" == Eli Zaretskii <[email-masked]> writes:
> 
> >> Sequences like 0̸ fail to display composed in master --with-cairo but do
> >> when usin xft.
> 
> EZ> Please show a complete reproducing recipe for this problem.
> 
> The 0̸ in thequoted line is one.

Sorry, I failed to realize that ̸ was a combining accent, not an ASCII
slash.

In an Emacs built with HarfBuzz on MS-Windows, if I use a font that
has support for ̸, I do see these two characters composed into a single
glyph whose width is as that of a single character.  But if I use
DejaVu Sans Mono, I indeed see a double-width grapheme cluster.  So I
think this might be related to font selection somehow.  Can you try
different monospaced fonts and see if the results in the Cairo build
are better with other fonts?

> EZ> This means that the font backend couldn't produce a single glyph for
> EZ> the character combination, for some reason, so it displayed the
> EZ> original glyphs as a single grapheme cluster.  IOW, character
> EZ> composition did work, it just didn't find a precomposed glyph in the
> EZ> font, or maybe the precomposed glyph was rejected for some reason.
> 
> It is not supposed to be looking for precomposed glyphs.  It is supposed
> to be rendering each combining glyph on top of the base glyph.  Just
> like xft does.

The way character composition works in Emacs, we first ask the font
for precomposed glyphs, and display them if the font has them.  If
that fails, then we combine the separate glyphs ourselves.  See
compose-gstring-for-graphic.