emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master eb0680bd57: Add support for Tai Tham script


From: Eli Zaretskii
Subject: master eb0680bd57: Add support for Tai Tham script
Date: Wed, 16 Feb 2022 10:09:17 -0500 (EST)

branch: master
commit eb0680bd57bd68ca369dc5133646e8ac9215854c
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Add support for Tai Tham script
    
    * lisp/international/fontset.el (setup-default-fontset)
    (script-representative-chars): Add tai-tham.
    * lisp/language/thai.el ("Northern Thai"): New language
    environment.  Patch by Richard Wordingham
    <richard.wordingham@ntlworld.com>.  Set
    'composition-function-table' for the Tai Tham block.  Original
    code by Richard Wordingham <richard.wordingham@ntlworld.com>.
    
    * etc/HELLO: Add Northern Thai greeting.
    * etc/NEWS: Announce addition of Northern Thai language environment.
---
 etc/HELLO                     |  1 +
 etc/NEWS                      |  3 +++
 lisp/international/fontset.el |  2 ++
 lisp/language/thai.el         | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+)

diff --git a/etc/HELLO b/etc/HELLO
index 5b2002ff93..da9b388f36 100644
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -66,6 +66,7 @@ Maldivian (ދިވެހި)    އައްސަލާމު ޢަލައިކުމް / ކިހިނ
 Maltese (il-Malti)     Bonġu / Saħħa
 Mathematics    ∀ p ∈ world • hello p  □
 Mongolian (монгол хэл) Сайн байна уу?
+Northern Thai (ᨣᩣᩴᨾᩮᩬᩥᨦ / ᨽᩣᩈᩣᩃ᩶ᩣ᩠ᨶᨶᩣ) ᩈ᩠ᩅᩢᩔ᩠ᨯᩦᨣᩕᩢ᩠ᨸ
 Norwegian (norsk)      Hei / God dag
 Oriya (ଓଡ଼ିଆ)   ଶୁଣିବେ
 Polish  (język polski) Dzień dobry! / Cześć!
diff --git a/etc/NEWS b/etc/NEWS
index 8d28340c33..0bc0b120a9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -514,6 +514,9 @@ Setting it to a non-nil value temporarily disables automatic
 composition of character sequences at point, and thus makes it easier
 to edit such sequences by allowing point to "enter" the sequence.
 
+*** New language environment "Northern Thai".
+This uses the Tai Tham script, whose support has been enhanced.
+
 
 * Changes in Specialized Modes and Packages in Emacs 29.1
 
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index bd557df180..973c637eff 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -184,6 +184,7 @@
        (runic #x16A0)
        (khmer #x1780)
        (mongolian #x1826)
+        (tai-tham #x1A20 #x1A55 #x1A61 #x1A80)
        (symbol . [#x201C #x2200 #x2500])
        (braille #x2800)
        (ideographic-description #x2FF0)
@@ -779,6 +780,7 @@
                    counting-rod-numeral
                     toto
                    adlam
+                    tai-tham
                    mahjong-tile
                    domino-tile
                     emoji))
diff --git a/lisp/language/thai.el b/lisp/language/thai.el
index 6a6289a44c..60f5f9d2a3 100644
--- a/lisp/language/thai.el
+++ b/lisp/language/thai.el
@@ -82,6 +82,43 @@ This is the same as `thai-tis620' with the addition of 
no-break-space."
     (aset composition-function-table (aref chars i) elt)))
 (aset composition-function-table ?ำ '(["[ก-ฯ]." 1 thai-composition-function]))
 
+;; Tai-Tham
+
+(set-language-info-alist
+ "Northern Thai" '((charset unicode)
+                  (coding-system utf-8)
+                  (coding-priority utf-8)
+                  (sample-text .
+                    "Northern Thai (ᨣᩣᩴᨾᩮᩬᩥᨦ / ᨽᩣᩈᩣᩃ᩶ᩣ᩠ᨶᨶᩣ)    ᩈ᩠ᩅᩢᩔ᩠ᨯᩦᨣᩕᩢ᩠ᨸ")
+                  (documentation . t)))
+
+;; From Richard Wordingham <richard.wordingham@ntlworld.com>:
+(defvar tai-tham-composable-pattern
+  (let ((table
+         ;; C is letters, independent vowels, digits, punctuation and symbols.
+         '(("C" . "[\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD]")
+           ("M" .           ; Marks, CGJ, ZWNJ, ZWJ
+            
"[\u0324\u034F\u0E49\u0E4A\u0E4B\u1A55-\u1A57\u1A59-\u1A5E\u1A61-\u1A7C\u1A7F\u200C\200D]")
+           ("H" . "\u1A60") ; Sakot
+           ("S" .           ; Marks commuting with sakot
+            "[\u0E49-\u0E4B\u0EC9\u0ECB\u1A75-\u1A7C]")
+           ("N" . "\u1A58"))) ; mai kang lai
+        (basic-syllable "C\\(N*\\(M\\|HS*C\\)\\)*")
+        (regexp "X\\(N\\(X\\)?\\)*H?")) ; where X is basic syllable
+    (let ((case-fold-search nil))
+      (setq regexp (replace-regexp-in-string "X" basic-syllable regexp t t))
+      (dolist (elt table)
+        (setq regexp (replace-regexp-in-string (car elt) (cdr elt)
+                                               regexp t t))))
+    regexp))
+
+(let ((elt (list (vector tai-tham-composable-pattern 0 'font-shape-gstring)
+                )))
+  (set-char-table-range composition-function-table '(#x1A20 . #x1A54) elt)
+  (set-char-table-range composition-function-table '(#x1A80 . #x1A89) elt)
+  (set-char-table-range composition-function-table '(#x1A90 . #x1A99) elt)
+  (set-char-table-range composition-function-table '(#x1AA0 . #x1AAD) elt))
+
 (provide 'thai)
 
 ;;; thai.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]