;; TAML-OTF.flt -- Font Layout Table for Tamil OpenType fonts
;; Copyright (C) 2004, 2006, 2007  AIST (H15PRO112)
;; See the end for copying conditions.

(font layouter taml-otf nil
      (font (nil nil unicode-bmp :otf=taml=akhn)))

;;; <li> TAML-OTF.flt
;;;
;;; For Tamil OpenType fonts to draw the Tamil script.

(category
 ;; C: consonant
 ;; H: HALANT
 ;; m: vowel sign (pre)
 ;; u: vowel sign (above)
 ;; b: vowel sign (below)
 ;; p: vowel sign (post)
 ;; X: generic
 (0x0B80 0x0BFF	?X)			; generic
 (0x0B95 0x0BB9 ?C)			; LETTER KA .. HA
 (0x0BBE 0x0BBF	?p)			; VOWEL SIGN AA .. I
 (0x0BC0	?u)			; VOWEL SIGN II
 (0x0BC1 0x0BC2	?b)			; VOWEL SIGN U .. UU
 (0x0BC6 0x0BC8	?m)			; VOWEL SIGN E .. AI
 (0x0BCD	?H)			; SIGN VIRAMA
 (0x0BD7	?p)			; AU LENGTH MARK
 (0x0964 0x0965	?X)			; DANDA .. DOUBLE DANDA
 (0x200C	?N)			; ZWNJ
 )

;; Preprocessing.
(generator
 (0
  (cond
   ;; Decompose two-part vowel signs.
   ((0x0BCA)
    0x0BC6 0x0BBE)
   ((0x0BCB)
    0x0BC7 0x0BBE)
   ((0x0BCC)
    0x0BC6 0x0BD7)
   ;; A variation of AU.
   ((0x0B92 0x0BD7)
    0x0B94)
   ;; TAMu and TSCu fonts generate the SRI ligature with 'akhn'.
   ;; (lohit and latha do it with 'half' + 'abvs'.)
   ((0x0BB8 0x0BCD 0x0BB0 0x0BC0)
    otf:taml=akhn+)
   ("." =))
  *))

;; Syllable identification.
(generator
 (0
  (cond
   ;; A syllable with vowel signs.
   ("((CH)*C)(mp?|b|u|p)"
    < | (1 otf:taml=akhn,half+) (3 = *) | >)

   ;; No vowel signs.
   ("((CH)*C)(HN?)?"
    < | (1 otf:taml=akhn,half+) (3 =) | >)

   ("." =))
  *))

;; Move Matra before the base consonant.
(generator
 (0
  (cond
   (" ([^ m]*)([^ m])(m)(p)? "
    | (1 = *) (3 =) (2 =) (4 =) |)
   ("." =))
  *))

;; Apply other OTF features.
(generator
 (0
  (cond
   (" ([^ ]+) "
    (1 otf:taml=pres,abvs,blws,psts,haln+abvm,blwm,dist))
   ("."
    [ = ]))
  *))

;; Copyright (C) 2004, 2006, 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.

;; Local Variables:
;; mode: emacs-lisp
;; End:
