Subject: Re: bug#55782: [PATCH] Add support for the Grantha script

From: Eli Zaretskii <[email-masked]>
Date: Fri, 03 Jun 2022 16:31:09 +0300

> From: समीर सिंह Sameer Singh
>  <[email-masked]>
> Date: Fri, 3 Jun 2022 18:21:08 +0530
> 
> Add tamil supplement codepoints to (tamil).
[...]
> -	(tamil #xB95)
> +	(tamil #xB95 #x11FC0 #x11FC6)

This part is IMO a mistake: since there are no known fonts that
support both the Tamil block and the Tamil Supplement block, adding
the characters from the Supplement block to
script-representative-chars might cause Emacs to reject a good Tamil
font because it doesn't support the character from the Supplement
block.  We could use a vector instead of a list, but even that could
cause undesired consequences, whereby Emacs selects a font for Tamil
characters when it only supports Tamil Supplement, or vice versa.

I think adding Noto Sans Tamil Supplement to the default fontset is
for now the most we can do about the Tamil Supplement block.

> +(set-language-info-alist
> + "Grantha" '((charset unicode)
> +             (coding-system utf-8)
> +             (coding-priority utf-8)
> +             (input-method . "grantha")
> +             (sample-text . "Grantha (𑌗𑍍𑌰𑌨𑍍𑌥)	𑌨𑌮𑌸𑍍𑌤𑍇")
> +             (documentation . "\
> +Languages such as Sanskrit and Manipravalam which uses the
                                                     ^^^^
"use", in plural.

Also, "which use" is slightly misleading, I think: at least Sanskrit
also uses other scripts, doesn't it?  If so, I'd suggest saying "when
they use the Grantha script" instead.

> +;; Grantha composition rules
> +(let ((consonant            "[\x11315-\x11339]")
> +      (nukta                "\x1133C")
> +      (independent-vowel    "[\x11305-\x11314\x11360\x11361]")
> +      (vowel                "[\x1133E-\x1134C\x11357\x11362\x11363]")
> +      (nasal                "[\x11300-\x11302]")
> +      (bindu                "\x1133B")
> +      (visarga              "\x11303")
> +      (virama               "\x1134D")
> +      (avagraha             "\x1133D")
> +      (modifier-above       "[\x11366-\x11374]"))
> +  (set-char-table-range composition-function-table
> +                        '(#x1133B . #x1134D)
> +                        (list (vector
> +                               ;; Consonant based syllables
> +                               (concat consonant nukta "?" "\\(?:" virama consonant nukta
> +                                       "?\\)*\\(?:" virama "\\|" vowel "*" nukta "?" nasal
> +                                       "?" bindu "?" visarga "?" modifier-above "?"
> +                                       avagraha "?\\)")
> +                               1 'font-shape-gstring)

Some sequences that match the regexp will not be composed, according
to this rule.  For example, the sequence

   consonant vowel

won't be composed, because its second character is not in the range
'(#x1133B . #x1134D).  Is that okay?  Or are you relying on the
default composition of combining characters?

Thanks.