annotate lisp/language/knd-util.el @ 79734:cafbd43e54ad

Add 2008 to copyright years.
author Glenn Morris <rgm@gnu.org>
date Mon, 07 Jan 2008 08:17:02 +0000
parents b5d3fc1c4afe
children 606f2d163a64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
1 ;;; knd-util.el --- Support for composing Kannada characters
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2
79711
b5d3fc1c4afe Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
b5d3fc1c4afe Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
4 ;; Free Software Foundation, Inc.
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
5
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
6 ;; Maintainer: Maintainer: CHOWKSEY, Kailash C. <klchxbec@m-net.arbornet.org>
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
7 ;; Keywords: multilingual, Kannada
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
8
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
10
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
78236
9355f9b7bbff Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14 ;; any later version.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
20
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 53035
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 53035
diff changeset
24 ;; Boston, MA 02110-1301, USA.
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26 ;; Created: Jul. 14. 2003
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28 ;;; Commentary:
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 ;; This file provides character(Unicode) to glyph(CDAC) conversion and
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 ;; composition of Kannada script characters.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 ;;; Code:
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 ;;;###autoload
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37 ;; Kannada Composable Pattern
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 ;; C .. Consonants
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39 ;; V .. Vowel
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 ;; H .. Virama
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41 ;; M .. Matra
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
42 ;; V .. Vowel
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
43 ;; (N .. Zerowidth Non Joiner)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
44 ;; (J .. Zerowidth Joiner. )
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
45 ;; 1. vowel
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
46 ;; V(A)?
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47 ;; 2. syllable : maximum of 5 consecutive consonants. (e.g. kartsnya)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48 ;; ((CH)?(CH)?(CH)?CH)?C(H|M?)?
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
49
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
50 (defconst kannada-consonant
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
51 "[$,1>u(B-$,1?9(B]")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
52
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
53 (defconst kannada-consonant-needs-twirl
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
54 "[$,1>u>w(B-$,1>{>}(B-$,1>~? (B-$,1?"?$(B-$,1?+?-?0?3(B-$,1?9(B]\\($,1?M(B[$,1>u(B-$,1?9(B]\\)*[$,1?A?B?C?D>b(B]?$")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
55
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
56 (defconst kannada-composable-pattern
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
57 (concat
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
58 "\\([$,1>b(B-$,1>t?`>l(B]\\)\\|[$,1>c(B]"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
59 "\\|\\("
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 "\\(?:\\(?:[$,1>u(B-$,1?9(B]$,1?M(B\\)?\\(?:[$,1>u(B-$,1?9(B]$,1?M(B\\)?\\(?:[$,1>u(B-$,1?9(B]$,1?M(B\\)?[$,1>u(B-$,1?9(B]$,1?M(B\\)?"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61 "[$,1>u(B-$,1?9(B]\\(?:$,1?M(B\\|[$,1?>(B-$,1?M?U?C(B]?\\)?"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62 "\\)")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63 "Regexp matching a composable sequence of Kannada characters.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64
53035
edde52617580 (kannada-compose-region) (kannada-compose-string,
Kenichi Handa <handa@m17n.org>
parents: 53022
diff changeset
65 ;;;###autoload
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66 (defun kannada-compose-region (from to)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67 (interactive "r")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68 (save-excursion
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69 (save-restriction
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 (narrow-to-region from to)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 (goto-char (point-min))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 (while (re-search-forward kannada-composable-pattern nil t)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73 (kannada-compose-syllable-region (match-beginning 0)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74 (match-end 0))))))
53035
edde52617580 (kannada-compose-region) (kannada-compose-string,
Kenichi Handa <handa@m17n.org>
parents: 53022
diff changeset
75 ;;;###autoload
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
76 (defun kannada-compose-string (string)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
77 (with-temp-buffer
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
78 (insert (decompose-string string))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 (kannada-compose-region (point-min) (point-max))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80 (buffer-string)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81
53035
edde52617580 (kannada-compose-region) (kannada-compose-string,
Kenichi Handa <handa@m17n.org>
parents: 53022
diff changeset
82 ;;;###autoload
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83 (defun kannada-post-read-conversion (len)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 (save-excursion
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 (save-restriction
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86 (let ((buffer-modified-p (buffer-modified-p)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87 (narrow-to-region (point) (+ (point) len))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88 (kannada-compose-region (point-min) (point-max))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89 (set-buffer-modified-p buffer-modified-p)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90 (- (point-max) (point-min))))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92 (defun kannada-range (from to)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93 "Make the list of the integers of range FROM to TO."
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 (let (result)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 (while (<= from to) (setq result (cons to result) to (1- to))) result))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
96
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
97 (defun kannada-regexp-of-hashtbl-keys (hashtbl)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
98 "Return a regular expression that matches all keys in hashtable HASHTBL."
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
99 (let ((max-specpdl-size 1000))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 (regexp-opt
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
101 (sort
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
102 (let (dummy)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
103 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
104 dummy)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
105 (function (lambda (x y) (> (length x) (length y))))))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
106
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
107 (defun kannada-regexp-of-hashtbl-vals (hashtbl)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
108 "Return a regular expression that matches all values in hashtable HASHTBL."
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
109 (let ((max-specpdl-size 1000))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
110 (regexp-opt
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
111 (sort
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
112 (let (dummy)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
113 (maphash (function (lambda (key val) (setq dummy (cons val dummy)))) hashtbl)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
114 dummy)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
115 (function (lambda (x y) (> (length x) (length y))))))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
116
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
117 (defun kannada-composition-function (from to pattern &optional string)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
118 "Compose Kannada characters in REGION, or STRING if specified.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
119 Assume that the REGION or STRING must fully match the composable
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
120 PATTERN regexp."
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
121 (if string (kannada-compose-syllable-string string)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
122 (kannada-compose-syllable-region from to))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
123 (- to from))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
124
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
125 ;; Register a function to compose Kannada characters.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
126 (mapc
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
127 (function (lambda (ucs)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
128 (aset composition-function-table (decode-char 'ucs ucs)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129 (list (cons kannada-composable-pattern
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 'kannada-composition-function)))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
131 (kannada-range #x0c80 #x0cff))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133 ;; Notes on conversion steps.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135 ;; 1. chars to glyphs
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137 ;; Rules will not be applied to the virama appeared at the end of the
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 ;; text. Also, the preceding/following "r" will be treated as special case.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140 ;; 2. glyphs reordering.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
142 ;; The glyphs are split by virama, and each glyph groups are
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143 ;; re-ordered in the following order.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 ;; Note that `consonant-glyph' mentioned here does not contain the
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 ;; vertical bar (right modifier) attached at the right of the
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 ;; consonant.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 ;; If the glyph-group contains right modifier,
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150 ;; (1) consonant-glyphs/vowels
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 ;; (2) spacing
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152 ;; (3) right modifier (may be matra)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
153 ;; (4) top matra
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154 ;; (5) preceding "r"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155 ;; (7) following "r"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 ;; (8) bottom matra or virama.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158 ;; Otherwise,
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
159 ;; (1) consonant-glyph/vowels, with nukta sign
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160 ;; (3) left matra
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
161 ;; (4) top matra
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
162 ;; (5) preceding "r"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
163 ;; (7) following "r"
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
164 ;; (8) bottom matra or virama.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
165 ;; (2) spacing
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
166
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
167 ;; 3. glyph to glyph
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
168 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
169 ;; For better display, some glyph display would be tuned.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
170
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
171 ;; 4. Composition.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
172 ;;
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
173 ;; left modifiers will be attached at the left.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
174 ;; others will be attached right.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
175
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
176 ;; Problem::
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177 ;; Can we generalize this methods to other Indian scripts?
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
179 (defvar knd-char-glyph
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
180 '(("$,1>e(B" . "$,43@(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
181 ("$,1>f(B" . "$,43A(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
182 ("$,1?>(B" . "$,44{(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
183 ("$,1>g(B" . "$,43B(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
184 ("$,1??(B" . nil)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
185 ("$,1>h(B" . "$,43C(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
186 ("$,1?@(B" . nil)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187 ("$,1>i(B" . "$,43D(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188 ("$,1?A(B" . "\$,44(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189 ("$,1>j(B" . "$,43E(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
190 ("$,1?B(B" . "\$,45 (B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
191 ("$,1>k(B" . "$,43F4(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
192 ("$,1?C(B" . "\$,45$(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
193 ("$,1?`(B" . "$,43F5 (B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
194 ("$,1?D(B" . "\$,45%(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
195 ;;("$,1>l(B" . nil) ; not implemented.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
196 ;;("$,1?a(B" . nil)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197 ("$,1>n(B" . "$,43G(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
198 ("$,1>o(B" . "$,43H(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
199 ("$,1>p(B" . "$,43I(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
200 ("$,1?F(B" . "\$,45&(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
201 ("$,1?G(B" . "\$,45&4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
202 ("$,1?H(B" . "\$,45&5'(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
203 ("$,1>r(B" . "$,43J(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
204 ("$,1?J(B" . "$,45&5 (B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
205 ("$,1>s(B" . "$,43K(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
206 ("$,1?K(B" . "\$,45&5 4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
207 ("$,1>t(B" . "$,43L(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
208 ("$,1?L(B" . "\$,45((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
209 ("$,1>b(B" . "$,43M(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
210 ("$,1>c(B" . "$,43N(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211 ("$,1>u?M(B" . "$,43O5)(B") ("$,1>u(B" . "$,43O(B") ("$,1>u??(B" . "$,43P(B") ("$,1>u?@(B" . "$,43P4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
212 ("$,1>v?M(B" . "$,43S5)(B") ("$,1>v(B" . "$,43S(B") ("$,1>v??(B" . "$,43T(B") ("$,1>v?@(B" . "$,43T4~(B") ("$,1>v?F(B" . "$,43S5&(B") ("$,1>v?G(B" . "$,43S5&4~(B") ("$,1>v?H(B" . "$,43S5&5'(B") ("$,1>v?J(B" . "$,43S5&5&5 (B") ("$,1>v?K(B" . "$,43S5&5&5 4~(B") ("$,1>v?L(B" . "$,43S5((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
213 ("$,1>w?M(B" . "$,43V5)(B") ("$,1>w(B" . "$,43V(B") ("$,1>w??(B" . "$,43W(B") ("$,1>w?@(B" . "$,43W4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
214 ("$,1>x?M(B" . "$,43Y5)(B") ("$,1>x(B" . "$,43Y(B") ("$,1>x??(B" . "$,43Z(B") ("$,1>x?@(B" . "$,43Z4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
215 ("$,1>y?M(B" . "$,43\5)(B") ("$,1>y(B" . "$,43\(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
216 ("$,1>z?M(B" . "$,43^5)(B") ("$,1>z(B" . "$,43^(B") ("$,1>z??(B" . "$,43_(B") ("$,1>z?@(B" . "$,43_4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
217 ("$,1>{?M(B" . "$,43a5)(B") ("$,1>{(B" . "$,43a(B") ("$,1>{??(B" . "$,43b(B") ("$,1>{?@(B" . "$,43b4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
218 ("$,1>|?M(B" . "$,43d5)(B") ("$,1>|(B" . "$,43d(B") ("$,1>|??(B" . "$,43f(B") ("$,1>|?@(B" . "$,43f4~(B") ("$,1>|?F(B" . "$,43e5&(B") ("$,1>|?G(B" . "$,43e5&4~(B") ("$,1>|?H(B" . "$,43e5&5'(B") ("$,1>|?J(B" . "$,43e5&5&5 (B") ("$,1>|?K(B" . "$,43e5&5&5 4~(B") ("$,1>|?L(B" . "$,43e5((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
219 ("$,1>}?M(B" . "$,44a4z3h45)(B") ("$,1>}(B" . "$,44a4z3h4(B") ("$,1>}??(B" . "$,44b3h4(B") ("$,1>}?@(B" . "$,44b3h44~(B") ("$,1>}?B(B". "$,44a4z3h5 (B") ("$,1>}?J(B". "$,44a5&3h5 (B") ("$,1>}?K(B". "$,44a5&3h5 4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 ("$,1>~?M(B" . "$,43j5)(B") ("$,1>~(B" . "$,43j(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
221 ("$,1>?M(B" . "$,43m5)(B") ("$,1>(B" . "$,43l(B") ("$,1?#?>(B" . "$,43m4{(B") ("$,1>??(B" . "$,43n(B") ("$,1>?@(B" . "$,43n4~(B") ("$,1>?F(B" . "$,43m5&(B") ("$,1>?G(B" . "$,43m5&4~(B") ("$,1>?H(B" . "$,43m5&5'(B") ("$,1>?J(B" . "$,43m5&5&5 (B") ("$,1>?K(B" . "$,43m5&5&5 4~(B") ("$,1>?L(B" . "$,43m5((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
222 ("$,1? ?M(B" . "$,43p5)(B") ("$,1? (B" . "$,43p(B") ("$,1? ??(B" . "$,43q(B") ("$,1? ?@(B" . "$,43q4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
223 ("$,1?!?M(B" . "$,43s5)(B") ("$,1?!(B" . "$,43s(B") ("$,1?!??(B" . "$,43t(B") ("$,1?!?@(B" . "$,43t4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
224 ("$,1?"?M(B" . "$,43v5)(B") ("$,1?"(B" . "$,43v(B") ("$,1?"??(B" . "$,43w(B") ("$,1?"?@(B" . "$,43w4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
225 ("$,1?#?M(B" . "$,43z5)(B") ("$,1?#(B" . "$,43y(B") ("$,1?#?>(B" . "$,43z4{(B") ("$,1?#??(B" . "$,43{(B") ("$,1?#?@(B" . "$,43{4~(B") ("$,1?#?F(B" . "$,43z5&(B") ("$,1?#?G(B" . "$,43z5&4~(B") ("$,1?#?H(B" . "$,43z5&5'(B") ("$,1?#?J(B" . "$,43z5&5&5 (B") ("$,1?#?K(B" . "$,43z5&5&5 4~(B") ("$,1?#?L(B" . "$,43z5((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
226 ("$,1?$?M(B" . "$,43}5)(B") ("$,1?$(B" . "$,43}(B") ("$,1?$??(B" . "$,43~(B") ("$,1?$?@(B" . "$,43~4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
227 ("$,1?%?M(B" . "$,44B5)(B") ("$,1?%(B" . "$,44B(B") ("$,1?%??(B" . "$,44C(B") ("$,1?%?@(B" . "$,44C4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
228 ("$,1?&?M(B" . "$,44E5)(B") ("$,1?&(B" . "$,44E(B") ("$,1?&??(B" . "$,44F(B") ("$,1?&?@(B" . "$,44F4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
229 ("$,1?'?M(B" . "$,44H5)(B") ("$,1?'(B" . "$,44H(B") ("$,1?'??(B" . "$,44I(B") ("$,1?'?@(B" . "$,44I4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
230 ("$,1?(?M(B" . "$,44K5)(B") ("$,1?((B" . "$,44K(B") ("$,1?(??(B" . "$,44L(B") ("$,1?(?@(B" . "$,44L4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
231 ("$,1?*?M(B" . "$,44N5)(B") ("$,1?*(B" . "$,44N(B") ("$,1?*??(B" . "$,44O(B") ("$,1?*?@(B" . "$,44O4~(B") ("$,1?*?A(B" . "$,44N5"(B") ("$,1?*?B(B" . "$,44N5#(B") ("$,1?*?J(B" . "$,44N5&5#(B") ("$,1?*?K(B" . "$,44N5&5#4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
232 ("$,1?+?M(B" . "$,44Q5)(B") ("$,1?+(B" . "$,44Q(B") ("$,1?+??(B" . "$,44R(B") ("$,1?+?@(B" . "$,44R4~(B") ("$,1?+?A(B" . "$,44Q5"(B") ("$,1?+?B(B" . "$,44Q5#(B") ("$,1?+?J(B" . "$,44Q5&5#(B") ("$,1?+?K(B" . "$,44Q5&5#4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
233 ("$,1?,?M(B" . "$,44W5)(B") ("$,1?,(B" . "$,44V(B") ("$,1?,?>(B". "$,44W4{(B") ("$,1?,??(B" . "$,44X(B") ("$,1?,?@(B" . "$,44X4~(B") ("$,1?,?F(B" . "$,44W5&(B") ("$,1?,?G(B" . "$,44W5&4~(B") ("$,1?,?H(B" . "$,44W5&5'(B") ("$,1?,?J(B" . "$,44W5&5&5 (B") ("$,1?,?K(B" . "$,44W5&5&5 4~(B") ("$,1?,?L(B" . "$,44W5((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
234 ("$,1?-?M(B" . "$,44Z5)(B") ("$,1?-(B" . "$,44Z(B") ("$,1?-??(B" . "$,44[(B") ("$,1?-?@(B" . "$,44[4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
235 ("$,1?.?M(B" . "$,44h5!5)(B") ("$,1?.(B" . "$,44h4z4(B") ("$,1?.?>(B" . "$,44h4z5!4{(B") ("$,1?.??(B" . "$,44i4(B") ("$,1?.?@(B" . "$,44i44~(B") ("$,1?.?J(B". "$,44h5&5 (B") ("$,1?.?K(B". "$,44h5&5 4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
236 ("$,1?/?M(B" . "$,44^4z5!5)(B") ("$,1?/(B" . "$,44^4z4(B") ("$,1?/?>(B" . "$,44^4z5!4{(B")("$,1?/??(B" . "$,44_4(B") ("$,1?/?@(B" . "$,44_44~(B") ("$,1?/?J(B" . "$,44^5&5 (B") ("$,1?/?K(B" . "$,44^5&5 4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
237 ("$,1?0?M(B" . "$,44a5)(B") ("$,1?0(B" . "$,44a(B") ("$,1?0??(B" . "$,44b(B") ("$,1?0?@(B" . "$,44b4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
238 ("$,1?0?M(B" . "$,44a5)(B") ("$,1?0(B" . "$,44a(B") ("$,1?0??(B" . "$,44b(B") ("$,1?0?@(B" . "$,44b4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
239 ("$,1?2?M(B" . "$,44e5)(B") ("$,1?2(B" . "$,44d(B") ("$,1?2?>(B" . "$,44e4{(B") ("$,1?2??(B" . "$,44f(B") ("$,1?2?@(B" . "$,44f4~(B") ("$,1?2?F(B" . "$,44e5&(B") ("$,1?2?G(B" . "$,44e5&4~(B") ("$,1?2?H(B" . "$,44e5&5'(B") ("$,1?2?J(B" . "$,44e5&5&5 (B") ("$,1?2?K(B" . "$,44e5&5&5 4~(B") ("$,1?2?L(B" . "$,44e5((B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
240 ("$,1?5?M(B" . "$,44h5)(B") ("$,1?5(B" . "$,44h(B") ("$,1?5??(B" . "$,44i(B") ("$,1?5?@(B" . "$,44i4~(B") ("$,1?5?A(B" . "$,44h5"(B") ("$,1?5?B(B" . "$,44h5#(B") ("$,1?5?J(B" . "$,44h5&5#(B") ("$,1?5?K(B" . "$,44h5&5#4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
241 ("$,1?6?M(B" . "$,44k5)(B") ("$,1?6(B" . "$,44k(B") ("$,1?6??(B" . "$,44l(B") ("$,1?6?@(B" . "$,44l4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
242 ("$,1?7?M(B" . "$,44n5)(B") ("$,1?7(B" . "$,44n(B") ("$,1?7??(B" . "$,44o(B") ("$,1?7?@(B" . "$,44o4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
243 ("$,1?8?M(B" . "$,44q5)(B") ("$,1?8(B" . "$,44q(B") ("$,1?8??(B" . "$,44r(B") ("$,1?8?@(B" . "$,44r4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244 ("$,1?9?M(B" . "$,44t5)(B") ("$,1?9(B" . "$,44t(B") ("$,1?9??(B" . "$,44u(B") ("$,1?9?@(B" . "$,44u4~(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
245 ("$,1?3?M(B" . "$,44w5)(B") ("$,1?3(B" . "$,44w(B") ("$,1?3??(B" . "$,44x(B") ("$,1?3?@(B" . "$,44x4~(B"))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
246 "Kannada characters to glyphs conversion table.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
247 Default value contains only the basic rules.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
248
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
249 (defvar knd-char-glyph-hash
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
250 (let* ((hash (make-hash-table :test 'equal)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
251 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
252 knd-char-glyph)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
253 hash))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
254
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
255 (defvar knd-char-glyph-regexp
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
256 (kannada-regexp-of-hashtbl-keys knd-char-glyph-hash))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
257
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
258 (defvar knd-conjunct-glyph
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
259 '(("$,1>u(B" . "$,43Q(B") ("$,1>v(B" . "$,43U(B") ("$,1>w(B" . "$,43X(B") ("$,1>x(B" . "$,43[(B") ("$,1>y(B" . "$,43](B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
260 ("$,1>z(B" . "$,43`(B") ("$,1>{(B" . "$,43c(B") ("$,1>|(B" . "$,43g(B") ("$,1>}(B" . "$,43i(B") ("$,1>~(B" . "$,43k(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
261 ("$,1>(B" . "$,43o(B") ("$,1? (B" . "$,43r(B") ("$,1?!(B" . "$,43u(B") ("$,1?"(B" . "$,43x(B") ("$,1?#(B" . "$,43|(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
262 ("$,1?$(B" . "$,44A(B") ("$,1?%(B" . "$,44D(B") ("$,1?&(B" . "$,44G(B") ("$,1?'(B" . "$,44J(B") ("$,1?((B" . "$,44M(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
263 ("$,1?*(B" . "$,44P(B") ("$,1?+(B" . "$,44U(B") ("$,1?,(B" . "$,44Y(B") ("$,1?-(B" . "$,44\(B") ("$,1?.(B" . "$,44](B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
264 ("$,1?/(B" . "$,44`(B") ("$,1?0(B" . "$,44c(B") ("$,1?2(B" . "$,44g(B") ("$,1?3(B" . "$,44y(B") ("$,1?5(B" . "$,44j(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
265 ("$,1?6(B" . "$,44m(B") ("$,1?7(B" . "$,44p(B") ("$,1?8(B" . "$,44s(B") ("$,1?9(B" . "$,44v(B"))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
266 "Kannada characters to conjunct glyphs conversion table.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
267
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
268 (defvar knd-conjunct-glyph-hash
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
269 (let* ((hash (make-hash-table :test 'equal)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
270 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
271 knd-conjunct-glyph)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
272 hash))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
273
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
274 (defvar knd-conjunct-glyph-regexp
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
275 (kannada-regexp-of-hashtbl-vals knd-conjunct-glyph-hash))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
277 (mapc
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
278 (function (lambda (x)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
279 (put-char-code-property (aref (cdr x) 0) 'reference-point '(5 . 3))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
280 knd-conjunct-glyph)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
282 ;; glyph-to-glyph conversion table.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
283 ;; it is supposed that glyphs are ordered in
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
284 ;; [consonant/nukta] - [matra/virama] - [preceding-r] - [anuswar].
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
285
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
286 (defvar knd-glyph-glyph
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287 '(("$,45$4A(B" . "$,45*(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 ("$,45'4A(B" . "$,45+(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
289 ("$,44A3g(B" . "$,45,(B")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
290 ("$,45$3Q(B" . "$,45-(B")))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
291
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
292 (defvar knd-glyph-glyph-hash
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
293 (let* ((hash (make-hash-table :test 'equal)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
294 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
295 knd-glyph-glyph)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
296 hash))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
297 (defvar knd-glyph-glyph-regexp
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
298 (kannada-regexp-of-hashtbl-keys knd-glyph-glyph-hash))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
299
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
300 (defun knd-charseq (from &optional to)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
301 (if (null to) (setq to from))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
302 (mapcar (function (lambda (x) (indian-glyph-char x 'kannada)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
303 (kannada-range from to)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
304
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
305 (defvar knd-glyph-cv
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
306 (append
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
307 (knd-charseq #x40 #x50)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
308 (knd-charseq #x52 #x54)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 (knd-charseq #x56 #x57)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 (knd-charseq #x59 #x5a)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
311 (knd-charseq #x5c)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
312 (knd-charseq #x5e #x5f)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
313 (knd-charseq #x61 #x62)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
314 (knd-charseq #x64 #x66)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
315 (knd-charseq #x6a)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
316 (knd-charseq #x6c #x6e)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
317 (knd-charseq #x70 #x71)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
318 (knd-charseq #x73 #x74)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
319 (knd-charseq #x76 #x77)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
320 (knd-charseq #x79 #x7b)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
321 (knd-charseq #x7d #x7e)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
322 (knd-charseq #xa2 #xa3)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
323 (knd-charseq #xa5 #xa6)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
324 (knd-charseq #xa8 #xa9)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
325 (knd-charseq #xab #xac)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
326 (knd-charseq #xae #xaf)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
327 (knd-charseq #xb1 #xb2)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
328 (knd-charseq #xb6 #xb8)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
329 (knd-charseq #xb6 #xb8)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
330 (knd-charseq #xba #xbb)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 (knd-charseq #xbe #xbf)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332 (knd-charseq #xc1 #xc2)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 (knd-charseq #xc4 #xc6)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334 (knd-charseq #xc8 #xc9)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 (knd-charseq #xcb #xcc)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 (knd-charseq #xce #xcf)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
337 (knd-charseq #xd1 #xd2)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338 (knd-charseq #xd4 #xd5)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
339 (knd-charseq #xd7 #xd8)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 (knd-charseq #xc3))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
341 "Kannada Consonants/Vowels/Nukta Glyphs")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 (defvar knd-glyph-space
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344 (knd-charseq #xb3 #xb4)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345 "Kannada Spacing Glyphs")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347 (defvar knd-glyph-right-modifier
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 (append
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349 (knd-charseq #xdb #xdd)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 (knd-charseq #xdf)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351 (knd-charseq #xe0 #xe3)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352 (knd-charseq #xe9))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353 "Kannada Modifiers attached at the right side.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
354
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
355 (defvar knd-glyph-right-modifier-regexp
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
356 (concat "[" knd-glyph-right-modifier "]"))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
357
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
358 (defvar knd-glyph-jha-tail
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
359 (knd-charseq #x68)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
360 "Kannada tail for jha.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
361
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
362 (defvar knd-glyph-top-matra
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
363 (append
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
364 (knd-charseq #xda)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
365 (knd-charseq #xdd)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
366 (knd-charseq #xe6)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
367 (knd-charseq #xe8))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
368 "Kannada Matras attached at the top side.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
369
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
370 (defvar knd-glyph-bottom-matra
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
371 (append
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
372 (knd-charseq #xe4 #xe5)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
373 (knd-charseq #xe7))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
374 "Kannada Matras attached at the bottom.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
375
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
376 (defvar knd-glyph-end-marks
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
377 (append
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
378 (knd-charseq #x25)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
379 (knd-charseq #x4d #x4e)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
380 (knd-charseq #xde))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
381 "Kannada end marks: arkavattu, virama, au and diirghaa.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
382
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
383 (defvar knd-glyph-bottom-modifier
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
384 (append
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
385 (knd-charseq #x51)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
386 (knd-charseq #x55)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
387 (knd-charseq #x58)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
388 (knd-charseq #x5b)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
389 (knd-charseq #x5d)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
390 (knd-charseq #x60)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
391 (knd-charseq #x63)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
392 (knd-charseq #x67)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
393 (knd-charseq #x69)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
394 (knd-charseq #x6b)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
395 (knd-charseq #x6f)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
396 (knd-charseq #x72)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
397 (knd-charseq #x75)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
398 (knd-charseq #x78)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
399 (knd-charseq #x7c)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
400 (knd-charseq #xa1)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
401 (knd-charseq #xa4)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
402 (knd-charseq #xa7)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
403 (knd-charseq #xaa)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
404 (knd-charseq #xad)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
405 (knd-charseq #xb0)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
406 (knd-charseq #xb5)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
407 (knd-charseq #xb9)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
408 (knd-charseq #xbc #xbd)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
409 (knd-charseq #xc0)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
410 (knd-charseq #xc3)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
411 (knd-charseq #xc7)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
412 (knd-charseq #xca)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
413 (knd-charseq #xcd)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
414 (knd-charseq #xd0)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
415 (knd-charseq #xd3)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
416 (knd-charseq #xd6)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
417 (knd-charseq #xd9)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
418 (knd-charseq #xea #xef))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
419 "Kannada Modifiers attached at the bottom.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
420
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
421 (defvar knd-glyph-order
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
422 `((,knd-glyph-cv . 1)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
423 (,knd-glyph-top-matra . 2)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
424 (,knd-glyph-jha-tail . 3)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
425 (,knd-glyph-right-modifier . 4)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
426 (,knd-glyph-space . 5)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
427 (,knd-glyph-bottom-modifier . 5)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
428 (,knd-glyph-bottom-matra . 6)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
429 (,knd-glyph-end-marks . 7)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
430 ))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
431
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
432 (mapc
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
433 (function (lambda (x)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
434 (mapc
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
435 (function (lambda (y)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
436 (put-char-code-property y 'composition-order (cdr x))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
437 (car x))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
438 knd-glyph-order)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
439
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
440 (defun kannada-compose-syllable-string (string)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
441 (with-temp-buffer
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
442 (insert (decompose-string string))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
443 (kannada-compose-syllable-region (point-min) (point-max))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
444 (buffer-string)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
445
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
446 ;; kch
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
447 (defun kannada-compose-syllable-region (from to)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
448 "Compose kannada syllable in region FROM to TO."
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
449 (let ((glyph-str nil) (cons-num 0) (glyph-str-list nil)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
450 (last-virama nil) (preceding-r nil) (last-modifier nil)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
451 (last-char (char-before to)) match-str pos
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
452 glyph-block split-pos (conj nil) (rest nil))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
453 (save-excursion
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
454 (save-restriction
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
455 ;;; *** char-to-glyph conversion ***
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
456 ;; Special rule 1. -- Last virama must be preserved.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
457 (if (eq last-char ?$,1?M(B)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
458 (progn
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
459 (setq last-virama t)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
460 (narrow-to-region from (1- to)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
461 (narrow-to-region from to))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
462 (goto-char (point-min))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
463 ;; Special rule 2. -- preceding "r virama" must be modifier.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
464 (when (looking-at "$,1?0?M(B.")
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
465 (setq preceding-r t)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
466 (goto-char (+ 2 (point))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
467 ;; remove conjunct consonants
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
468 (while (re-search-forward knd-char-glyph-regexp nil t)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
469 (setq match-str (match-string 0))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
470 (if (and (string-match kannada-consonant match-str)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
471 (> cons-num 0))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
472 (progn
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
473 (setq conj (concat conj (gethash (match-string 0 match-str)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
474 knd-conjunct-glyph-hash)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
475 (setq match-str (replace-match "" t nil match-str))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
476 (if (string-match "$,1?M(B" rest)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
477 (setq rest (replace-match "" t nil rest)))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
478 (setq rest (concat rest match-str))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
479 ;; count the number of consonant-glyhs.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
480 (if (string-match kannada-consonant match-str)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
481 (setq cons-num (1+ cons-num))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
482 ;; translate the rest characters into glyphs
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
483 (setq pos 0)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
484 (while (string-match knd-char-glyph-regexp rest pos)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
485 (setq match-str (match-string 0 rest))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
486 (setq pos (match-end 0))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
487 (setq glyph-str
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
488 (concat glyph-str (gethash match-str knd-char-glyph-hash))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
489
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
490 (if conj (setq glyph-str (concat glyph-str conj)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
491 (if last-virama (setq glyph-str (concat glyph-str "$,45)(B"))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
492 (goto-char (point-min))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
493 (if (re-search-forward kannada-consonant-needs-twirl nil t)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
494 (progn
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
495 (setq match-str (match-string 0))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
496 (setq glyph-str (concat glyph-str "$,44z(B")))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
497 ;; preceding-r must be attached
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
498 (if preceding-r
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
499 (setq glyph-str (concat glyph-str "$,43%(B")))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
500 ;;; *** glyph-to-glyph conversion ***
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
501 (when (string-match knd-glyph-glyph-regexp glyph-str)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
502 (setq glyph-str
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
503 (replace-match (gethash (match-string 0 glyph-str)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
504 knd-glyph-glyph-hash)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
505 nil t glyph-str)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
506 ;;; *** glyph reordering ***
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
507 (while (setq split-pos (string-match "$,45)(B\\|.$" glyph-str))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
508 (setq glyph-block (substring glyph-str 0 (1+ split-pos)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
509 (setq glyph-str (substring glyph-str (1+ split-pos)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
510 (setq
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
511 glyph-block
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
512 (sort (string-to-list glyph-block)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
513 (function (lambda (x y)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
514 (< (get-char-code-property x 'composition-order)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
515 (get-char-code-property y 'composition-order))))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
516 (setq glyph-str-list (nconc glyph-str-list glyph-block)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
517 ;;; *** insert space glyphs for kerning ***
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
518 (if (> cons-num 0)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
519 (let ((curr glyph-str-list) (prev nil) (last-bott nil) bott co)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
520 (while curr
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
521 (setq co (get-char-code-property
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
522 (car curr) 'composition-order)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
523 bott (or (eq co 5) (eq co 6)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
524 (if (and bott last-bott)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
525 (setcdr prev (cons ?$,44T(B curr)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
526 (setq last-bott bott prev curr curr (cdr curr)))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
527 ;; concatenate and attach reference-points.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
528 (setq glyph-str
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
529 (cdr
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
530 (apply
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
531 'nconc
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
532 (mapcar
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
533 (function (lambda (x)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
534 (list
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
535 (or (get-char-code-property x 'reference-point)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
536 '(5 . 3) ;; default reference point.
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
537 )
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
538 x)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
539 glyph-str-list))))))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
540 (compose-region from to glyph-str)))
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
541
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
542 (provide 'knd-util)
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
543
53022
56dd8068d740 Resolve CVS conflicts
Miles Bader <miles@gnu.org>
parents: 53018
diff changeset
544 ;;; arch-tag: 78d32230-a960-46a5-b622-61ed6ffcf8fc
53018
3d8aaf9af0df New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
545 ;;; knd-util.el ends here