--- /dev/null
+;; GUJ-OTF.flt -- Font Layout Table for Gujarati OpenType fonts
+;; Copyright (C) 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> GUJ-OTF.flt
+;;;
+;;; For Gujarati OpenType fonts to draw Gujarati.
+;;; Tested with padmaa-Medium-1.5.ttf <http://www.indictrans.org/>
+
+(category
+ ;; C: general consonant
+ ;; R: RA
+ ;; V: independent vowel
+ ;; H: HALANT
+ ;; m: MATRA (pre)
+ ;; u: MATRA (above)
+ ;; b: MATRA (below)
+ ;; p: MATRA (post)
+ ;; A: vowel modifier (above)
+ ;; a: vowel modifier (post)
+ ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
+ ;; J: ZWJ (ZERO WIDTH JOINER)
+ ;; E: ELSE
+ ;;
+ (0x200C ?N) ; ZWNJ
+ (0x200D ?J) ; ZWJ
+ (0x0964 ?E) ; DANDA
+ (0x0965 ?E) ; DOUBLE DANDA
+ (0x0A80 0x0AFF ?E) ; ELSE
+ (0x0A81 ?A) ; SIGN CANDRABINDU
+ (0x0A82 ?A) ; SIGN ANUSVARA
+ (0x0A83 ?a) ; SIGN VISARGA
+ (0x0A85 0x0A94 ?V) ; LETTER AA .. LETTER AU
+ (0x0A95 0x0AB9 ?C) ; LETTER KA .. LETTER HA
+ (0x0AB0 ?R) ; LETTER RA
+ (0x0ABC ?n) ; SIGN NUKTA
+ (0x0ABE ?p) ; VOWEL SIGN AA (post)
+ (0x0ABF ?m) ; VOWEL SIGN I (pre)
+ (0x0AC0 ?p) ; VOWEL SIGN II (post)
+ (0x0AC1 0x0AC4 ?b) ; VOWEL SIGN U, UU, R, RR (below)
+ (0x0AC5 0x0AC8 ?u) ; VOWEL SIGN CANDRA E, E, AI (above)
+ (0x0AC9 0x0ACC ?p) ; VOWEL SIGN CANDRA O, O, AU (post)
+ (0x0ACD ?H) ; SIGN VIRAMA (HALANT)
+ (0x0AE0 0x0AE1 ?V) ; LETTER VOCALIC RR, LL
+ (0x0AE2 0x0AE3 ?b) ; VOWEL SIGN VOCALIC RR, LL (below)
+ (0x0AFD ?Z) ; internal use
+ (0x0AFE ?Y) ; internal use
+ (0x0AFF ?X) ; internal use
+ )
+
+;; Step 1 : Syllable identification, Reph and base consonant movements.
+(generator
+ (0
+ (cond
+ ;; A syllable ending with a vowel sign and/or a vowel modifier.
+ ("(([CR]n?H)*[CR]n?)([mubp][Aa]?|[Aa])"
+ < | (1 move-reph-vattu) (3 = *) | >)
+
+ ;; Forced Halant or half form.
+ ("(([CR]n?H)*[CR]n?)(H[NJ])"
+ < | (1 move-reph-vattu) (3 = =) | >)
+
+ ;; A syllable without a vowel sign nor a vowel modifier.
+ ("([CR]n?H)*[CR]n?H?"
+ < | move-reph-vattu | >)
+
+ ;; A syllable starting with an independent vowel.
+ ("V[Aa]?"
+ < | = * | >)
+
+ ("." =))
+ *)
+
+ ;; Move the leading RH and the Halant on the base consonant to
+ ;; appropriate positions.
+ ;; 0x0AFF indicates the destination of below-, above-, post Matras.
+ (move-reph-vattu
+ (cond
+ ;; Ending with Halnt. Immitate a forced Halant form.
+ ("(.*)(H)$"
+ (1 move-reph-vattu) (2 =) 0x200C)
+
+ ;; Both Reph and Vattu.
+ ;;1 23 4 5
+ ("(RH)(([CR]n?H)*[CR]n?)(H)(R)$"
+ (2 = *) (5 =) (4 =) 0x0AFF (1 = =))
+
+ ;; A special case of above.
+ ("(RH)(R)$"
+ (2 =) 0x0AFF (1 = =))
+
+ ;; Reph but no Vattu.
+ ("(RH)(([CR]n?H)*Cn?)$"
+ (2 = *) 0x0AFF (1 = =))
+
+ ;; No Reph but Vattu.
+ ("(Cn?(H[CR]n?)*)(H)(R)$"
+ (1 = *) (4 =) (3 =) 0x0AFF)
+
+ ;; Neither Reph nor Vattu.
+ (".*"
+ = * 0x0AFF))))
+
+;; Step 2 : Matra movements and OTF forms.
+(generator
+ (0
+ (cond
+ ;; 1 2 3 4 5
+ (" ([^X ]*)X(RH)?(m)?([bup])?([Aa])? "
+ | (3 =) (1 otf:gujr=~rphf,*) (4 =) (2 otf:gujr=rphf) (5 =) |)
+
+ (" ([^X ]*)X(RH)?(HJ) "
+ | (1 = *) (2 otf:gujr=rphf) (3 = =) |)
+
+ (" ([^X ]*)X(RH)?(H)N "
+ | (1 otf:gujr=~rphf,*) (2 otf:gujr=rphf) (3 =) |)
+
+ ("." =))
+ *))
+
+;; Step 3 : OTF substitutions and positionings.
+(generator
+ (0
+ (cond
+ (" (.*)J "
+ (1 otf:gujr=~rphf,*))
+ (" ([^ ]*) "
+ (1 otf:gujr=~rphf,~blwf,~half,~haln,*))
+ ("."
+ [ otf:gujr=+ ]))
+ *))
+
+;; Local Variables:
+;; mode: emacs-lisp
+;; End: