1 ;; DEVA-OTF.flt -- Font Layout Table for Devanagari OpenType font
2 ;; Copyright (C) 2003, 2004, 2007
3 ;; National Institute of Advanced Industrial Science and Technology (AIST)
4 ;; Registration Number H15PRO112
6 ;; This file is part of the m17n database; a sub-part of the m17n
9 ;; The m17n library is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU Lesser General Public License
11 ;; as published by the Free Software Foundation; either version 2.1 of
12 ;; the License, or (at your option) any later version.
14 ;; The m17n library is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; Lesser General Public License for more details.
19 ;; You should have received a copy of the GNU Lesser General Public
20 ;; License along with the m17n library; if not, write to the Free
21 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
26 ;;; For Devanagari OpenType fonts to draw the Devanagari script.
28 (font layouter deva-otf nil
29 (font (nil nil unicode-bmp :otf=deva=rphf)))
32 ;; C: consonant (except for R)
40 ;; A: vowel modifier (above)
41 ;; a: vowel modifier (post)
42 ;; S: stress sign (above)
43 ;; s: stress sign (below)
44 ;; V: independent vowel
45 ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
46 ;; J: ZWJ (ZERO WIDTH JOINER)
49 (#x0900 #x097F ?E) ; ELSE
50 (#x0901 ?A) ; SIGN CANDRABINDU (above)
51 (#x0902 ?A) ; SIGN ANUSVARA (above)
52 (#x0903 ?a) ; SIGN VISARGA (post)
53 (#x0905 #x0914 ?V) ; LETTER A .. LETTER AU
54 (#x0915 #x0939 ?C) ; LETTER KA .. LETTER HA
55 (#x0930 ?R) ; LETTER RA
56 (#x093C ?n) ; SIGN NUKTA
57 (#x093D ?E) ; SIGN AVAGRAHA
58 (#x093E #x094C ?p) ; VOWEL SIGN (post)
59 (#x093F ?m) ; VOWEL SIGN I (pre)
60 (#x0941 #x0944 ?b) ; VOWEL SIGN (below)
61 (#x0945 #x0948 ?u) ; VOWEL SIGN (above)
62 (#x094D ?H) ; SIGN VIRAMA (HALANT)
64 (#x0951 #x0954 ?S) ; STRESS SIGN or TONE MARK (above)
65 (#x0952 ?s) ; STRESS SIGN or TONE MARK (below)
66 (#x0958 #x095E ?C) ; LETTER QA .. LETTER YYA
67 (#x0960 ?V) ; LETTER VOCALIC RR
68 (#x0961 ?V) ; LETTER VOCALIC LL
69 (#x0962 #x0963 ?b) ; VOWEL SIGN (below)
70 (#x0964 #x0970 ?E) ; DANDA .. ABBREVIATION SIGN
73 (#x097D ?x) ; internally used tag to indicate Reph
74 (#x097E ?y) ; internally used tag to indicate Mpost
75 (#x097F ?z) ; internally used tag to indicate Cbase
78 ;; The first stage is to extract a syllable and re-order characters in
83 ;; If [CR]H is followed by ZWNJ/ZWJ, move ZWNJ/ZWJ to the head so
84 ;; that the later stages find it quickly.
86 < | (2 =) (1 = *) | > )
88 ;; A syllable starting with RH (Reph) and ending with a vowel
89 ;; and/or a vowel modifier.
90 ("(RH)(([CR]n?H)*[CR]n?)([mubp][Aa]?[Ss]?|[Aa][Ss]?|[Ss])"
91 < | (1 #x097D = =) (2 move-base-Halant) (4 reorder-post-base) | >)
93 ;; A syllable starting with RH (Reph) and ending without a vowel
94 ;; nor a vowel modifier.
95 ("(RH)(([CR]n?H)*[CR]n?)(H)?"
96 < | (1 #x097D = =) (2 move-base-Halant) (4 =) | >)
98 ;; A syllable starting with the other consonant and ending with a
99 ;; vowel and/or a vowel modifier.
100 ("(([CR]n?H)*[CR]n?)([mubp][Aa]?[Ss]?|[Aa][Ss]?|[Ss])"
101 < | (1 move-base-Halant) (3 reorder-post-base) | >)
103 ;; A syllable starting with the other consonant and ending without
104 ;; a vowel nor a vowel modifier.
105 ("(([CR]n?H)*[CR]n?)(H)?"
106 < | (1 move-base-Halant) (3 =) | >)
108 ;; A syllable starting with an independent vowel.
115 ;; Move Halant on a base consonant to the tail.
118 ("(([CR]n?H)*[CR]n?)(H)(R)"
125 ;; Re-order post modifiers.
127 ;; 12 3 4 5 67 8 9 10
128 ("((m)|(u)|(b)|(p))?((A)|(a))?((S)|(s))?$"
129 (2 =) (4 =) (10 =) (3 =) (5 =)
133 ;; The second stage is to reorder Reph and Mpre.
139 (" (x(..))([CRnH]*) "
140 | (3 = *) (2 otf:deva=rphf) |)
141 (" (x(..))([CRnH]*)(m?)([^y]*)y([^ ]*) "
142 | (4 =) (3 = *) (5 = *) (2 otf:deva=rphf) (6 = *) |)
145 (" ([CRnH][CRnH]*)(m?)([^y]*)y([^ ]*) "
146 | (2 =) (1 = *) (3 = *) (4 = *) |)
150 ;; The third stage is to drive OTF tables. For the moment, we use
151 ;; the default LangSys, and try all GSUB/GPOS features except for the
152 ;; sequence followed by ZWNJ in which case try "nukt" and "haln"
158 (1 otf:deva=nukt,haln))
164 (1 otf:deva=~rphf,*) (2 otf:deva=haln))
167 (1 otf:deva=~rphf,*))