1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
;; DEVA-OTF.flt -- Font Layout Table for Devanagari OpenType font
;; Copyright (C) 2003, 2004
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H15PRO112
;; This file is part of the m17n database; a sub-part of the m17n
;; library.
;; The m17n library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
;; as published by the Free Software Foundation; either version 2.1 of
;; the License, or (at your option) any later version.
;; The m17n library 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
;; Lesser General Public License for more details.
;; You should have received a copy of the GNU Lesser General Public
;; License along with the m17n library; if not, write to the Free
;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307, USA.
;;; <li> DEVA-OTF.flt
;;;
;;; For Devanagari OpenType fonts to draw the Devanagari script.
(category
;; C: consonant (except for R)
;; R: consonant RA
;; n: NUKTA
;; H: HALANT
;; m: MATRA (pre)
;; u: MATRA (above)
;; b: MATRA (below)
;; p: MATRA (post)
;; A: vowel modifier (above)
;; a: vowel modifier (post)
;; S: stress sign (above)
;; s: stress sign (below)
;; V: independent vowel
;; N: ZWNJ (ZERO WIDTH NON-JOINER)
;; J: ZWJ (ZERO WIDTH JOINER)
;; E: ELSE
;;
(#x0900 #x097F ?E) ; ELSE
(#x0901 ?A) ; SIGN CANDRABINDU (above)
(#x0902 ?A) ; SIGN ANUSVARA (above)
(#x0903 ?a) ; SIGN VISARGA (post)
(#x0905 #x0914 ?V) ; LETTER A .. LETTER AU
(#x0915 #x0939 ?C) ; LETTER KA .. LETTER HA
(#x0930 ?R) ; LETTER RA
(#x093C ?n) ; SIGN NUKTA
(#x093D ?E) ; SIGN AVAGRAHA
(#x093E #x094C ?p) ; VOWEL SIGN (post)
(#x093F ?m) ; VOWEL SIGN I (pre)
(#x0941 #x0944 ?b) ; VOWEL SIGN (below)
(#x0945 #x0948 ?u) ; VOWEL SIGN (above)
(#x094D ?H) ; SIGN VIRAMA (HALANT)
(#x0950 ?E) ; OM
(#x0951 #x0954 ?S) ; STRESS SIGN or TONE MARK (above)
(#x0952 ?s) ; STRESS SIGN or TONE MARK (below)
(#x0958 #x095E ?C) ; LETTER QA .. LETTER YYA
(#x0960 ?V) ; LETTER VOCALIC RR
(#x0961 ?V) ; LETTER VOCALIC LL
(#x0962 #x0963 ?b) ; VOWEL SIGN (below)
(#x0964 #x0970 ?E) ; DANDA .. ABBREVIATION SIGN
(#x200C ?N) ; ZWNJ
(#x200D ?J) ; ZWJ
(#x097D ?x) ; internally used tag to indicate Reph
(#x097E ?y) ; internally used tag to indicate Mpost
(#x097F ?z) ; internally used tag to indicate Cbase
)
;; The first stage is to extract a syllable and re-order characters in
;; it.
(generator
(0
(cond
;; If [CR]H is followed by ZWNJ/ZWJ, move ZWNJ/ZWJ to the head so
;; that the later stages find it quickly.
("([CR]n?H)([NJ])"
< | (2 =) (1 = *) | > )
;; A syllable starting with RH (Reph) and ending with a vowel
;; and/or a vowel modifier.
("(RH)(([CR]n?H)*[CR]n?)([mubp][Aa]?[Ss]?|[Aa][Ss]?|[Ss])"
< | (1 #x097D = =) (2 move-base-Halant) (4 reorder-post-base) | >)
;; A syllable starting with RH (Reph) and ending without a vowel
;; nor a vowel modifier.
("(RH)(([CR]n?H)*[CR]n?)(H)?"
< | (1 #x097D = =) (2 move-base-Halant) (4 =) | >)
;; A syllable starting with the other consonant and ending with a
;; vowel and/or a vowel modifier.
("(([CR]n?H)*[CR]n?)([mubp][Aa]?[Ss]?|[Aa][Ss]?|[Ss])"
< | (1 move-base-Halant) (3 reorder-post-base) | >)
;; A syllable starting with the other consonant and ending without
;; a vowel nor a vowel modifier.
("(([CR]n?H)*[CR]n?)(H)?"
< | (1 move-base-Halant) (3 =) | >)
;; A syllable starting with an independent vowel.
("V[Aa]?[Ss]?"
< | = * | > )
("." =))
*)
;; Move Halant on a base consonant to the tail.
(move-base-Halant
(cond
("(([CR]n?H)*[CR]n?)(H)(R)"
(1 = *)
(4 =)
(3 =))
(".*"
= *)))
;; Re-order post modifiers.
(reorder-post-base
;; 12 3 4 5 67 8 9 10
("((m)|(u)|(b)|(p))?((A)|(a))?((S)|(s))?$"
(2 =) (4 =) (10 =) (3 =) (5 =)
#x097E
(7 =) (9 =) (8))))
;; The second stage is to reorder Reph and Mpre.
(generator
(0
(cond
(" [NJ]([^ ]*) "
= *)
(" (x(..))([CRnH]*) "
| (3 = *) (2 otf:deva=rphf) |)
(" (x(..))([CRnH]*)(m?)([^y]*)y([^ ]*) "
| (4 =) (3 = *) (5 = *) (2 otf:deva=rphf) (6 = *) |)
(" ([CRnH][CRnH]*) "
= *)
(" ([CRnH][CRnH]*)(m?)([^y]*)y([^ ]*) "
| (2 =) (1 = *) (3 = *) (4 = *) |)
("." =))
*))
;; The third stage is to drive OTF tables. For the moment, we use
;; the default LangSys, and try all GSUB/GPOS features except for the
;; sequence followed by ZWNJ in which case try "nukt" and "haln"
;; features only.
(generator
(0
(cond
(" N([^ ]*) "
(1 otf:deva=nukt,haln))
(" J([^ ]*) "
(1 otf:deva))
(" ([^ ]*)(CH) "
(1 otf:deva=~rphf,*) (2 otf:deva=haln))
(" ([^ ]*) "
(1 otf:deva=~rphf,*))
("."
\[ otf:deva=+ \] ))
*))
;; Local Variables:
;; mode: emacs-lisp
;; End:
|