;; Problem::
;; Can we generalize this methods to other Indian scripts?
-;;; (defvar dev-char-glyph
-;;; '(("\e$,15E\e(B" . "\e$,4 K\e(B")
-;;; ("\e$,15F\e(B" . "\e$,4 K")\e(B")
-;;; ("\e$,15~\e(B" . "\e$,4")\e(B")
-;;; ("\e$,15G\e(B" . "\e$,4 \\e(B")
-;;; ("\e$,15\7f\e(B" . "\e$,4"*\e(B")
-;;; ("\e$,15\7f5A\e(B" . "\e$,4"*\e(B\\e$,4"&\e(B")
-;;; ("\e$,15H\e(B" . "\e$,4 \"'\e(B")
-;;; ("\e$,15H5A\e(B" . "\e$,4 \"'"&\e(B")
-;;; ("\e$,16 \e(B" . "\e$,4"2\e(B")
-;;; ("\e$,16 5A\e(B" . "\e$,4"2"&\e(B")
-;;; ("\e$,15I\e(B" . "\e$,4 ]\e(B")
-;;; ("\e$,16!\e(B" . "\e$,4"6\e(B")
-;;; ("\e$,15J\e(B" . "\e$,4 ^"P\e(B")
-;;; ("\e$,16"\e(B" . "\e$,4":\e(B")
-;;; ("\e$,15K\e(B" . "\e$,4 `"Q\e(B")
-;;; ("\e$,16#\e(B" . "\e$,4">\e(B")
-;;; ;;("\e$,15L\e(B" . nil) ; not implemented.
-;;; ("\e$,16$\e(B" . "\e$,4"?\e(B")
-;;; ("\e$,15M\e(B" . "\e$,4 b"L\e(B")
-;;; ("\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$,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$,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$,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$,15Q5A\e(B" . "\e$,4 K")"$\e(B")
-;;; ("\e$,15Q5B\e(B" . "\e$,4 K")"$\e(B")
-;;; ("\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$,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$,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$,16B\e(B" . nil)
-;;; ;;("\e$,16A\e(B" . nil)
-;;; ;;("\e$,16C\e(B" . nil)
-
-;;; ;; GRUTTALS
-;;; ("\e$,15U\e(B" . "\e$,4 e"R\e(B")
-;;; ("\e$,15U6-\e(B" . "\e$,4 c\e(B")
-;;; ("\e$,15U6-5p\e(B" . "\e$,4 g"R\e(B")
-;;; ("\e$,15U6-5d\e(B" . "\e$,4 h"R\e(B")
-;;; ("\e$,15U6-5w\e(B" . "\e$,4 i")\e(B")
-;;; ("\e$,15U6-5w6-\e(B" . "\e$,4 i\e(B")
-
-;;; ("\e$,15V\e(B" . "\e$,4 j")\e(B")
-;;; ("\e$,15V6-\e(B" . "\e$,4 j\e(B")
-;;; ("\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$,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$,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")
-;;; ("\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 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 |")\e(B")
-;;; ("\e$,15^6-\e(B" . "\e$,4 |\e(B")
-;;; ;; 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$,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$,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")
-;;; ("\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-5g\e(B" . "\e$,4!2"Y\e(B")
-;;; ("\e$,15f6-5n\e(B" . "\e$,4!3\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$,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")
-
-;;; ("\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$,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$,15p6-\e(B" . "\\e$,4"'\e(B") ;; special case. only the topmost pos.
-;;; ("\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$,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$,15u\e(B" . "\e$,4!t")\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")
-;;; ("\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$,15v6-5p\e(B" . "\e$,4!x")\e(B")
-;;; ("\e$,15v6-5p6-\e(B" . "\e$,4!x\e(B")
-
-;;; ("\e$,15w\e(B" . "\e$,4!y")\e(B")
-;;; ("\e$,15w6-\e(B" . "\e$,4!y\e(B")
-;;; ("\e$,15x\e(B" . "\e$,4!z")\e(B")
-;;; ("\e$,15x6-\e(B" . "\e$,4!z\e(B")
-;;; ("\e$,15x6-5p\e(B" . "\e$,4!{")\e(B")
-;;; ("\e$,15x6-5p6-\e(B" . "\e$,4!{\e(B")
-
-;;; ("\e$,15y\e(B" . "\e$,4!}\e(B")
-;;; ("\e$,15y6-\e(B" . "\e$,4!|\e(B")
-;;; ("\e$,15y6#\e(B" . "\e$,4!~\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
-;;; ("\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$,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$,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$,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$,16O\e(B" . "")
-;;; )
-;;; "Devanagari characters to glyphs conversion table.
-;;; Default value contains only the basic rules. You may add your own
-;;; preferred rule from the sanskrit fonts." )
+(defvar dev-char-glyph
+ '(("\e$,15E\e(B" . "\e$,4 K\e(B")
+ ("\e$,15F\e(B" . "\e$,4 K")\e(B")
+ ("\e$,15~\e(B" . "\e$,4")\e(B")
+ ("\e$,15G\e(B" . "\e$,4 \\e(B")
+ ("\e$,15\7f\e(B" . "\e$,4"*\e(B")
+ ("\e$,15\7f5A\e(B" . "\e$,4"*\e(B\\e$,4"&\e(B")
+ ("\e$,15H\e(B" . "\e$,4 \"'\e(B")
+ ("\e$,15H5A\e(B" . "\e$,4 \"'"&\e(B")
+ ("\e$,16 \e(B" . "\e$,4"2\e(B")
+ ("\e$,16 5A\e(B" . "\e$,4"2"&\e(B")
+ ("\e$,15I\e(B" . "\e$,4 ]\e(B")
+ ("\e$,16!\e(B" . "\e$,4"6\e(B")
+ ("\e$,15J\e(B" . "\e$,4 ^"P\e(B")
+ ("\e$,16"\e(B" . "\e$,4":\e(B")
+ ("\e$,15K\e(B" . "\e$,4 `"Q\e(B")
+ ("\e$,16#\e(B" . "\e$,4">\e(B")
+ ;;("\e$,15L\e(B" . nil) ; not implemented.
+ ("\e$,16$\e(B" . "\e$,4"?\e(B")
+ ("\e$,15M\e(B" . "\e$,4 b"L\e(B")
+ ("\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$,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$,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$,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$,15Q5A\e(B" . "\e$,4 K")"$\e(B")
+ ("\e$,15Q5B\e(B" . "\e$,4 K")"$\e(B")
+ ("\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$,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$,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$,16B\e(B" . nil)
+ ;;("\e$,16A\e(B" . nil)
+ ;;("\e$,16C\e(B" . nil)
+
+ ;; GRUTTALS
+ ("\e$,15U\e(B" . "\e$,4 e"R\e(B")
+ ("\e$,15U6-\e(B" . "\e$,4 c\e(B")
+ ("\e$,15U6-5p\e(B" . "\e$,4 g"R\e(B")
+ ("\e$,15U6-5d\e(B" . "\e$,4 h"R\e(B")
+ ("\e$,15U6-5w\e(B" . "\e$,4 i")\e(B")
+ ("\e$,15U6-5w6-\e(B" . "\e$,4 i\e(B")
+
+ ("\e$,15V\e(B" . "\e$,4 j")\e(B")
+ ("\e$,15V6-\e(B" . "\e$,4 j\e(B")
+ ("\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$,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$,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")
+ ("\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 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 |")\e(B")
+ ("\e$,15^6-\e(B" . "\e$,4 |\e(B")
+ ;; 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$,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$,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")
+ ("\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-5g\e(B" . "\e$,4!2"Y\e(B")
+ ("\e$,15f6-5n\e(B" . "\e$,4!3\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$,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")
+
+ ("\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$,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$,15p6-\e(B" . "\\e$,4"'\e(B") ;; special case. only the topmost pos.
+ ("\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$,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$,15u\e(B" . "\e$,4!t")\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")
+ ("\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$,15v6-5p\e(B" . "\e$,4!x")\e(B")
+ ("\e$,15v6-5p6-\e(B" . "\e$,4!x\e(B")
+
+ ("\e$,15w\e(B" . "\e$,4!y")\e(B")
+ ("\e$,15w6-\e(B" . "\e$,4!y\e(B")
+ ("\e$,15x\e(B" . "\e$,4!z")\e(B")
+ ("\e$,15x6-\e(B" . "\e$,4!z\e(B")
+ ("\e$,15x6-5p\e(B" . "\e$,4!{")\e(B")
+ ("\e$,15x6-5p6-\e(B" . "\e$,4!{\e(B")
+
+ ("\e$,15y\e(B" . "\e$,4!}\e(B")
+ ("\e$,15y6-\e(B" . "\e$,4!|\e(B")
+ ("\e$,15y6#\e(B" . "\e$,4!~\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
+ ("\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$,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$,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$,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$,16O\e(B" . "")
+ )
+ "Devanagari characters to glyphs conversion table.
+Default value contains only the basic rules. You may add your own
+preferred rule from the sanskrit fonts." )
(defvar dev-char-glyph-hash
(let* ((hash (makehash 'equal)))
;; it is supposed that glyphs are ordered in
;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar].
-;;; (defvar dev-glyph-glyph
-;;; '(("\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"(\e(B")
-;;; ("\\e$,4"'\e(B\\e$,4"$\e(B" . "\\e$,4"(\e(B")
-;;; ("\e$,4"*\e(B\\e$,4"&\e(B" . "\e$,4"+\e(B")
-;;; ("\e$,4"*\e(B\\e$,4"'\e(B" . "\e$,4",\e(B")
-;;; ("\e$,4"*\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\e$,4"-\e(B")
-;;; ("\e$,4"2\e(B\\e$,4"&\e(B" . "\e$,4"3\e(B")
-;;; ("\e$,4"2\e(B\\e$,4"'\e(B" . "\e$,4"4\e(B")
-;;; ("\e$,4"2\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\e$,4"5\e(B")
-;;; ("\e$,4"#\e(B\\e$,4"6\e(B" . "\e$,4"7\e(B")
-;;; ("\e$,4"%\e(B\\e$,4"6\e(B" . "\e$,4"8\e(B")
-;;; ;;("\e$,4"6\e(B" . "\e$,4"9\e(B")
-;;; ("\e$,4"#\e(B\\e$,4":\e(B" . "\e$,4";\e(B")
-;;; ("\e$,4"%\e(B\\e$,4":\e(B" . "\e$,4"<\e(B")
-;;; ;;("\e$,4":\e(B" . "\e$,4"=\e(B")
-;;; ("\\e$,4"@\e(B\\e$,4"&\e(B" . "\\e$,4"A\e(B")
-;;; ("\\e$,4"@\e(B\\e$,4"'\e(B" . "\\e$,4"B\e(B")
-;;; ("\\e$,4"@\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"C\e(B")
-;;; ("\\e$,4"D\e(B\\e$,4"&\e(B" . "\\e$,4"E\e(B")
-;;; ("\\e$,4"D\e(B\\e$,4"'\e(B" . "\\e$,4"F\e(B")
-;;; ("\\e$,4"D\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"G\e(B")
-;;; ("\\e$,4"H\e(B\\e$,4"&\e(B" . "\\e$,4"I\e(B")
-;;; ("\\e$,4"H\e(B\\e$,4"'\e(B" . "\\e$,4"J\e(B")
-;;; ("\\e$,4"H\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"K\e(B")
-;;; ("\\e$,4"L\e(B\\e$,4"&\e(B" . "\\e$,4"M\e(B")
-;;; ("\\e$,4"L\e(B\\e$,4"'\e(B" . "\\e$,4"N\e(B")
-;;; ("\\e$,4"L\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"O\e(B")
-;;; ))
+(defvar dev-glyph-glyph
+ '(("\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"(\e(B")
+ ("\\e$,4"'\e(B\\e$,4"$\e(B" . "\\e$,4"(\e(B")
+ ("\e$,4"*\e(B\\e$,4"&\e(B" . "\e$,4"+\e(B")
+ ("\e$,4"*\e(B\\e$,4"'\e(B" . "\e$,4",\e(B")
+ ("\e$,4"*\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\e$,4"-\e(B")
+ ("\e$,4"2\e(B\\e$,4"&\e(B" . "\e$,4"3\e(B")
+ ("\e$,4"2\e(B\\e$,4"'\e(B" . "\e$,4"4\e(B")
+ ("\e$,4"2\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\e$,4"5\e(B")
+ ("\e$,4"#\e(B\\e$,4"6\e(B" . "\e$,4"7\e(B")
+ ("\e$,4"%\e(B\\e$,4"6\e(B" . "\e$,4"8\e(B")
+ ;;("\e$,4"6\e(B" . "\e$,4"9\e(B")
+ ("\e$,4"#\e(B\\e$,4":\e(B" . "\e$,4";\e(B")
+ ("\e$,4"%\e(B\\e$,4":\e(B" . "\e$,4"<\e(B")
+ ;;("\e$,4":\e(B" . "\e$,4"=\e(B")
+ ("\\e$,4"@\e(B\\e$,4"&\e(B" . "\\e$,4"A\e(B")
+ ("\\e$,4"@\e(B\\e$,4"'\e(B" . "\\e$,4"B\e(B")
+ ("\\e$,4"@\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"C\e(B")
+ ("\\e$,4"D\e(B\\e$,4"&\e(B" . "\\e$,4"E\e(B")
+ ("\\e$,4"D\e(B\\e$,4"'\e(B" . "\\e$,4"F\e(B")
+ ("\\e$,4"D\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"G\e(B")
+ ("\\e$,4"H\e(B\\e$,4"&\e(B" . "\\e$,4"I\e(B")
+ ("\\e$,4"H\e(B\\e$,4"'\e(B" . "\\e$,4"J\e(B")
+ ("\\e$,4"H\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"K\e(B")
+ ("\\e$,4"L\e(B\\e$,4"&\e(B" . "\\e$,4"M\e(B")
+ ("\\e$,4"L\e(B\\e$,4"'\e(B" . "\\e$,4"N\e(B")
+ ("\\e$,4"L\e(B\\e$,4"'\e(B\\e$,4"&\e(B" . "\\e$,4"O\e(B")
+ ))
(defvar dev-glyph-glyph-hash
(let* ((hash (makehash 'equal)))
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
;; yet another glyph-to-glyph conversions.
-;;; (defvar dev-glyph-glyph-2
-;;; '(("\e$,4"*\e(B" . "\e$,4".\e(B")
-;;; ("\e$,4"+\e(B" . "\e$,4"/\e(B")
-;;; ("\e$,4",\e(B" . "\e$,4"0\e(B")
-;;; ("\e$,4"-\e(B" . "\e$,4"1\e(B")))
+(defvar dev-glyph-glyph-2
+ '(("\e$,4"*\e(B" . "\e$,4".\e(B")
+ ("\e$,4"+\e(B" . "\e$,4"/\e(B")
+ ("\e$,4",\e(B" . "\e$,4"0\e(B")
+ ("\e$,4"-\e(B" . "\e$,4"1\e(B")))
(defvar dev-glyph-glyph-2-hash
(let* ((hash (makehash 'equal)))
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
(devanagari-compose-syllable-region (point-min) (point-max))
(buffer-string)))
-;;; (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)
-;;; (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))))))
-;;; (compose-region from to glyph-str)))
+(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)
+ (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))))))
+ (compose-region from to glyph-str)))
(provide 'devan-util)