;; KHMR-MULE.flt -- Font Layout Table for Khmer (mule font)
;; Copyright (C) 2003, 2004, 2007  AIST (H15PRO112)
;; See the end for copying conditions.

(font layouter khmr-mule nil
      (font (mulekhmer-1)))

;;; <li> KHMR-MULE.flt
;;;
;;; For Khmer fonts of mule encoding to draw Khmer script.  The font is
;;; available at: <ftp://ftp.m17n.org/m17n-fonts/>

(category
 (0x1780 0x17A2	?C) ;; C: CONSONANT (except R and KHMER LETTER LA)
 (0x179A	?R) ;; R: KHMER LETTER RO
 (0x17A1	?E) ;; E: ELSE
 (0x17A3 0x17A4	?E)
 (0x17A5 0x17B3	?V) ;; V: INDEPENDENT VOWEL (except Q)
 (0x17A7	?Q) ;; Q: CONJUNCT VOWEL QU, RY, QE
 (0x17AB	?Q)
 (0x17AF	?Q)
 (0x17B2	?C)
 (0x17B4 0x17FF	?E)
 (0x17B6 0x17C5	?v) ;; v: DEPENDENT VOWEL
 (0x17C6	?S) ;; S: COMBINING SIGN
 (0x17C9 0x17CA	?s) ;; s: SHIFT
 (0x17CB 0x17D3	?S)
 (0x17D2	?c) ;; c: KHMER SIGN COENG (function as virama)
 )

(generator
 (0
  (cond
   ("[CR](c[CRQ])?(cR)?s?v?S?"
    (cond
     (".(c[CRQ])(cR)?s?v?S?"
      < |
      ("(.)c(.)(c(.))?" (1 independent) (2 conjunct) (4 conjunct))
      vowel-and-sign *
      | > )
     ("[CR][svS][svS]*" < | independent vowel-and-sign * | > )
     ("." independent)))
   ("." independent))
  *)

 (independent
  (cond
   ((0x17D8)			0xD4 0x9B 0xD4)
   ((range 0x1780 0x17FF) 	0x80)))

 (conjunct
  (cond
   ((0x1783)	Br.Bc 0x43)
   ((0x1788)	Br.Bc 0x48)
   ((0x178D)	Br.Bc 0x4D)
   ((0x1794)	Br.Bc 0x54)
   ((0x1799)	Br.Bc 0x59)
   ((0x179A)	Bl<Bc 0x5A)
   ((range 0x179E 0x179F)	Br.Bc 0x5E)
   ((range 0x1780 0x17AF)	bc-tc 0x40)
   ))

 (vowel-and-sign
  (cond
   ((0x17B6)	Br.Bl 0xB6)
   ((0x17BB)	br+tr 0xBB)
   ((0x17BC)	bc-tc 0xBC)
   ((0x17BD)	bc-tc 0xBD)
   ((0x17BE)	tc.bc 0xB8 Bl.Br 0xC1)
   ((0x17BF)	Bl.Br 0xC1 Br.Bc 0x04)
   ((0x17C0)	Bl.Br 0xC1 Br.Bc 0x05)
   ((0x17C1)	Bl.Br 0xC1)
   ((0x17C2)	Bl.Br 0xC2)
   ((0x17C3)	Bl.Br 0xC3)
   ((0x17C4)	Bl.Br 0xC1 Br.Bl 0xB6)
   ((0x17C5)	Bl.Br 0xC1 Br.Bl 0x2D)
   ((0x17C9)	tr+br 0xC9)
   ((0x17CB)	tr+br 0xCB)
   ((0x17CE)	tr+br 0xCE)
   ((range 0x17B7 0x17D0)	tc+bc 0xB7))))

(category
 (0x00 0xFF	?E)
 (0x04 0x05	?V)
 (0x2D		?V)
 (0xB6		?V)
 (0xC6		?C)
 (0xCB		?R)
 (0xCC 0xCD	?C)
 (0xCE		?R)
 (0xCF 0xD0	?C)
 (0xD2		?E))

(generator
 (0
  (cond
   ("VC" = tc>20bc =)
   ("VR" = tr<20br =)
   ("." =))
  *))

(category
 (0x00 0xFF	?E) ;; E: else
 (0x40 0x6F	?c) ;; c: conjunct CONSONANT
 (0x49		?n) ;; n: conjunct KHMER LETTER NYO
 (0x59		?y) ;; y: conjunct KHMER LETTER YO
 (0x80 0xA2	?C) ;; C: first CONSONANT
 (0x89		?N) ;; N: first KHMER LETTER NYO
 (0xB2		?Q) ;; Q: KHMER INDEPENDENT VOWEL QOO TYPE TWO
 (0xC9 0xD1	?S))

(generator
 (0
  (cond
   (" [^ ][^ ][^ ]* "
    < =
    (cond
     ("N[cny]"	0x27 ((0x49) bc-tc 0x28) =)
     ("Qy"	0x2B))
    = * > )
   ("[^ ]*" = * ))
  *))

(category
 (0x00 0x7F	?n) ;; n: width:normal height:normal depth:deep
 (0x04 0x05	?V) ;; V: right part of KHMER VOWEL SIGN YA and IE
 (0x26		?w) ;; w: width:wide height:normal depth:deep
 (0x27		?W) ;; W: width:wide height:normal depth:normal
 (0x28		?w)
 (0x2A		?w)
 (0x2C		?N) ;; N: width:normal height:normal depth:normal
 (0x43		?w)
 (0x48 0x49	?w)
 (0x4D 0x4E	?w)
 (0x5A		?r) ;; r: conjunct KHMER LETTER RO
 (0x60		?w)
 (0x80 0xFF	?N)
 (0x83		?W)
 (0x84		?T) ;; T: width:normal height:high depth:normal
 (0x87		?T)
 (0x88 0x89	?W)
 (0x8A 0x8B	?T)
 (0x8D 0x8E	?W)
 (0x90		?T)
 (0x95		?T)
 (0x99		?W)
 (0x9B		?W)
 (0x9F 0xA0	?W)
 (0xA6		?W))

(generator
 (0
  (cond
   (" ([^ ]*) "
    <
    (1
     (cond
      ("(Wnr)([^V]*)(V)?(.*)" = *)
      ("(Tnr)([^V]*)(V)?(.*)"
       (1 = = ((0x5A) Bl<Bc 0x20) =) (2 = *) (3 high-deep-YA-IE =) (4 = *))
      ("(..r)([^V]*)(V)?(.*)"
       (1 = = ((0x5A) Bl<Bc 0x20) =) (2 = *) (3 deep-YA-IE =) (4 = *))
      ("(T[nw][^V]*)(V)?(.*)"
       (1 = *) (2 high-deep-YA-IE =) (3 = *))
      ("(.[nw][^V]*)(V)?(.*)"
       (1 = *) (2 deep-YA-IE =) (3 = *))
      ("(T^V*)(V)?(.*)"
       (1 = *) (2 high-YA-IE =) (3 = *))
      (".*" = *)))
    >)
   ("[^ ]*" = *))
  *)

 (deep-YA-IE
  ((range 0x04 0x05)	Br.Bc 0x24))

 (high-deep-YA-IE
  ((range 0x04 0x05)	Br.Bc 0x34))

 (high-YA-IE
  ((range 0x04 0x05)	Br.bc 0x14)))

;; 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.

;; Local Variables:
;; mode: lisp
;; End:
