mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-13 17:40:22 -08:00
(devanagari-post-read-conversion): Add autoload cookie.
This commit is contained in:
parent
2ccf3102d2
commit
51f54e7899
1 changed files with 77 additions and 76 deletions
|
|
@ -75,6 +75,7 @@
|
||||||
(devanagari-compose-region (point-min) (point-max))
|
(devanagari-compose-region (point-min) (point-max))
|
||||||
(buffer-string)))
|
(buffer-string)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
(defun devanagari-post-read-conversion (len)
|
(defun devanagari-post-read-conversion (len)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
|
|
@ -564,84 +565,84 @@ preferred rule from the sanskrit fonts." )
|
||||||
(defun devanagari-compose-syllable-region (from to)
|
(defun devanagari-compose-syllable-region (from to)
|
||||||
"Compose devanagari syllable in region FROM to TO."
|
"Compose devanagari syllable in region FROM to TO."
|
||||||
(let ((glyph-str nil) (cons-num 0) glyph-str-list
|
(let ((glyph-str nil) (cons-num 0) glyph-str-list
|
||||||
(last-halant nil) (preceding-r nil) (last-modifier nil)
|
(last-halant nil) (preceding-r nil) (last-modifier nil)
|
||||||
(last-char (char-before to)) match-str
|
(last-char (char-before to)) match-str
|
||||||
glyph-block split-pos)
|
glyph-block split-pos)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
;;; *** char-to-glyph conversion ***
|
;;; *** char-to-glyph conversion ***
|
||||||
;; Special rule 1. -- Last halant must be preserved.
|
;; Special rule 1. -- Last halant must be preserved.
|
||||||
(if (eq last-char ?$,16-(B)
|
(if (eq last-char ?$,16-(B)
|
||||||
(progn
|
(progn
|
||||||
(setq last-halant t)
|
(setq last-halant t)
|
||||||
(narrow-to-region from (1- to)))
|
(narrow-to-region from (1- to)))
|
||||||
(narrow-to-region from to)
|
(narrow-to-region from to)
|
||||||
;; note if the last char is modifier.
|
;; note if the last char is modifier.
|
||||||
(if (or (eq last-char ?$,15A(B) (eq last-char ?$,15B(B))
|
(if (or (eq last-char ?$,15A(B) (eq last-char ?$,15B(B))
|
||||||
(setq last-modifier t)))
|
(setq last-modifier t)))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
;; Special rule 2. -- preceding "r halant" must be modifier.
|
;; Special rule 2. -- preceding "r halant" must be modifier.
|
||||||
(when (looking-at "$,15p6-(B.")
|
(when (looking-at "$,15p6-(B.")
|
||||||
(setq preceding-r t)
|
(setq preceding-r t)
|
||||||
(goto-char (+ 2 (point))))
|
(goto-char (+ 2 (point))))
|
||||||
;; translate the rest characters into glyphs
|
;; translate the rest characters into glyphs
|
||||||
(while (re-search-forward dev-char-glyph-regexp nil t)
|
(while (re-search-forward dev-char-glyph-regexp nil t)
|
||||||
(setq match-str (match-string 0))
|
(setq match-str (match-string 0))
|
||||||
(setq glyph-str
|
(setq glyph-str
|
||||||
(concat glyph-str
|
(concat glyph-str
|
||||||
(gethash match-str dev-char-glyph-hash)))
|
(gethash match-str dev-char-glyph-hash)))
|
||||||
;; count the number of consonant-glyhs.
|
;; count the number of consonant-glyhs.
|
||||||
(if (string-match devanagari-consonant match-str)
|
(if (string-match devanagari-consonant match-str)
|
||||||
(setq cons-num (1+ cons-num))))
|
(setq cons-num (1+ cons-num))))
|
||||||
;; preceding-r must be attached before the anuswar if exists.
|
;; preceding-r must be attached before the anuswar if exists.
|
||||||
(if preceding-r
|
(if preceding-r
|
||||||
(if last-modifier
|
(if last-modifier
|
||||||
(setq glyph-str (concat (substring glyph-str 0 -1)
|
(setq glyph-str (concat (substring glyph-str 0 -1)
|
||||||
"$,4"'(B" (substring glyph-str -1)))
|
"$,4"'(B" (substring glyph-str -1)))
|
||||||
(setq glyph-str (concat glyph-str "$,4"'(B"))))
|
(setq glyph-str (concat glyph-str "$,4"'(B"))))
|
||||||
(if last-halant (setq glyph-str (concat glyph-str "$,4""(B")))
|
(if last-halant (setq glyph-str (concat glyph-str "$,4""(B")))
|
||||||
;;; *** glyph-to-glyph conversion ***
|
;;; *** glyph-to-glyph conversion ***
|
||||||
(when (string-match dev-glyph-glyph-regexp glyph-str)
|
(when (string-match dev-glyph-glyph-regexp glyph-str)
|
||||||
(setq glyph-str
|
(setq glyph-str
|
||||||
(replace-match (gethash (match-string 0 glyph-str)
|
(replace-match (gethash (match-string 0 glyph-str)
|
||||||
dev-glyph-glyph-hash)
|
dev-glyph-glyph-hash)
|
||||||
nil t glyph-str))
|
nil t glyph-str))
|
||||||
(if (and (> cons-num 1)
|
(if (and (> cons-num 1)
|
||||||
(string-match dev-glyph-glyph-2-regexp glyph-str))
|
(string-match dev-glyph-glyph-2-regexp glyph-str))
|
||||||
(setq glyph-str
|
(setq glyph-str
|
||||||
(replace-match (gethash (match-string 0 glyph-str)
|
(replace-match (gethash (match-string 0 glyph-str)
|
||||||
dev-glyph-glyph-2-hash)
|
dev-glyph-glyph-2-hash)
|
||||||
nil t glyph-str))))
|
nil t glyph-str))))
|
||||||
;;; *** glyph reordering ***
|
;;; *** glyph reordering ***
|
||||||
(while (setq split-pos (string-match "$,4""(B\\|.$" glyph-str))
|
(while (setq split-pos (string-match "$,4""(B\\|.$" glyph-str))
|
||||||
(setq glyph-block (substring glyph-str 0 (1+ split-pos)))
|
(setq glyph-block (substring glyph-str 0 (1+ split-pos)))
|
||||||
(setq glyph-str (substring glyph-str (1+ split-pos)))
|
(setq glyph-str (substring glyph-str (1+ split-pos)))
|
||||||
(setq
|
(setq
|
||||||
glyph-block
|
glyph-block
|
||||||
(if (string-match dev-glyph-right-modifier-regexp glyph-block)
|
(if (string-match dev-glyph-right-modifier-regexp glyph-block)
|
||||||
(sort (string-to-list glyph-block)
|
(sort (string-to-list glyph-block)
|
||||||
(function (lambda (x y)
|
(function (lambda (x y)
|
||||||
(< (get-char-code-property x 'composition-order)
|
(< (get-char-code-property x 'composition-order)
|
||||||
(get-char-code-property y 'composition-order)))))
|
(get-char-code-property y 'composition-order)))))
|
||||||
(sort (string-to-list glyph-block)
|
(sort (string-to-list glyph-block)
|
||||||
(function (lambda (x y)
|
(function (lambda (x y)
|
||||||
(let ((xo (get-char-code-property x 'composition-order))
|
(let ((xo (get-char-code-property x 'composition-order))
|
||||||
(yo (get-char-code-property y 'composition-order)))
|
(yo (get-char-code-property y 'composition-order)))
|
||||||
(if (= xo 2) nil (if (= yo 2) t (< xo yo)))))))))
|
(if (= xo 2) nil (if (= yo 2) t (< xo yo)))))))))
|
||||||
(setq glyph-str-list (nconc glyph-str-list glyph-block)))
|
(setq glyph-str-list (nconc glyph-str-list glyph-block)))
|
||||||
;; concatenate and attach reference-points.
|
;; concatenate and attach reference-points.
|
||||||
(setq glyph-str
|
(setq glyph-str
|
||||||
(cdr
|
(cdr
|
||||||
(apply
|
(apply
|
||||||
'nconc
|
'nconc
|
||||||
(mapcar
|
(mapcar
|
||||||
(function (lambda (x)
|
(function (lambda (x)
|
||||||
(list
|
(list
|
||||||
(or (get-char-code-property x 'reference-point)
|
(or (get-char-code-property x 'reference-point)
|
||||||
'(5 . 3) ;; default reference point.
|
'(5 . 3) ;; default reference point.
|
||||||
)
|
)
|
||||||
x)))
|
x)))
|
||||||
glyph-str-list))))))
|
glyph-str-list))))))
|
||||||
(compose-region from to glyph-str)))
|
(compose-region from to glyph-str)))
|
||||||
|
|
||||||
(provide 'devan-util)
|
(provide 'devan-util)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue