Subject: [PATCH] Add support for the Grantha script

From: समीर सिंह Sameer Singh<[email-masked]>
Date: Fri, 3 Jun 2022 18:21:08 +0530

This time the beautiful Grantha script is added to Emacs.

Please review the patch.
Thank You.
From 7d2d5bf3236482edac7b48931ee267e1018074d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E0=A4=B8=E0=A4=AE=E0=A5=80=E0=A4=B0=20=E0=A4=B8=E0=A4=BF?=
 =?UTF-8?q?=E0=A4=82=E0=A4=B9=20Sameer=20Singh?= <[email-masked]>
Date: Wed, 1 Jun 2022 22:29:24 +0530
Subject: [PATCH] Add support for the Grantha script

* lisp/language/indian.el ("Grantha"): New language environment.
Add composition rules for Grantha. Add sample text and input method.
* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Support Grantha.
Add tamil supplement codepoints to (tamil).
* lisp/leim/quail/indian.el ("grantha"): New input method.

* etc/HELLO: Add a Grantha greeting.
* etc/NEWS: Announce the new language environment.
---
 etc/HELLO                     |   1 +
 etc/NEWS                      |   1 +
 lisp/international/fontset.el |   5 +-
 lisp/language/indian.el       |  38 +++++++++++
 lisp/leim/quail/indian.el     | 115 ++++++++++++++++++++++++++++++++++
 5 files changed, 158 insertions(+), 2 deletions(-)

diff --git a/etc/HELLO b/etc/HELLO
index 4148183949..6694501a7d 100644
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -56,6 +56,7 @@ Finnish (suomi)	Hei / Hyvää päivää
 French (français)	Bonjour / Salut
 Georgian (ქართული)	გამარჯობა
 German (Deutsch)	Guten Tag / Grüß Gott
+Grantha (𑌗𑍍𑌰𑌨𑍍𑌥)	𑌨𑌮𑌸𑍍𑌤𑍇 / 𑌨𑌮𑌸𑍍𑌕𑌾𑌰𑌃
 Greek (ελληνικά)	Γειά σας
 Greek, ancient (ἑλληνική)	Οὖλέ τε καὶ μέγα χαῖρε
 Gujarati (ગુજરાતી)	નમસ્તે
diff --git a/etc/NEWS b/etc/NEWS
index 54bc6d80e1..cc378d929c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -850,6 +850,7 @@ corresponding language environments are:
 **** Makasar script and language environment
 **** Lontara script and language environment
 **** Hanifi Rohingya script and language environment
+**** Grantha script and language environment
 
 ---
 *** The "Oriya" language environment was renamed to "Odia".
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 2c54c86ab7..834e1321af 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -167,7 +167,7 @@ font-encoding-charset-alist
 	(gurmukhi #xA15)
 	(gujarati #xA95)
 	(oriya #xB15)
-	(tamil #xB95)
+	(tamil #xB95 #x11FC0 #x11FC6)
 	(telugu #xC15)
 	(kannada #xC95)
 	(malayalam #xD15)
@@ -250,7 +250,7 @@ font-encoding-charset-alist
         (sharada #x11191 #x111B3 #x111CD)
 	(khojki #x11200)
 	(khudawadi #x112B0)
-	(grantha #x11305)
+	(grantha #x11315 #x1133E #x11374)
 	(newa #x11400)
 	(tirhuta #x11481 #x1148F #x114D0)
 	(siddham #x1158E #x115AF #x115D4)
@@ -801,6 +801,7 @@ setup-default-fontset
                     brahmi
                     kaithi
                     sharada
+                    grantha
                     tirhuta
                     siddham
                     modi
diff --git a/lisp/language/indian.el b/lisp/language/indian.el
index 4dfad75275..7ec83210d6 100644
--- a/lisp/language/indian.el
+++ b/lisp/language/indian.el
@@ -233,6 +233,17 @@ 'devanagari
 language environment."))
  '("Indian"))
 
+(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
+Grantha script are supported in this language environment."))
+ '("Indian"))
+
 ;; Replace mnemonic characters in REGEXP according to TABLE.  TABLE is
 ;; an alist of (MNEMONIC-STRING . REPLACEMENT-STRING).
 
@@ -696,5 +707,32 @@ malayalam-composable-pattern
                                        "?" vowel "?" other-signs "?")
                                1 'font-shape-gstring))))
 
+;; 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)
+                              (vector
+                               ;; Vowels based syllables
+                               (concat independent-vowel nukta "?" virama "?" vowel "?"
+                                       nasal "?" bindu "?" visarga "?" modifier-above
+                                       "?" avagraha "?")
+                               1 'font-shape-gstring))))
+
 (provide 'indian)
 ;;; indian.el ends here
diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el
index 031c30aabb..6a3582e83d 100644
--- a/lisp/leim/quail/indian.el
+++ b/lisp/leim/quail/indian.el
@@ -1656,4 +1656,119 @@ "||"
 ("`?" ?᥅)
 )
 
+(quail-define-package
+ "grantha" "Grantha" "𑌗𑍍𑌰" t "Grantha phonetic input method.
+
+ `\\=`' is used to switch levels instead of Alt-Gr."
+ nil t t t t nil nil nil nil nil t)
+
+(quail-define-rules
+ ("``" ?₹)
+ ("1"  ?௧)
+ ("`1" ?1)
+ ("`!" ?𑍧)
+ ("2"  ?௨)
+ ("`2" ?2)
+ ("`@" ?𑍨)
+ ("3"  ?௩)
+ ("`3" ?3)
+ ("`#" ?𑍩)
+ ("4"  ?௪)
+ ("`4" ?4)
+ ("`$" ?𑍪)
+ ("5"  ?௫)
+ ("`5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