;; DEVA-OTF.flt -- Font Layout Table for Devanagari OpenType font
;; Copyright (C) 2003, 2004, 2007
;; 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., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;
DEVA-OTF.flt
;;;
;;; For Devanagari OpenType fonts to draw the Devanagari script.
(font layouter deva-otf nil
(font (nil nil unicode-bmp :otf=deva=rphf)))
(category
;; C: consonant (except for R)
;; R: consonant RA
;; n: NUKTA
;; H: HALANT
;; m: vowel sign (pre)
;; u: vowel sign (above)
;; b: vowel sign (below)
;; p: vowel sign (post)
;; A: vowel modifier (above)
;; a: vowel modifier (post)
;; S: stress sign / accent (above)
;; s: stress sign / accent (below)
;; V: independent vowel
;; N: ZWNJ
;; J: ZWJ
;; X: generic
;; Z: internal use
(0x0900 ?Z) ; internal use
(0x0901 0x097F ?X) ; generic
(0x0901 0x0902 ?A) ; SIGN CANDRABINDU .. ANUSVARA
(0x0903 ?a) ; SIGN VISARGA
(0x0904 0x0914 ?V) ; LETTER SHORT A .. AU
(0x0915 0x0939 ?C) ; LETTER KA .. HA
(0x0930 ?R) ; LETTER RA
(0x093C ?n) ; SIGN NUKTA
(0x093E ?p) ; VOWEL SIGN AA
(0x093F ?m) ; VOWEL SIGN I
(0x0940 ?p) ; VOWEL SIGN II
(0x0941 0x0944 ?b) ; VOWEL SIGN UU .. VOCALIC RR
(0x0945 0x0948 ?u) ; VOWEL SIGN CANDRA E .. AI
(0x0949 0x094C ?p) ; VOWEL SIGN CANDRA O .. AU
(0x094D ?H) ; SIGN VIRAMA
(0x0951 ?S) ; STRESS SIGN UDATTA
(0x0952 ?s) ; STRESS SIGN ANUDATTA
(0x0953 0x0954 ?S) ; GRAVE ACCENT .. ACUTE ACCENT
(0x0958 0x095F ?C) ; LETTER QA .. YYA
(0x0960 0x0961 ?V) ; LETTER VOCALIC RR .. VOCALIC LL
(0x0962 0x0963 ?b) ; VOWEL SIGN VOCALIC L .. VOCALIC LL
(0x097B 0x097C ?C) ; LETTER GGA .. JJA
(0x097E 0x097F ?C) ; LETTER DDDA .. BBA
(0x200C ?N) ; ZWNJ
(0x200D ?J) ; ZWJ
)
;; Reordering
(generator
(0
(cond
;; A syllable containing a vowel sign.
;;1 23 45 6 7 8 9 10 11
("(RH)?(([CR]n?H)*[CR]n?)((m)|(b)|([up]))(A)?(a)?(S)?(s)?"
< |
(5 =) (2 move-h) (6 =) (11 =) (7 =) (1 otf:deva=rphf+) (8 =) (10 =) (9 =)
| >)
;; A syllable without vowel signs but with a vowel modifier.
;;1 23 45 6 7 8
("(RH)?(([CR]n?H)*[CR]n?)((A)|(a))(S)?(s)?"
< | (2 move-h) (8 =) (1 otf:deva=rphf+) (5 =) (7 =) (6 =) | >)
;; No vowel signs, No vowel modifiers, but with a stress sign or an accent.
;;1 23 45 6
("(RH)?(([CR]n?H)*[CR]n?)((S)|(s))"
< | (2 move-h) (6 =) (1 otf:deva=rphf+) (5 =) | >)
;; A special case: eyelash RA
("(RH)J"
< (1 otf:deva=half+) >)
;; Forced half form. Do not move halant.
;;1 23
("(RH)?(([CR]n?H)+)J"
< | (2 = *) (1 otf:deva=rphf+) | >)
;; When a syllable ends with a halant, add a ZWNJ explicitly.
;;1 23 4 5
("(RH)?(([CR]n?H)*[CR]n?)(H)?(N)?"
< | (2 move-h) (1 otf:deva=rphf+) (4 = 0x200C) | >)
;; A syllable starting with an independent vowel.
;;1 2 3 4 5
("(V)(A)?(a)?(S)?(s)?"
< | (1 =) (5 =) (2 =) (4 =) (3 =) | >)
("." =))
*)
;; Move the halant that follows the base consonant to the end.
;; Put a mark after the below form consonants.
(move-h
(cond
;;12 3 45
("(([CR]n?H)*Cn?)(H)((RH)*R)$"
(1 = *) (4 = *) (3 =) 0x0900)
;;1 2 34
("(R)(H)((RH)*R)$"
(1 =) (3 = *) (2 =) 0x0900)
(".+" = * 0x0900))))
;; If a syllable ends with a halant and a ZWNJ, render the final
;; halant explicitly. Do not apply 'blwf' nor 'half' to the initial
;; RA.
(generator
(0
(cond
(" (R)([^Z]*)(Z)([^ ]*)(H)N "
| (1 =) (2 gsub1) (3 =) (4 = *) (5 =) |)
(" (m?R)([^Z ]*)(Z)?([^ ]*) "
| (1 = *) (2 gsub1) (3 =) (4 = *) |)
(" ([^Z]+)(Z)([^ ]*)(H)N "
| (1 gsub1) (2 =) (3 * =) (4 =) |)
(" (m)?([^Z ]+)(Z)?([^ ]*) "
| (1 =) (2 gsub1) (3 =) (4 = *) |)
("." =))
*)
(gsub1
otf:deva=nukt,akhn,blwf,half,vatu,pres+))
;; When the number of glyphs between a pre-base vowel sign and the
;; post-below mark is more than one, move the pre-base vowel sign
;; before the final glyph.
(generator
(0
(cond
(" (m)([^Z]+)([^Z])Z([^ ]*) "
| (2 = *) (1 =) (3 =) (4 = *) |)
(" ([^Z]+)Z([^ ]*) "
| (1 = *) (2 = *) |)
("." =))
*))
;; Apply other features. The 'pres' feature is applied again for
;; pre-base vowel sign.
(generator
(0
(cond
(" ([^ ]+) "
(1 otf:deva=pres,abvs,blws,psts,haln))
("."
[ otf:deva=+ ]))
*))
;; Local Variables:
;; mode: emacs-lisp
;; End: