;; THAI-OTF.flt -- Font Layout Table for Thai
;; Copyright (C) 2006, 2007, 2008  AIST (H15PRO112)
;; See the end for copying conditions.

(font layouter thai-otf nil
      (font (nil nil unicode-bmp :otf=thai+mark,mkmk)))

;;; <li> THAI-OTF.flt

(category
 ;; C: CONSONANT
 ;; A: SARA-AM
 ;; i: SARA I, SARA U (below vowel 1, above vowel 1)
 ;; I: SARA II, SARA UEE (above vowel 3)
 ;; U: MAIHAN-AKAT, SARA UE, SARA UU (above vowel 2, below vowel 2)
 ;; P: PHINTHU, YAMAKKARN (below diacritic, above diacritic 3)
 ;; T: TONE
 ;; N: THANTHAKHAT, NIKHAHIT (above diacritic 1)
 ;; M: MAITAIKHU (above diacritic 2)
 ;; X: OTHER INDEPENDENT
 (0x0E01 0x0E23	?C)
 (0x0E24	?X)
 (0x0E25	?C)
 (0x0E26 0x0E2E ?C)
 (0x0E2F 0x0E30	?X)
 (0x0E31	?U) ;; av2
 (0x0E32	?X)
 (0x0E33	?A)
 (0x0E34 	?i) ;; av1
 (0x0E35 	?I) ;; av3
 (0x0E36	?U) ;; av2
 (0x0E37 	?I) ;; av3
 (0x0E38 	?i) ;; bv1
 (0x0E39 	?U) ;; bv2
 (0x0E3A	?P) ;; bd
 (0x0E3F 0x0E46 ?X)
 (0x0E47	?M) ;; ad2
 (0x0E48 0x0E4B	?T)
 (0x0E4C 0x0E4D	?N) ;; ad1
 (0x0E4E	?P) ;; ad3
 (0x0E4F 0x0E5B ?X)
 (0x25CC	?X))

;; Perform GSUB.  The decomposition of AM is done by hand because it
;; requires reordering in addition to decomposition.

(generator
 (0
  (cond
   ("(C)(T)?(A)"
    | < (1 = 0x0E4D) (2 =) > | (3 0x0E32) > )
   ("C[UiI]T"
    < | = * | > )
   ("CiN"
    < | = * | > )
   ("CIM"
    < | = * | > )
   ("C[iIUPTNM]?"
    < | = * | > )
   ("[iIUPTNM]"
    (cond ((font-facility 0x25CC) < 0x25CC = > ) ("." [ = ] )))
   ("."
    =))
  *))

;; Perform GPOS.

(generator
 (0
  (cond
   (" ([^ ]*) "
    (1 otf:thai))
   ("."
    =))
  *))

;; Copyright (C) 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:
