Subject: bug#14461: 24.3.50; bad display for 'space' + (U+0336) unicode combination

From: Eli Zaretskii <[email-masked]>
Date: Sat, 17 Aug 2019 15:00:18 +0300

> From: Stephen Berman <[email-masked]>
> Date: Thu, 15 Aug 2019 14:29:08 +0200
> Cc: [email-masked], Lars Ingebrigtsen <[email-masked]>
> 
> On Thu, 15 Aug 2019 12:02:21 +0200 Cédric Chépied <[email-masked]> wrote:
> 
> ... I assume combining characters are always displayed after a space
> instead of over it -- at least that's what I see with e.g. U+0301
> (COMBINING ACUTE ACCENT) and U+0302 (COMBINING CIRCUMFLEX ACCENT).

Indeed, we reject base characters of certain general categories,
including those whose general category is Zs (space separator).  In
composite.el:compose-gstring-for-graphic we have:

     ;; This sequence doesn't start with a proper base character.
     ((memq (get-char-code-property (lgstring-char gstring 0)
				    'general-category)
	    '(Mn Mc Me Zs Zl Zp Cc Cf Cs))
      nil)

> That makes sense to me (otherwise, you couldn't visually distinguish
> e.g. the sequence 'aU+0301U+0302' from the sequence 'aU+0301 U+0302')

I don't see why: the former should be displayed as a single grapheme
cluster, with both diacritics on top of a, whereas the latter should
be displayed as 2 grapheme clusters, with U+0302 on top of the SPC
character instead of on top of a.

> and I would guess some Unicode standard prescribes it.

Actually , the Unicode Standard prescribes the opposite.  It says
(paragraph 3.6):

  D50 Graphic character: A character with the General Category of
      Letter (L), Combining Mark (M), Number (N), Punctuation (P),
      Symbol (S), or Space Separator (Zs).
  ...
  D51 Base character: Any graphic character except for those with the
      General Category of Combining Mark (M).
       • Most Unicode characters are base characters. In terms of
	 General Category values, a base character is any code point
	 that has one of the following categories: Letter (L), Number
	 (N), Punctuation (P), Symbol (S), or Space Separator (Zs).
  ...
  D52 Combining character: A character with the General Category of
      Combining Mark (M).

and (in 2.11)

      All combining characters can be applied to any base character and
      can, in principle, be used with any script.

So I don't think we are right when we exclude space separators from
base characters eligible for character composition, I think it's a
mistake.  Perhaps Handa-san (CC'ed) could comment on why we do that.