mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-28
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 180-191) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 39-44) - Merge from emacs--cvs-trunk--0 - Update from CVS
This commit is contained in:
commit
1bac4db562
90 changed files with 3614 additions and 1388 deletions
|
|
@ -34,20 +34,38 @@
|
|||
(defconst thai-category-table (make-category-table))
|
||||
(define-category ?c "Thai consonant" thai-category-table)
|
||||
(define-category ?v "Thai upper/lower vowel" thai-category-table)
|
||||
(define-category ?t "Thai tone" thai-category-table)
|
||||
(define-category ?t "Thai tone mark" thai-category-table)
|
||||
(define-category ?u "Thai tone mark and upper sign" thai-category-table)
|
||||
(define-category ?I "THAI CHARACTER SARA I" thai-category-table)
|
||||
(define-category ?U "THAI CHARACTER THANTHAKHAT" thai-category-table)
|
||||
|
||||
;; The general composing rules are as follows:
|
||||
;;
|
||||
;; T
|
||||
;; V T V T
|
||||
;; CV -> C, CT -> C, CVT -> C, Cv -> C, CvT -> C
|
||||
;; V U V U
|
||||
;; CV -> C, CU -> C, CVT -> C, Cv -> C, CvU -> C
|
||||
;; v v
|
||||
;;
|
||||
;; where C: consonant, V: vowel upper, v: vowel lower, T: tone mark.
|
||||
;; where C: consonant, V: vowel upper, v: vowel lower,
|
||||
;; T: tone mark, U: tone mark and upper sign.
|
||||
;; Special rule: The sign `,Tl(B' can be put on the vowel `,TT(B'.
|
||||
|
||||
(defvar thai-composition-pattern "\\cc\\(\\ct\\|\\cv\\ct?\\)"
|
||||
|
||||
(defvar thai-composition-pattern
|
||||
"\\cc\\(\\cu\\|\\cI\\cU\\|\\cv\\ct?\\)\\|\\cv\\ct\\|\\cI\\cU"
|
||||
"Regular expression matching a Thai composite sequence.")
|
||||
|
||||
(defun thai-self-insert-command (&optional n)
|
||||
"Insert the Thai character you type.
|
||||
The character will be composed with the surrounding Thai character
|
||||
if necessary."
|
||||
(interactive "*p")
|
||||
(let ((pos (point))
|
||||
category-set ch)
|
||||
(self-insert-command n)
|
||||
(or thai-auto-composition-mode
|
||||
(thai-auto-composition (1- (point)) (point) 0))))
|
||||
|
||||
(let ((l '((?,T!(B consonant "LETTER KO KAI") ; 0xA1
|
||||
(?,T"(B consonant "LETTER KHO KHAI") ; 0xA2
|
||||
(?,T#(B consonant "LETTER KHO KHUAT") ; 0xA3
|
||||
|
|
@ -118,14 +136,14 @@
|
|||
(?,Td(B vowel-base "VOWEL SIGN SARA MAI MALAI") ; 0xE4
|
||||
(?,Te(B vowel-base "LAK KHANG YAO") ; 0xE5
|
||||
(?,Tf(B special "MAI YAMOK (repetion)") ; 0xE6
|
||||
(?,Tg(B vowel-upper "VOWEL SIGN MAI TAI KHU N/S-T") ; 0xE7
|
||||
(?,Tg(B sign-upper "VOWEL SIGN MAI TAI KHU N/S-T") ; 0xE7
|
||||
(?,Th(B tone "TONE MAI EK N/S-T") ; 0xE8
|
||||
(?,Ti(B tone "TONE MAI THO N/S-T") ; 0xE9
|
||||
(?,Tj(B tone "TONE MAI TRI N/S-T") ; 0xEA
|
||||
(?,Tk(B tone "TONE MAI CHATTAWA N/S-T") ; 0xEB
|
||||
(?,Tl(B tone "THANTHAKHAT N/S-T (cancellation mark)") ; 0xEC
|
||||
(?,Tm(B tone "NIKKHAHIT N/S-T (final nasal)") ; 0xED
|
||||
(?,Tn(B vowel-upper "YAMAKKAN N/S-T") ; 0xEE
|
||||
(?,Tl(B sign-upper "THANTHAKHAT N/S-T (cancellation mark)") ; 0xEC
|
||||
(?,Tm(B sign-upper "NIKKHAHIT N/S-T (final nasal)") ; 0xED
|
||||
(?,Tn(B sign-upper "YAMAKKAN N/S-T") ; 0xEE
|
||||
(?,To(B special "FONRMAN") ; 0xEF
|
||||
(?,Tp(B special "DIGIT ZERO") ; 0xF0
|
||||
(?,Tq(B special "DIGIT ONE") ; 0xF1
|
||||
|
|
@ -150,25 +168,61 @@
|
|||
(ptype (nth 1 elm)))
|
||||
(put-char-code-property char 'phonetic-type ptype)
|
||||
(cond ((eq ptype 'consonant)
|
||||
(modify-category-entry char ?c thai-category-table))
|
||||
(modify-category-entry char ?c thai-category-table)
|
||||
(global-set-key (vector char) 'thai-self-insert-command))
|
||||
((memq ptype '(vowel-upper vowel-lower))
|
||||
(modify-category-entry char ?v thai-category-table))
|
||||
(modify-category-entry char ?v thai-category-table)
|
||||
(if (or (= char ?,TT(B) (= char ?$,1C4(B))
|
||||
;; Give category `I' to "SARA I".
|
||||
(modify-category-entry char ?I thai-category-table))
|
||||
(global-set-key (vector char) 'thai-self-insert-command))
|
||||
((eq ptype 'tone)
|
||||
(modify-category-entry char ?t thai-category-table)))
|
||||
(modify-category-entry char ?t thai-category-table)
|
||||
(modify-category-entry char ?u thai-category-table)
|
||||
(global-set-key (vector char) 'thai-self-insert-command))
|
||||
((eq ptype 'sign-upper)
|
||||
(modify-category-entry char ?u thai-category-table)
|
||||
(if (or (= char ?,Tl(B) (= char ?$,1CL(B))
|
||||
;; Give category `U' to "THANTHAKHAT".
|
||||
(modify-category-entry char ?U thai-category-table))
|
||||
(global-set-key (vector char) 'thai-self-insert-command)))
|
||||
(put-char-code-property char 'name (nth 2 elm)))))
|
||||
|
||||
(defun thai-compose-syllable (beg end &optional category-set string)
|
||||
(or category-set
|
||||
(setq category-set
|
||||
(char-category-set (if string (aref string beg) (char-after beg)))))
|
||||
(if (aref category-set ?c)
|
||||
;; Starting with a consonant. We do relative composition.
|
||||
(if string
|
||||
(compose-string string beg end)
|
||||
(compose-region beg end))
|
||||
;; Vowel tone sequence.
|
||||
(if string
|
||||
(compose-string string beg end (list (aref string beg) '(Bc . Bc)
|
||||
(aref string (1+ beg))))
|
||||
(compose-region beg end (list (char-after beg) '(Bc . Bc)
|
||||
(char-after (1+ beg))))))
|
||||
(- end beg))
|
||||
|
||||
;;;###autoload
|
||||
(defun thai-compose-region (beg end)
|
||||
"Compose Thai characters in the region.
|
||||
When called from a program, expects two arguments,
|
||||
positions (integers or markers) specifying the region."
|
||||
(interactive "r")
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(goto-char (point-min))
|
||||
(with-category-table thai-category-table
|
||||
(while (re-search-forward thai-composition-pattern nil t)
|
||||
(compose-region (match-beginning 0) (match-end 0))))))
|
||||
(let ((pos (point)))
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(goto-char (point-min))
|
||||
(with-category-table thai-category-table
|
||||
(while (re-search-forward thai-composition-pattern nil t)
|
||||
(setq beg (match-beginning 0) end (match-end 0))
|
||||
(if (and (> pos beg) (< pos end))
|
||||
(setq pos end))
|
||||
(thai-compose-syllable beg end
|
||||
(char-category-set (char-after beg))))))
|
||||
(goto-char pos)))
|
||||
|
||||
;;;###autoload
|
||||
(defun thai-compose-string (string)
|
||||
|
|
@ -176,7 +230,7 @@ positions (integers or markers) specifying the region."
|
|||
(with-category-table thai-category-table
|
||||
(let ((idx 0))
|
||||
(while (setq idx (string-match thai-composition-pattern string idx))
|
||||
(compose-string string idx (match-end 0))
|
||||
(thai-compose-syllable idx (match-end 0) nil string)
|
||||
(setq idx (match-end 0)))))
|
||||
string)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
;; Copyright (C) 2003
|
||||
;; National Institute of Advanced Industrial Science and Technology (AIST)
|
||||
;; Registration Number H13PRO009
|
||||
;; Copyright (C) 2005
|
||||
;; National Institute of Advanced Industrial Science and Technology (AIST)
|
||||
;; Registration Number H14PRO021
|
||||
|
||||
;; Keywords: multilingual, Thai, i18n
|
||||
|
||||
|
|
@ -53,7 +56,7 @@
|
|||
(features thai-util)
|
||||
(sample-text
|
||||
. (thai-compose-string
|
||||
(copy-sequence "Thai (,T@RIRd7B(B) ,TJ0GQ1J04U1$0CQ1:(B, ,TJ0GQ1J04U10$h1P(B")))
|
||||
(copy-sequence "Thai (,T@RIRd7B(B) ,TJGQJ4U$CQ:(B, ,TJGQJ4U$hP(B")))
|
||||
(documentation . t)))
|
||||
|
||||
(define-coding-system 'cp874
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue