[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to mlm-util.el
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] Changes to mlm-util.el |
Date: |
Fri, 22 Feb 2008 02:48:42 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kenichi Handa <handa> 08/02/22 02:48:41
Index: mlm-util.el
===================================================================
RCS file: mlm-util.el
diff -N mlm-util.el
--- mlm-util.el 1 Feb 2008 16:01:01 -0000 1.13
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,422 +0,0 @@
-;;; mlm-util.el --- support for composing malayalam characters -*-coding:
iso-2022-7bit;-*-
-
-;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
-;; Free Software Foundation, Inc.
-
-;; Maintainer: KAWABATA, Taichi <address@hidden>
-;; Keywords: multilingual, Malayalam
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;; Created: Feb. 11. 2003
-
-;;; Commentary:
-
-;; This file provides character(Unicode) to glyph(CDAC) conversion and
-;; composition of Malayalam script characters.
-
-;;; Code:
-
-;; Malayalam Composable Pattern
-;; C .. Consonants
-;; V .. Vowel
-;; H .. Halant
-;; M .. Matra
-;; V .. Vowel
-;; A .. Anuswar
-;; D .. Chandrabindu
-;; (N .. Zerowidth Non Joiner)
-;; (J .. Zerowidth Joiner. )
-;; 1. vowel
-;; V(A|visargam)?
-;; 2. syllable : maximum of 5 consecutive consonants. (e.g. kartsnya)
-;; ((CH)?(CH)?(CH)?CH)?C(H|M?(A|D)?)?
-
-(defconst malayalam-consonant
- "[$,address@hidden(B-$,address@hidden(B]")
-
-(defconst malayalam-composable-pattern
- (concat
-
"\\([$,address@hidden(B-$,address@hidden(B][$,1@"(B]?\\)\\|$,address@hidden(B"
- "\\|\\("
-
"\\(?:\\(?:[$,address@hidden(B-$,address@hidden(B]$,address@hidden(B\\)?\\(?:[$,address@hidden(B-$,address@hidden(B]$,address@hidden(B\\)?\\(?:[$,address@hidden(B-$,address@hidden(B]$,address@hidden(B\\)?[$,address@hidden(B-$,address@hidden(B]$,address@hidden(B\\)?"
-
"[$,address@hidden(B-$,address@hidden(B]\\(?:$,address@hidden(B\\|[$,address@hidden(B-$,address@hidden@address@hidden@address@hidden@address@hidden@l(B]?[$,1@"@m(B]?\\)?"
- "\\)")
- "Regexp matching a composable sequence of Malayalam characters.")
-
-;;;###autoload
-(defun malayalam-compose-region (from to)
- (interactive "r")
- (save-excursion
- (save-restriction
- (narrow-to-region from to)
- (goto-char (point-min))
- (while (re-search-forward malayalam-composable-pattern nil t)
- (malayalam-compose-syllable-region (match-beginning 0)
- (match-end 0))))))
-(defun malayalam-compose-string (string)
- (with-temp-buffer
- (insert (decompose-string string))
- (malayalam-compose-region (point-min) (point-max))
- (buffer-string)))
-
-;;;###autoload
-(defun malayalam-post-read-conversion (len)
- (save-excursion
- (save-restriction
- (let ((buffer-modified-p (buffer-modified-p)))
- (narrow-to-region (point) (+ (point) len))
- (malayalam-compose-region (point-min) (point-max))
- (set-buffer-modified-p buffer-modified-p)
- (- (point-max) (point-min))))))
-
-(defun malayalam-range (from to)
- "Make the list of the integers of range FROM to TO."
- (let (result)
- (while (<= from to) (setq result (cons to result) to (1- to))) result))
-
-(defun malayalam-regexp-of-hashtbl-keys (hashtbl)
- "Return a regular expression that matches all keys in hashtable HASHTBL."
- (let ((max-specpdl-size 1000))
- (regexp-opt
- (sort
- (let (dummy)
- (maphash (function (lambda (key val) (setq dummy (cons key dummy))))
hashtbl)
- dummy)
- (function (lambda (x y) (> (length x) (length y))))))))
-
-
-;;;###autoload
-(defun malayalam-composition-function (pos &optional string)
- "Compose Malayalam characters after the position POS.
-If STRING is not nil, it is a string, and POS is an index to the string.
-In this case, compose characters after POS of the string."
- (if string
- (if auto-compose-current-font
- (if (eq (string-match "[$,1@ (B-$,1A?(B]+" pos) pos)
- (or (font-shape-text 0 (match-end 0) auto-compose-current-font
- string)
- pos)))
- (goto-char pos)
- (if auto-compose-current-font
- (if (looking-at "[$,1@ (B-$,1A?(B]+")
- (or (font-shape-text pos (match-end 0) auto-compose-current-font)
- pos)
- (if (looking-at malayalam-composable-pattern)
- (prog1 (match-end 0)
- (malayalam-compose-syllable-region pos (match-end 0))))))))
-
-;; Notes on conversion steps.
-
-;; 1. chars to glyphs
-;;
-;; Simple replacement of characters to glyphs is done.
-
-;; 2. glyphs reordering.
-;;
-;; Two special reordering rule takes place.
-;; a. following "$,46[(B" goes to the front.
-;; b. following "$,46S6S(B", "$,46S(B" or "$,46T(B" goes to the front.
-;; This reordering occurs only to the last cluster of consonants.
-;; Preceding consonants with halant characters are not affected.
-
-;; 3. Composition.
-;;
-;; left modifiers will be attached at the left.
-;; others will be attached right.
-
-(defvar mlm-char-glyph
- '(;; various signs
- ("$,1@"(B" . "$,46W(B")
- ("$,address@hidden(B" . "$,46X(B")
- ;; Independent Vowels
- ("$,address@hidden(B" . "$,46!(B")
- ("$,1@&(B" . "$,46"(B")
- ("$,1@'(B" . "$,46#(B")
- ("$,1@((B" . "$,46#6U(B")
- ("$,1@)(B" . "$,46$(B")
- ("$,address@hidden(B" . "$,46$6U(B")
- ("$,address@hidden(B" . "$,46%(B")
- ("$,1@,(B" . "nil") ;; not in present use, not supported.
- ("$,address@hidden(B" . "$,46&(B")
- ("$,1@/(B" . "$,46'(B")
- ("$,address@hidden(B" . "$,46S6&(B")
- ("$,address@hidden(B" . "$,46((B")
- ("$,address@hidden(B" . "$,46(6M(B")
- ("$,address@hidden(B" . "$,46(6U(B")
- ;; Consonants
- ("$,address@hidden(B" . "$,46)(B")
- ("$,address@hidden@address@hidden(B" . "$,47!(B")
- ("$,address@hidden@address@hidden(B" . "$,47"(B")
- ("$,address@hidden@address@hidden(B" . "$,47#(B")
- ("$,address@hidden@address@hidden(B" . "$,47N(B")
- ("$,address@hidden@address@hidden(B" . "$,47`(B")
- ("$,address@hidden@a(B" . "$,47f(B")
- ("$,address@hidden@address@hidden@a(B" . "$,47g(B")
- ("$,address@hidden@a(B" . "$,47f(B")
- ("$,address@hidden@address@hidden@a(B" . "$,47g(B")
-
- ("$,address@hidden(B" . "$,46*(B")
-
- ("$,address@hidden(B" . "$,46+(B")
- ("$,address@hidden@address@hidden(B" . "$,47$(B")
- ("$,address@hidden@address@hidden(B" . "$,47%(B")
- ("$,address@hidden@address@hidden(B" . "$,47\(B")
- ("$,address@hidden@address@hidden(B" . "$,47a(B")
-
- ("$,address@hidden(B" . "$,46,(B")
-
- ("$,address@hidden(B" . "$,46-(B")
- ("$,address@hidden@address@hidden(B" . "$,47&(B")
- ("$,address@hidden@address@hidden(B" . "$,47'(B")
- ("$,address@hidden@address@hidden@a(B" . "$,47h(B")
-
- ("$,1@:(B" . "$,46.(B")
- ("$,1@:@m@:(B" . "$,47((B") ;; duplicate
- ("$,1@:@m@;(B" . "$,47Q(B")
-
- ("$,1@;(B" . "$,46/(B")
-
- ("$,1@<(B" . "$,460(B")
- ("$,1@<@m@<(B" . "$,47V(B")
- ("$,1@<@m@>(B" . "$,47Z(B")
-
- ("$,address@hidden(B" . "$,461(B")
-
- ("$,1@>(B" . "$,462(B")
- ("$,1@>@m@:(B" . "$,47)(B")
- ("$,1@>@m@>(B" . "$,47*(B")
-
- ("$,address@hidden(B" . "$,463(B")
- ("$,address@hidden@address@hidden(B" . "$,47+(B")
-
- ("$,1@@(B" . "$,464(B")
- ("$,address@hidden(B" . "$,465(B")
- ("$,address@hidden@address@hidden(B" . "$,47M(B")
- ("$,address@hidden(B" . "$,466(B")
-
- ("$,address@hidden(B" . "$,467(B")
- ("$,address@hidden@address@hidden(B" . "$,47,(B") ;; half consonant
- ("$,address@hidden@address@hidden(B" . "$,47-(B")
- ("$,address@hidden@address@hidden(B" . "$,47.(B")
- ("$,address@hidden@address@hidden(B" . "$,47W(B")
- ("$,address@hidden@address@hidden(B" . "$,47^(B")
- ("$,address@hidden@a(B" . "$,47i(B")
-
- ("$,address@hidden(B" . "$,468(B")
- ("$,address@hidden@address@hidden(B" . "$,47/(B")
- ("$,address@hidden@address@hidden(B" . "$,470(B")
- ("$,address@hidden@address@hidden(B" . "$,47U(B")
- ("$,address@hidden@address@hidden(B" . "$,47[(B")
- ("$,address@hidden@address@hidden(B" . "$,47_(B")
-
- ("$,address@hidden(B" . "$,469(B")
-
- ("$,address@hidden(B" . "$,46:(B")
- ("$,address@hidden@address@hidden(B" . "$,471(B")
- ("$,address@hidden@address@hidden(B" . "$,472(B")
-
- ("$,address@hidden(B" . "$,46;(B")
-
- ("$,address@hidden(B" . "$,46<(B")
- ("$,address@hidden@address@hidden(B" . "$,473(B") ;; half consonant
- ("$,address@hidden@address@hidden(B" . "$,474(B")
- ("$,address@hidden@address@hidden(B" . "$,475(B")
- ("$,address@hidden@address@hidden(B" . "$,476(B")
- ("$,address@hidden@address@hidden(B" . "$,477(B")
- ("$,address@hidden@address@hidden(B" . "$,47T(B")
- ("$,address@hidden@address@hidden(B" . "$,47Y(B")
- ("$,address@hidden@address@hidden(B" . "$,47b(B")
- ("$,address@hidden@a(B" . "$,47k(B")
- ("$,address@hidden@address@hidden@a(B" . "$,47l(B")
-
- ("$,address@hidden(B" . "$,46=(B")
- ("$,address@hidden@address@hidden(B" . "$,478(B") ;; duplicate
- ("$,address@hidden@address@hidden(B" . "$,479(B") ;; lakar
-
- ("$,address@hidden(B" . "$,46>(B")
-
- ("$,address@hidden(B" . "$,46?(B")
- ("$,address@hidden@address@hidden(B" . "$,47:(B") ;; duplicate
- ("$,address@hidden@address@hidden(B" . "$,47;(B") ;; lakar
- ("$,address@hidden@address@hidden(B" . "$,47O(B")
- ("$,address@hidden@address@hidden(B" . "$,47P(B")
-
- ("$,address@hidden(B" . "$,address@hidden(B")
-
- ("$,address@hidden(B" . "$,46A(B")
- ("$,address@hidden@address@hidden(B" . "$,47<(B")
- ("$,address@hidden@address@hidden(B" . "$,47=(B")
- ("$,address@hidden@address@hidden(B" . "$,47>(B") ;; lakar
-
- ("$,address@hidden(B" . "$,46B(B")
- ("$,address@hidden@address@hidden(B" . "$,47?(B") ;; duplicate
- ("$,address@hidden@address@hidden@address@hidden(B" . "$,47m(B")
-
- ("$,address@hidden(B" . "$,46C(B")
- ("$,address@hidden@address@hidden(B" . "$,address@hidden(B")
- ("$,address@hidden@a(B" . "$,47j(B")
-
- ("$,address@hidden(B" . "$,46D(B")
- ("$,address@hidden@m(B" . "$,address@hidden(B") ;; same glyph as
"$,address@hidden@m(B"
- ("$,address@hidden@address@hidden(B" . "$,address@hidden(B") ;; same
glyph as "$,address@hidden@m(B"
- ;;("$,address@hidden@address@hidden(B" . "$,47A(B")
- ("$,address@hidden@address@hidden(B" . "$,47d(B")
-
- ("$,address@hidden(B" . "$,46E(B")
- ("$,address@hidden@address@hidden(B" . "$,47B(B")
- ("$,address@hidden@address@hidden(B" . "$,47C(B") ;; lakar
- ("$,address@hidden@address@hidden(B" . "$,47e(B")
-
- ("$,address@hidden(B" . "$,46F(B")
- ("$,address@hidden@address@hidden(B" . "$,47D(B")
- ("$,address@hidden@address@hidden(B" . "$,47E(B")
-
- ("$,address@hidden(B" . "$,46G(B")
-
- ("$,address@hidden(B" . "$,46H(B")
- ("$,address@hidden@address@hidden(B" . "$,47F(B")
-
- ("$,address@hidden(B" . "$,46I(B")
- ("$,address@hidden@address@hidden(B" . "$,47G(B")
- ("$,address@hidden@address@hidden(B" . "$,47H(B")
- ("$,address@hidden@m@:(B" . "$,47](B")
-
- ("$,address@hidden(B" . "$,46J(B")
- ("$,address@hidden@address@hidden(B" . "$,47c(B")
-
- ("$,address@hidden(B" . "$,46K(B")
- ("$,address@hidden@address@hidden(B" . "$,47I(B")
- ("$,address@hidden@address@hidden(B" . "$,47J(B")
- ("$,address@hidden@address@hidden@address@hidden(B" . "$,47L(B")
- ("$,address@hidden@address@hidden(B" . "$,47X(B")
-
- ("$,address@hidden(B" . "$,46L(B")
- ("$,address@hidden@address@hidden(B" . "$,47K(B")
- ("$,address@hidden@address@hidden(B" . "$,47R(B")
- ("$,address@hidden@address@hidden(B" . "$,47S(B")
-
- ;; Dependent vowel signs
- ("$,address@hidden(B" . "$,46M(B")
- ("$,address@hidden(B" . "$,46N(B")
- ("$,address@hidden(B" . "$,46O(B")
- ("$,address@hidden(B" . "$,46P(B")
- ("$,address@hidden(B" . "$,46Q(B")
- ("$,address@hidden(B" . "$,46R(B")
- ("$,address@hidden(B" . "$,46S(B")
- ("$,address@hidden(B" . "$,46T(B")
- ("$,address@hidden(B" . "$,46S6S(B")
- ("$,address@hidden(B" . "$,46S6M(B")
- ("$,address@hidden(B" . "$,46T6M(B")
- ("$,address@hidden(B" . "$,46U(B")
- ;; Various signs
- ("$,address@hidden(B" . "$,46V(B")
- ("$,address@hidden@O(B" . "$,46Y(B") ;; yakar
- ("$,address@hidden@address@hidden(B" . "$,46\(B") ;; yakar + u
- ("$,address@hidden@address@hidden(B" . "$,46](B") ;; yakar + uu
- ("$,address@hidden@U(B" . "$,46Z(B") ;; vakar modifier
- ("$,address@hidden@P(B" . "$,46[(B") ;; rakar modifier is the same to
rra modifier.
- ("$,address@hidden@address@hidden(B" . "$,46R(B") ;; halant + rakar +
halant
- ("$,address@hidden@Q(B" . "$,46[(B") ;; rrakar modifier
- ("$,address@hidden@address@hidden(B" . "$,46R(B") ;; halant + rrakar +
halant
- ("$,address@hidden@m(B" . "$,46V(B") ;; double omission sign to stop
forming half consonant.
- ("$,address@hidden(B" . "$,46U(B") ;; not in present use, already at
0D4C.
- ))
-
-(defvar mlm-char-glyph-hash
- (let* ((hash (make-hash-table :test 'equal)))
- (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
- mlm-char-glyph)
- hash))
-
-(defvar mlm-char-glyph-regexp
- (malayalam-regexp-of-hashtbl-keys mlm-char-glyph-hash))
-
-;; Malayalam languages needed to be reordered in a complex mannar.
-
-(defvar mlm-consonants
- (concat
- "$,46)6*6+6,6-6.6/606162636465666768696:6;6<6=6>address@hidden(B"
-
"$,47!7"7#7$7%7&7'7(7)7*7+7,7-7.7/707172737475767778797:7;7<7=7>address@hidden(B"
- ))
-
-(defvar mlm-consonants-regexp
- (concat "\\($,46[(B?[" mlm-consonants "][$,46Y6Z(B]?\\)"))
-
-(defvar mlm-glyph-reorder-key-glyphs "[$,46[6S6T(B]")
-
-(defvar mlm-glyph-reordering-regexp-list
- `((,(concat "\\([" mlm-consonants "][$,46Y6Z(B]?\\)$,46[(B") .
"$,46[(B\\1")
- (,(concat mlm-consonants-regexp "$,46S6S(B") . "$,46S6S(B\\1")
- (,(concat mlm-consonants-regexp "$,46S(B") . "$,46S(B\\1")
- (,(concat mlm-consonants-regexp "$,46T(B") . "$,46T(B\\1")))
-
-(defun malayalam-compose-syllable-string (string)
- (with-temp-buffer
- (insert (decompose-string string))
- (malayalam-compose-syllable-region (point-min) (point-max))
- (buffer-string)))
-
-(defun malayalam-compose-syllable-region (from to)
- "Compose malayalam syllable in region FROM to TO."
- (let (glyph-str
- match-str
- glyph-reorder-regexps
- glyph-reorder-replace
- glyph-reorder-regexp)
- (save-excursion
- (save-restriction
- (narrow-to-region from to)
- (goto-char (point-min))
- ;; char-glyph-conversion
- (while (not (eobp))
- (if (looking-at mlm-char-glyph-regexp)
- (progn
- (setq match-str (match-string 0)
- glyph-str
- (concat glyph-str
- (gethash match-str mlm-char-glyph-hash)))
- (goto-char (match-end 0)))
- (setq glyph-str (concat glyph-str (string (following-char))))
- (forward-char 1)))
- (when (string-match mlm-glyph-reorder-key-glyphs glyph-str)
- ;; glyph reordering
- (setq glyph-reorder-regexps mlm-glyph-reordering-regexp-list)
- (while glyph-reorder-regexps
- (setq glyph-reorder-regexp (caar glyph-reorder-regexps))
- (setq glyph-reorder-replace (cdar glyph-reorder-regexps))
- (setq glyph-reorder-regexps (cdr glyph-reorder-regexps))
- (if (string-match glyph-reorder-regexp glyph-str)
- (setq glyph-str
- (replace-match glyph-reorder-replace nil nil
- glyph-str)))))
- ;; concatenate and attach reference-points.
- (setq glyph-str
- (cdr
- (apply
- 'nconc
- (mapcar
- (function
- (lambda (x) (list '(5 . 3) x))) ;; default ref. point.
- glyph-str))))
- (compose-region from to glyph-str)))))
-
-(provide 'mlm-util)
-
-;;; arch-tag: 7f25ee67-8f9d-49f2-837b-35c412c00eba
-;;; devan-util.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to mlm-util.el,
Kenichi Handa <=