"[\e$,15U\e(B-\e$,15y68\e(B-\e$,16?\e(B]")
(defconst devanagari-composable-pattern
- (concat
+ (concat
"\\([\e$,15E\e(B-\e$,15T6@6A\e(B][\e$,15A5B\e(B]?\\)\\|\e$,15C\e(B"
"\\|\\("
"\\(?:\\(?:[\e$,15U\e(B-\e$,15y68\e(B-\e$,16?\e(B]\e$,16-\e(B\\)?\\(?:[\e$,15U\e(B-\e$,15y68\e(B-\e$,16?\e(B]\e$,16-\e(B\\)?\\(?:[\e$,15U\e(B-\e$,15y68\e(B-\e$,16?\e(B]\e$,16-\e(B\\)?[\e$,15U\e(B-\e$,15y68\e(B-\e$,16?\e(B]\e$,16-\e(B\\)?"
(narrow-to-region from to)
(goto-char (point-min))
(while (re-search-forward devanagari-composable-pattern nil t)
- (devanagari-compose-syllable-region (match-beginning 0)
- (match-end 0))))))
+ (devanagari-compose-syllable-region (match-beginning 0)
+ (match-end 0))))))
(defun devanagari-compose-string (string)
(with-temp-buffer
(insert (decompose-string string))
(defun devanagari-range (from to)
"Make the list of the integers of range FROM to TO."
- (let (result)
+ (let (result)
(while (<= from to) (setq result (cons to result) to (1- to))) result))
(defun devanagari-regexp-of-hashtbl-keys (hashtbl)
"Return a regular expression that matches all keys in hashtable HASHTBL."
(let ((max-specpdl-size 1000))
(regexp-opt
- (sort
+ (sort
(let (dummy)
(maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl)
dummy)
(mapc
(function (lambda (ucs)
(aset composition-function-table ucs
- (list (cons devanagari-composable-pattern
- 'devanagari-composition-function)))))
+ (list (cons devanagari-composable-pattern
+ 'devanagari-composition-function)))))
(nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961)))
;; Notes on conversion steps.
-;; 1. chars to glyphs
+;; 1. chars to glyphs
;;
;; Rules will not be applied to the halant appeared at the end of the
;; text. Also, the preceding/following "r" will be treated as special case.
;; Note that `consonant-glyph' mentioned here does not contain the
;; vertical bar (right modifier) attached at the right of the
;; consonant.
-;;
-;; If the glyph-group contains right modifier,
+;;
+;; If the glyph-group contains right modifier,
;; (1) consonant-glyphs/vowels, with nukta sign
;; (2) spacing
;; (3) right modifier (may be matra)
;; (6) anuswar
;; (7) following "r"
;; (8) bottom matra or halant.
-;;
-;; Otherwise,
+;;
+;; Otherwise,
;; (1) consonant-glyph/vowels, with nukta sign
;; (3) left matra
-;; (4) top matra
+;; (4) top matra
;; (5) preceding "r"
;; (6) anuswar
;; (7) following "r"
("\e$,15M5A\e(B" . "\e$,4 b"$\e(B")
("\e$,15M5B\e(B" . "\e$,4 b"$\e(B")
("\e$,16%\e(B" . "\\e$,4"L\e(B")
- ("\e$,15N\e(B" . "\e$,4 b"@\e(B")
- ("\e$,15N5A\e(B" . "\e$,4 b"@"&\e(B")
+ ("\e$,15N\e(B" . "\e$,4 b"@\e(B")
+ ("\e$,15N5A\e(B" . "\e$,4 b"@"&\e(B")
("\e$,16&\e(B" . "\\e$,4"@\e(B")
("\e$,16&5A\e(B" . "\\e$,4"@\e(B\\e$,4"&\e(B")
- ("\e$,15O\e(B" . "\e$,4 b\e(B")
+ ("\e$,15O\e(B" . "\e$,4 b\e(B")
("\e$,16'\e(B" . "\\e$,4"D\e(B")
("\e$,16'5A\e(B" . "\\e$,4"D\e(B\\e$,4"&\e(B")
- ("\e$,15P\e(B" . "\e$,4 b"D\e(B")
- ("\e$,15P5A\e(B" . "\e$,4 b"D"&\e(B")
+ ("\e$,15P\e(B" . "\e$,4 b"D\e(B")
+ ("\e$,15P5A\e(B" . "\e$,4 b"D"&\e(B")
("\e$,16(\e(B" . "\\e$,4"H\e(B")
("\e$,16(5A\e(B" . "\\e$,4"H\e(B\\e$,4"&\e(B")
("\e$,15Q\e(B" . "\e$,4 K")"L\e(B") ;; special rule for reodering.
("\e$,16)\e(B" . "\\e$,4")"L\e(B")
("\e$,16)5A\e(B" . "\\e$,4")"$\e(B")
("\e$,16)5B\e(B" . "\\e$,4")"$\e(B")
- ("\e$,15R\e(B" . "\e$,4 K")"@\e(B")
- ("\e$,15R5A\e(B" . "\e$,4 K")"@"&\e(B")
+ ("\e$,15R\e(B" . "\e$,4 K")"@\e(B")
+ ("\e$,15R5A\e(B" . "\e$,4 K")"@"&\e(B")
("\e$,16*\e(B" . "\\e$,4")"@\e(B")
("\e$,16*5A\e(B" . "\\e$,4")"@"&\e(B")
("\e$,15S\e(B" . "\e$,4 K")"D\e(B")
("\e$,15S5A\e(B" . "\e$,4 K")"D"&\e(B")
("\e$,16+\e(B" . "\\e$,4")"D\e(B")
("\e$,16+5A\e(B" . "\\e$,4")"D"&\e(B")
- ("\e$,15T\e(B" . "\e$,4 K")"H\e(B")
- ("\e$,15T5A\e(B" . "\e$,4 K")"H"&\e(B")
+ ("\e$,15T\e(B" . "\e$,4 K")"H\e(B")
+ ("\e$,15T5A\e(B" . "\e$,4 K")"H"&\e(B")
("\e$,16,\e(B" . "\\e$,4")"H\e(B")
("\e$,16,5A\e(B" . "\\e$,4")"H"&\e(B")
- ("\e$,16@\e(B" . "\e$,4 a"Q\e(B")
+ ("\e$,16@\e(B" . "\e$,4 a"Q\e(B")
;;("\e$,16B\e(B" . nil)
- ;;("\e$,16A\e(B" . nil)
+ ;;("\e$,16A\e(B" . nil)
;;("\e$,16C\e(B" . nil)
;; GRUTTALS
("\e$,15V6-5p\e(B" . "\e$,4 l")\e(B")
("\e$,15V6-5p6-\e(B" . "\e$,4 l\e(B")
- ("\e$,15W\e(B" . "\e$,4 m")\e(B")
- ("\e$,15W6-\e(B" . "\e$,4 m\e(B")
+ ("\e$,15W\e(B" . "\e$,4 m")\e(B")
+ ("\e$,15W6-\e(B" . "\e$,4 m\e(B")
("\e$,15W6-5p\e(B" . "\e$,4 o")\e(B")
("\e$,15W6-5p6-\e(B" . "\e$,4 o\e(B")
- ("\e$,15X\e(B" . "\e$,4 p")\e(B")
- ("\e$,15X6-\e(B" . "\e$,4 p\e(B")
- ("\e$,15X6-5p\e(B" . "\e$,4 q")\e(B")
- ("\e$,15X6-5p6-\e(B" . "\e$,4 q\e(B")
+ ("\e$,15X\e(B" . "\e$,4 p")\e(B")
+ ("\e$,15X6-\e(B" . "\e$,4 p\e(B")
+ ("\e$,15X6-5p\e(B" . "\e$,4 q")\e(B")
+ ("\e$,15X6-5p6-\e(B" . "\e$,4 q\e(B")
("\e$,15Y\e(B" . "\e$,4 r"S\e(B")
- ;; PALATALS
- ("\e$,15Z\e(B" . "\e$,4 s")\e(B")
- ("\e$,15Z6-\e(B" . "\e$,4 s\e(B")
- ("\e$,15Z6-5p\e(B" . "\e$,4 t")\e(B")
+ ;; PALATALS
+ ("\e$,15Z\e(B" . "\e$,4 s")\e(B")
+ ("\e$,15Z6-\e(B" . "\e$,4 s\e(B")
+ ("\e$,15Z6-5p\e(B" . "\e$,4 t")\e(B")
("\e$,15Z6-5p6-\e(B" . "\e$,4 t\e(B")
- ("\e$,15[\e(B" . "\e$,4 u"T\e(B")
+ ("\e$,15[\e(B" . "\e$,4 u"T\e(B")
- ("\e$,15\\e(B" . "\e$,4 v")\e(B")
- ("\e$,15\6-\e(B" . "\e$,4 v\e(B")
- ("\e$,15\6-5p\e(B" . "\e$,4 x")\e(B")
- ("\e$,15\6-5p6-\e(B" . "\e$,4 x\e(B")
- ("\e$,15\6-5^\e(B" . "\e$,4 y")\e(B")
- ("\e$,15\6-5^6-\e(B" . "\e$,4 y\e(B")
+ ("\e$,15\\e(B" . "\e$,4 v")\e(B")
+ ("\e$,15\6-\e(B" . "\e$,4 v\e(B")
+ ("\e$,15\6-5p\e(B" . "\e$,4 x")\e(B")
+ ("\e$,15\6-5p6-\e(B" . "\e$,4 x\e(B")
+ ("\e$,15\6-5^\e(B" . "\e$,4 y")\e(B")
+ ("\e$,15\6-5^6-\e(B" . "\e$,4 y\e(B")
- ("\e$,15]\e(B" . "\e$,4 z")\e(B")
- ("\e$,15]6-\e(B" . "\e$,4 z\e(B")
- ("\e$,15]6-5p\e(B" . "\e$,4 {")\e(B")
- ("\e$,15]6-5p6-\e(B" . "\e$,4 {\e(B")
+ ("\e$,15]\e(B" . "\e$,4 z")\e(B")
+ ("\e$,15]6-\e(B" . "\e$,4 z\e(B")
+ ("\e$,15]6-5p\e(B" . "\e$,4 {")\e(B")
+ ("\e$,15]6-5p6-\e(B" . "\e$,4 {\e(B")
("\e$,15^\e(B" . "\e$,4 |")\e(B")
("\e$,15^6-\e(B" . "\e$,4 |\e(B")
- ;; CEREBRALS
+ ;; CEREBRALS
("\e$,15_\e(B" . "\e$,4 }"U\e(B")
("\e$,15_6-5_\e(B" . "\e$,4 ~"U\e(B")
("\e$,15_6-5`\e(B" . "\e$,4 \7f"U\e(B")
- ("\e$,15`\e(B" . "\e$,4! "V\e(B")
- ("\e$,15`6-5`\e(B" . "\e$,4!!"V\e(B")
+ ("\e$,15`\e(B" . "\e$,4! "V\e(B")
+ ("\e$,15`6-5`\e(B" . "\e$,4!!"V\e(B")
- ("\e$,15a\e(B" . "\e$,4!""W\e(B")
- ("\e$,15a6-5a\e(B" . "\e$,4!$"W\e(B")
- ("\e$,15a6-5b\e(B" . "\e$,4!%"W\e(B")
+ ("\e$,15a\e(B" . "\e$,4!""W\e(B")
+ ("\e$,15a6-5a\e(B" . "\e$,4!$"W\e(B")
+ ("\e$,15a6-5b\e(B" . "\e$,4!%"W\e(B")
- ("\e$,15b\e(B" . "\e$,4!&"X\e(B")
+ ("\e$,15b\e(B" . "\e$,4!&"X\e(B")
("\e$,15c\e(B" . "\e$,4!(")\e(B")
("\e$,15c6-\e(B" . "\e$,4!(\e(B")
- ;; DENTALS
- ("\e$,15d\e(B" . "\e$,4!)")\e(B")
- ("\e$,15d6-\e(B" . "\e$,4!)\e(B")
- ("\e$,15d6-5p\e(B" . "\e$,4!*")\e(B")
- ("\e$,15d6-5p6-\e(B" . "\e$,4!*\e(B")
- ("\e$,15d6-5d\e(B" . "\e$,4!+")\e(B")
- ("\e$,15d6-5d6-\e(B" . "\e$,4!+\e(B")
-
- ("\e$,15e\e(B" . "\e$,4!,")\e(B")
- ("\e$,15e6-\e(B" . "\e$,4!,\e(B")
- ("\e$,15e6-5p\e(B" . "\e$,4!-")\e(B")
- ("\e$,15e6-5p6-\e(B" . "\e$,4!-\e(B")
-
- ("\e$,15f\e(B" . "\e$,4!."Y\e(B")
+ ;; DENTALS
+ ("\e$,15d\e(B" . "\e$,4!)")\e(B")
+ ("\e$,15d6-\e(B" . "\e$,4!)\e(B")
+ ("\e$,15d6-5p\e(B" . "\e$,4!*")\e(B")
+ ("\e$,15d6-5p6-\e(B" . "\e$,4!*\e(B")
+ ("\e$,15d6-5d\e(B" . "\e$,4!+")\e(B")
+ ("\e$,15d6-5d6-\e(B" . "\e$,4!+\e(B")
+
+ ("\e$,15e\e(B" . "\e$,4!,")\e(B")
+ ("\e$,15e6-\e(B" . "\e$,4!,\e(B")
+ ("\e$,15e6-5p\e(B" . "\e$,4!-")\e(B")
+ ("\e$,15e6-5p6-\e(B" . "\e$,4!-\e(B")
+
+ ("\e$,15f\e(B" . "\e$,4!."Y\e(B")
("\e$,15f6#\e(B" . "\e$,4!/"Y\e(B")
("\e$,15f6-5p\e(B" . "\e$,4!0"Y\e(B")
("\e$,15f6-5f\e(B" . "\e$,4!1"Y\e(B")
("\e$,15f6-5o\e(B" . "\e$,4!4\e(B")
("\e$,15f6-5u\e(B" . "\e$,4!5"Y\e(B")
- ("\e$,15g\e(B" . "\e$,4!6")\e(B")
- ("\e$,15g6-\e(B" . "\e$,4!6\e(B")
- ("\e$,15g6-5p\e(B" . "\e$,4!7")\e(B")
- ("\e$,15g6-5p6-\e(B" . "\e$,4!7\e(B")
+ ("\e$,15g\e(B" . "\e$,4!6")\e(B")
+ ("\e$,15g6-\e(B" . "\e$,4!6\e(B")
+ ("\e$,15g6-5p\e(B" . "\e$,4!7")\e(B")
+ ("\e$,15g6-5p6-\e(B" . "\e$,4!7\e(B")
- ("\e$,15h\e(B" . "\e$,4!8")\e(B")
- ("\e$,15h6-\e(B" . "\e$,4!8\e(B")
- ("\e$,15h6-5p\e(B" . "\e$,4!9")\e(B")
- ("\e$,15h6-5p6-\e(B" . "\e$,4!9")\e(B")
- ("\e$,15h6-5h\e(B" . "\e$,4!:")\e(B")
- ("\e$,15h6-5h6-\e(B" . "\e$,4!:\e(B")
+ ("\e$,15h\e(B" . "\e$,4!8")\e(B")
+ ("\e$,15h6-\e(B" . "\e$,4!8\e(B")
+ ("\e$,15h6-5p\e(B" . "\e$,4!9")\e(B")
+ ("\e$,15h6-5p6-\e(B" . "\e$,4!9")\e(B")
+ ("\e$,15h6-5h\e(B" . "\e$,4!:")\e(B")
+ ("\e$,15h6-5h6-\e(B" . "\e$,4!:\e(B")
("\e$,15i\e(B" . "\e$,4!8"#")\e(B")
- ;; LABIALS
- ("\e$,15j\e(B" . "\e$,4!;")\e(B")
- ("\e$,15j6-\e(B" . "\e$,4!;\e(B")
- ("\e$,15j6-5p\e(B" . "\e$,4!<")\e(B")
- ("\e$,15j6-5p6-\e(B" . "\e$,4!<\e(B")
-
- ("\e$,15k\e(B" . "\e$,4!a"[\e(B")
- ("\e$,15k6-\e(B" . "\e$,4!=\e(B")
- ("\e$,15k6-5p\e(B" . "\e$,4!c"[\e(B")
-
- ("\e$,15l\e(B" . "\e$,4!d")\e(B")
- ("\e$,15l6-\e(B" . "\e$,4!d\e(B")
- ("\e$,15l6-5p\e(B" . "\e$,4!e")\e(B")
- ("\e$,15l6-5p6-\e(B" . "\e$,4!e\e(B")
-
- ("\e$,15m\e(B" . "\e$,4!f")\e(B")
- ("\e$,15m6-\e(B" . "\e$,4!f\e(B")
- ("\e$,15m6-5p\e(B" . "\e$,4!g")\e(B")
- ("\e$,15m6-5p6-\e(B" . "\e$,4!g\e(B")
+ ;; LABIALS
+ ("\e$,15j\e(B" . "\e$,4!;")\e(B")
+ ("\e$,15j6-\e(B" . "\e$,4!;\e(B")
+ ("\e$,15j6-5p\e(B" . "\e$,4!<")\e(B")
+ ("\e$,15j6-5p6-\e(B" . "\e$,4!<\e(B")
+
+ ("\e$,15k\e(B" . "\e$,4!a"[\e(B")
+ ("\e$,15k6-\e(B" . "\e$,4!=\e(B")
+ ("\e$,15k6-5p\e(B" . "\e$,4!c"[\e(B")
+
+ ("\e$,15l\e(B" . "\e$,4!d")\e(B")
+ ("\e$,15l6-\e(B" . "\e$,4!d\e(B")
+ ("\e$,15l6-5p\e(B" . "\e$,4!e")\e(B")
+ ("\e$,15l6-5p6-\e(B" . "\e$,4!e\e(B")
+
+ ("\e$,15m\e(B" . "\e$,4!f")\e(B")
+ ("\e$,15m6-\e(B" . "\e$,4!f\e(B")
+ ("\e$,15m6-5p\e(B" . "\e$,4!g")\e(B")
+ ("\e$,15m6-5p6-\e(B" . "\e$,4!g\e(B")
("\e$,15n\e(B" . "\e$,4!h")\e(B")
("\e$,15n6-\e(B" . "\e$,4!h\e(B")
("\e$,15n6-5p\e(B" . "\e$,4!i")\e(B")
("\e$,15n6-5p6-\e(B" . "\e$,4!i\e(B")
;; SEMIVOWELS
- ("\e$,15o\e(B" . "\e$,4!j")\e(B")
- ("\e$,15o6-\e(B" . "\e$,4!j\e(B")
- ("\e$,15o6-5p\e(B" . "\e$,4!k")\e(B")
- ("\e$,15o6-5p6-\e(B" . "\e$,4!k\e(B")
+ ("\e$,15o\e(B" . "\e$,4!j")\e(B")
+ ("\e$,15o6-\e(B" . "\e$,4!j\e(B")
+ ("\e$,15o6-5p\e(B" . "\e$,4!k")\e(B")
+ ("\e$,15o6-5p6-\e(B" . "\e$,4!k\e(B")
("\e$,16-5o\e(B" . "\e$,4!l\e(B") ;; when every ohter lig. fails.
- ("\e$,15p\e(B" . "\e$,4!n"W\e(B")
+ ("\e$,15p\e(B" . "\e$,4!n"W\e(B")
;; ("\e$,15p6-\e(B" . "\\e$,4"'\e(B") ;; special case. only the topmost pos.
- ("\e$,15q\e(B" . "\e$,4!n"#"W\e(B")
+ ("\e$,15q\e(B" . "\e$,4!n"#"W\e(B")
("\e$,15q6-\e(B" . "\e$,4!m\e(B") ;; IS 13194 speical rule.
- ("\e$,15p6!\e(B" . "\e$,4!o"[\e(B")
- ("\e$,15p6"\e(B" . "\e$,4!p"\\e(B")
+ ("\e$,15p6!\e(B" . "\e$,4!o"[\e(B")
+ ("\e$,15p6"\e(B" . "\e$,4!p"\\e(B")
- ("\e$,15r\e(B" . "\e$,4!q")\e(B")
- ("\e$,15r6-\e(B" . "\e$,4!q\e(B")
- ("\e$,15s\e(B" . "\e$,4!s\e(B")
- ("\e$,15s6-\e(B" . "\e$,4!r\e(B")
+ ("\e$,15r\e(B" . "\e$,4!q")\e(B")
+ ("\e$,15r6-\e(B" . "\e$,4!q\e(B")
+ ("\e$,15s\e(B" . "\e$,4!s\e(B")
+ ("\e$,15s6-\e(B" . "\e$,4!r\e(B")
("\e$,15t\e(B" . "\e$,4!s"#\e(B")
("\e$,15t6-\e(B" . "\e$,4!r"#\e(B")
("\e$,15u6-\e(B" . "\e$,4!t\e(B")
("\e$,15u6-5p\e(B" . "\e$,4!u")\e(B")
("\e$,15u6-5p6-\e(B" . "\e$,4!u\e(B")
- ;; SIBILANTS
- ("\e$,15v\e(B" . "\e$,4!v")\e(B")
+ ;; SIBILANTS
+ ("\e$,15v\e(B" . "\e$,4!v")\e(B")
("\e$,15v6-\e(B" . "\e$,4!v\e(B")
("\e$,15v6-5u\e(B" . "\e$,4!w")\e(B")
("\e$,15v6-5u6-\e(B" . "\e$,4!w\e(B")
("\e$,15y6-5p\e(B" . "\e$,4!\7f\e(B")
("\e$,15y6-5n\e(B" . "\e$,4" \e(B")
("\e$,15y6-5o\e(B" . "\e$,4"!\e(B")
- ;; NUKTAS
+ ;; NUKTAS
("\e$,168\e(B" . "\e$,4 f"R"S\e(B")
- ("\e$,1686-\e(B" . "\e$,4 d\e(B")
- ("\e$,169\e(B" . "\e$,4 k")\e(B")
- ("\e$,1696-\e(B" . "\e$,4 k\e(B")
- ("\e$,16:\e(B" . "\e$,4 n")\e(B")
- ("\e$,16:6-\e(B" . "\e$,4 n\e(B")
- ("\e$,16;\e(B" . "\e$,4 w")\e(B")
- ("\e$,16;6-\e(B" . "\e$,4 w\e(B")
- ("\e$,16<\e(B" . "\e$,4!#"W\e(B")
- ("\e$,16=\e(B" . "\e$,4!'"X\e(B")
- ("\e$,16>\e(B" . "\e$,4!b"[\e(B")
- ("\e$,16>6-\e(B" . "\e$,4!>\e(B")
+ ("\e$,1686-\e(B" . "\e$,4 d\e(B")
+ ("\e$,169\e(B" . "\e$,4 k")\e(B")
+ ("\e$,1696-\e(B" . "\e$,4 k\e(B")
+ ("\e$,16:\e(B" . "\e$,4 n")\e(B")
+ ("\e$,16:6-\e(B" . "\e$,4 n\e(B")
+ ("\e$,16;\e(B" . "\e$,4 w")\e(B")
+ ("\e$,16;6-\e(B" . "\e$,4 w\e(B")
+ ("\e$,16<\e(B" . "\e$,4!#"W\e(B")
+ ("\e$,16=\e(B" . "\e$,4!'"X\e(B")
+ ("\e$,16>\e(B" . "\e$,4!b"[\e(B")
+ ("\e$,16>6-\e(B" . "\e$,4!>\e(B")
("\e$,16?\e(B" . "\e$,4!j"#")\e(B")
;; misc modifiers.
("\e$,15A\e(B" . "\\e$,4"$\e(B")
- ("\e$,15B\e(B" . "\\e$,4"&\e(B")
+ ("\e$,15B\e(B" . "\\e$,4"&\e(B")
("\e$,15C\e(B" . "\e$,4 F\e(B")
("\e$,15|\e(B" . "\e$,4"#\e(B")
("\e$,15}\e(B" . "\e$,4 E\e(B")
("\e$,16-\e(B" . "\e$,4""\e(B")
("\e$,16-5p\e(B" . "\e$,4"%\e(B") ;; following "r"
- ;; ("\e$,160\e(B" . "\e$,4 D\e(B")
+ ;; ("\e$,160\e(B" . "\e$,4 D\e(B")
;; ("\e$,16D\e(B" . "\e$,4 J\e(B")
- ;; ("\e$,16F\e(B" . "")
- ;; ("\e$,16G\e(B" . "")
- ;; ("\e$,16H\e(B" . "")
- ;; ("\e$,16I\e(B" . "")
- ;; ("\e$,16J\e(B" . "")
- ;; ("\e$,16K\e(B" . "")
- ;; ("\e$,16L\e(B" . "")
- ;; ("\e$,16M\e(B" . "")
- ;; ("\e$,16N\e(B" . "")
+ ;; ("\e$,16F\e(B" . "")
+ ;; ("\e$,16G\e(B" . "")
+ ;; ("\e$,16H\e(B" . "")
+ ;; ("\e$,16I\e(B" . "")
+ ;; ("\e$,16J\e(B" . "")
+ ;; ("\e$,16K\e(B" . "")
+ ;; ("\e$,16L\e(B" . "")
+ ;; ("\e$,16M\e(B" . "")
+ ;; ("\e$,16N\e(B" . "")
;; ("\e$,16O\e(B" . "")
)
- "Devanagari characters to glyphs conversion table.
+ "Devanagari characters to glyphs conversion table.
Default value contains only the basic rules. You may add your own
preferred rule from the sanskrit fonts." )
(devanagari-regexp-of-hashtbl-keys dev-char-glyph-hash))
;; glyph-to-glyph conversion table.
-;; it is supposed that glyphs are ordered in
+;; it is supposed that glyphs are ordered in
;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar].
(defvar dev-glyph-glyph
(defun dev-charseq (from &optional to)
(if (null to) (setq to from))
- (mapcar (function (lambda (x) (indian-glyph-char x 'devanagari)))
- (devanagari-range from to)))
+ (devanagari-range (make-char 'devanagari-glyph from)
+ (make-char 'devanagari-glyph to)))
(defvar dev-glyph-cvn
- (append
+ (append
(dev-charseq #x2b)
(dev-charseq #x3c #xc1)
(dev-charseq #xc3))
"Devanagari Spacing Glyphs")
(defvar dev-glyph-right-modifier
- (append
+ (append
(dev-charseq #xc9)
(dev-charseq #xd2 #xd5))
"Devanagari Modifiers attached at the right side.")
"Devanagari Matras attached at the top side.")
(defvar dev-glyph-bottom-modifier
- (append
+ (append
(dev-charseq #xd6 #xdf)
(dev-charseq #xc2))
"Devanagari Modifiers attached at the bottom.")
(,(dev-charseq #xc5) . 7)
(,dev-glyph-bottom-modifier . 8)))
-(mapc
+(mapc
(function (lambda (x)
- (mapc
+ (mapc
(function (lambda (y)
(put-char-code-property y 'composition-order (cdr x))))
(car x))))
(defun devanagari-compose-syllable-region (from to)
"Compose devanagari syllable in region FROM to TO."
(let ((glyph-str nil) (cons-num 0) glyph-str-list
- (last-halant nil) (preceding-r nil) (last-modifier nil)
- (last-char (char-before to)) match-str
- glyph-block split-pos)
+ (last-halant nil) (preceding-r nil) (last-modifier nil)
+ (last-char (char-before to)) match-str
+ glyph-block split-pos)
(save-excursion
(save-restriction
- ;;; *** char-to-glyph conversion ***
- ;; Special rule 1. -- Last halant must be preserved.
- (if (eq last-char ?\e$,16-\e(B)
- (progn
- (setq last-halant t)
- (narrow-to-region from (1- to)))
- (narrow-to-region from to)
- ;; note if the last char is modifier.
- (if (or (eq last-char ?\e$,15A\e(B) (eq last-char ?\e$,15B\e(B))
- (setq last-modifier t)))
- (goto-char (point-min))
- ;; Special rule 2. -- preceding "r halant" must be modifier.
- (when (looking-at "\e$,15p6-\e(B.")
- (setq preceding-r t)
- (goto-char (+ 2 (point))))
- ;; translate the rest characters into glyphs
- (while (re-search-forward dev-char-glyph-regexp nil t)
- (setq match-str (match-string 0))
- (setq glyph-str
- (concat glyph-str
- (gethash match-str dev-char-glyph-hash)))
- ;; count the number of consonant-glyhs.
- (if (string-match devanagari-consonant match-str)
- (setq cons-num (1+ cons-num))))
- ;; preceding-r must be attached before the anuswar if exists.
- (if preceding-r
- (if last-modifier
- (setq glyph-str (concat (substring glyph-str 0 -1)
- "\e$,4"'\e(B" (substring glyph-str -1)))
- (setq glyph-str (concat glyph-str "\e$,4"'\e(B"))))
- (if last-halant (setq glyph-str (concat glyph-str "\e$,4""\e(B")))
- ;;; *** glyph-to-glyph conversion ***
- (when (string-match dev-glyph-glyph-regexp glyph-str)
- (setq glyph-str
- (replace-match (gethash (match-string 0 glyph-str)
- dev-glyph-glyph-hash)
- nil t glyph-str))
- (if (and (> cons-num 1)
- (string-match dev-glyph-glyph-2-regexp glyph-str))
- (setq glyph-str
- (replace-match (gethash (match-string 0 glyph-str)
- dev-glyph-glyph-2-hash)
- nil t glyph-str))))
- ;;; *** glyph reordering ***
- (while (setq split-pos (string-match "\e$,4""\e(B\\|.$" glyph-str))
- (setq glyph-block (substring glyph-str 0 (1+ split-pos)))
- (setq glyph-str (substring glyph-str (1+ split-pos)))
- (setq
- glyph-block
- (if (string-match dev-glyph-right-modifier-regexp glyph-block)
- (sort (string-to-list glyph-block)
- (function (lambda (x y)
- (< (get-char-code-property x 'composition-order)
- (get-char-code-property y 'composition-order)))))
- (sort (string-to-list glyph-block)
- (function (lambda (x y)
- (let ((xo (get-char-code-property x 'composition-order))
- (yo (get-char-code-property y 'composition-order)))
- (if (= xo 2) nil (if (= yo 2) t (< xo yo)))))))))
- (setq glyph-str-list (nconc glyph-str-list glyph-block)))
- ;; concatenate and attach reference-points.
- (setq glyph-str
- (cdr
- (apply
- 'nconc
- (mapcar
- (function (lambda (x)
- (list
- (or (get-char-code-property x 'reference-point)
- '(5 . 3) ;; default reference point.
- )
- x)))
- glyph-str-list))))))
+ ;;; *** char-to-glyph conversion ***
+ ;; Special rule 1. -- Last halant must be preserved.
+ (if (eq last-char ?\e$,16-\e(B)
+ (progn
+ (setq last-halant t)
+ (narrow-to-region from (1- to)))
+ (narrow-to-region from to)
+ ;; note if the last char is modifier.
+ (if (or (eq last-char ?\e$,15A\e(B) (eq last-char ?\e$,15B\e(B))
+ (setq last-modifier t)))
+ (goto-char (point-min))
+ ;; Special rule 2. -- preceding "r halant" must be modifier.
+ (when (looking-at "\e$,15p6-\e(B.")
+ (setq preceding-r t)
+ (goto-char (+ 2 (point))))
+ ;; translate the rest characters into glyphs
+ (while (re-search-forward dev-char-glyph-regexp nil t)
+ (setq match-str (match-string 0))
+ (setq glyph-str
+ (concat glyph-str
+ (gethash match-str dev-char-glyph-hash)))
+ ;; count the number of consonant-glyhs.
+ (if (string-match devanagari-consonant match-str)
+ (setq cons-num (1+ cons-num))))
+ ;; preceding-r must be attached before the anuswar if exists.
+ (if preceding-r
+ (if last-modifier
+ (setq glyph-str (concat (substring glyph-str 0 -1)
+ "\e$,4"'\e(B" (substring glyph-str -1)))
+ (setq glyph-str (concat glyph-str "\e$,4"'\e(B"))))
+ (if last-halant (setq glyph-str (concat glyph-str "\e$,4""\e(B")))
+ ;;; *** glyph-to-glyph conversion ***
+ (when (string-match dev-glyph-glyph-regexp glyph-str)
+ (setq glyph-str
+ (replace-match (gethash (match-string 0 glyph-str)
+ dev-glyph-glyph-hash)
+ nil t glyph-str))
+ (if (and (> cons-num 1)
+ (string-match dev-glyph-glyph-2-regexp glyph-str))
+ (setq glyph-str
+ (replace-match (gethash (match-string 0 glyph-str)
+ dev-glyph-glyph-2-hash)
+ nil t glyph-str))))
+ ;;; *** glyph reordering ***
+ (while (setq split-pos (string-match "\e$,4""\e(B\\|.$" glyph-str))
+ (setq glyph-block (substring glyph-str 0 (1+ split-pos)))
+ (setq glyph-str (substring glyph-str (1+ split-pos)))
+ (setq
+ glyph-block
+ (if (string-match dev-glyph-right-modifier-regexp glyph-block)
+ (sort (string-to-list glyph-block)
+ (function (lambda (x y)
+ (< (get-char-code-property x 'composition-order)
+ (get-char-code-property y 'composition-order)))))
+ (sort (string-to-list glyph-block)
+ (function (lambda (x y)
+ (let ((xo (get-char-code-property x 'composition-order))
+ (yo (get-char-code-property y 'composition-order)))
+ (if (= xo 2) nil (if (= yo 2) t (< xo yo)))))))))
+ (setq glyph-str-list (nconc glyph-str-list glyph-block)))
+ ;; concatenate and attach reference-points.
+ (setq glyph-str
+ (cdr
+ (apply
+ 'nconc
+ (mapcar
+ (function (lambda (x)
+ (list
+ (or (get-char-code-property x 'reference-point)
+ '(5 . 3) ;; default reference point.
+ )
+ x)))
+ glyph-str-list))))))
(compose-region from to glyph-str)))
(provide 'devan-util)