From cd2d6d4795f8a4216ac5bc68aec56698fbd16b84 Mon Sep 17 00:00:00 2001 From: ntakahas Date: Fri, 19 Mar 2010 13:19:22 +0000 Subject: [PATCH] Rewritten to emulate the new OTF behaviour by using old fonts. --- FLT/BENG-OTF.flt | 276 +++++++++++++++++++++++++++++++++--------------- FLT/DEVA-OTF.flt | 287 ++++++++++++++++++++++++++++---------------------- FLT/GUJR-OTF.flt | 219 ++++++++++++++++++++++++--------------- FLT/MLYM-OTF.flt | 277 +++++++++++++++++++++++++++++++++---------------- FLT/ORYA-OTF.flt | 305 +++++++++++++++++++++++++++++++----------------------- 5 files changed, 855 insertions(+), 509 deletions(-) diff --git a/FLT/BENG-OTF.flt b/FLT/BENG-OTF.flt index 627c9ce..90221c6 100644 --- a/FLT/BENG-OTF.flt +++ b/FLT/BENG-OTF.flt @@ -1,36 +1,44 @@ -;; BENG-OTF.flt -- Font Layout Table for Bengali OpenType font -;; Copyright (C) 2004, 2007 AIST (H15PRO112) +;; BENG-OTF.flt -- Font Layout Table for Bengali OpenType fonts +;; Copyright (C) 2004, 2007, 2010 AIST (H15PRO112) ;; See the end for copying conditions. (font layouter beng-otf nil - (font (nil nil unicode-bmp :otf=beng=rphf))) + (version "1.6.0") + (font (nil nil unicode-bmp :otf=beng))) ;;;
  • BENG-OTF.flt ;;; ;;; For Bengali OpenType fonts to draw the Bengali script. +;; After-base glyph order for rendering: +;; 1. below form consonants +;; 2. below matra +;; 3. reph +;; 4. candrabindu (0981) +;; 5. post form consonants +;; 6. post matra +;; 7. anusvara (0982) and visarga (0983) + (category ;; X: generic ;; V: independent vowel - ;; C: consonant (except for R, B and Y) - ;; R: consonant RA - ;; B: consonant BA - ;; Y: consonant YA + ;; C: consonant + ;; B: BA + ;; Y: YA + ;; R: RA ;; T: KHANDA TA ;; n: NUKTA ;; H: HALANT ;; m: vowel sign (pre) ;; b: vowel sign (below) ;; p: vowel sign (post) - ;; A: vowel modifier (above) - ;; a: vowel modifier (post) - ;; Z: internal use - ;; N: ZWNJ (ZERO WIDTH NON-JOINER) - ;; J: ZWJ (ZERO WIDTH JOINER) + ;; a: vowel modifier (above) + ;; A: vowel modifier (post) + ;; N: ZWNJ + ;; J: ZWJ (0x0980 0x09FF ?X) ; generic - (0x0980 ?Z) ; internal use - (0x0981 ?A) ; SIGN CANDRABINDU - (0x0982 0x0983 ?a) ; SIGN ANUSVARA .. VISARGA + (0x0981 ?a) ; SIGN CANDRABINDU + (0x0982 0x0983 ?A) ; SIGN ANUSVARA .. VISARGA (0x0985 0x0994 ?V) ; LETTER A .. AU (0x0995 0x09B9 ?C) ; LETTER KA .. HA (0x09AC ?B) ; LETTER BA @@ -48,12 +56,18 @@ (0x09DC 0x09DF ?C) ; LETTER RRA .. YYA (0x09E0 0x09E1 ?V) ; LETTER VOCALIC RR, LL (0x09E2 0x09E3 ?b) ; VOWEL SIGN L .. LL - (0x09F0 0x09F1 ?C) ; LETTER RR WITH MIDDLE/LOWER DIAGONAL - (0x0964 0x0965 ?X) ; DANDA .. DOUBLE DANDA + (0x09F0 ?R) ; LETTER RA WITH MIDDLE DIAGONAL + (0x09F1 ?C) ; LETTER RA WITH LOWER DIAGONAL + (0x200C ?N) ; ZWNJ (0x200D ?J) ; ZWJ + (0x25CC ?X) ; DOTTED CIRCLE + + (rphf ?r) + (pstf ?P) ) +;; Stage 0 ;; Preprocessing (generator (0 @@ -63,9 +77,11 @@ 0x09C7 0x09BE) ((0x09CC) 0x09C7 0x09D7) + ;; TA + HALANT + ZWJ -> KHANDA-TA ((0x09A4 0x09CD 0x200D) 0x09CE) + ;; consonant + NUKTA ((0x09A1 0x09BC) 0x09DC) @@ -73,119 +89,207 @@ 0x09DD) ((0x09AF 0x09BC) 0x09DF) + ("." =)) *)) -;; Syllable identification and reordering. +;; Stage 1 +;; Syllable identification (generator (0 (cond - ;; Khanda-Ta + ;; Syllables with an independent vowel + ("(RH)?(Vn?)((J?H[BYR])?m?b?p?n?a?A?)" + < | (1 = =) (2 :otf=beng=nukt+) (3 = *) | >) + + ;; KHANDA-TA combines only with reph. ("(RH)?(T)" - < | (2 =) (1 otf:beng=rphf+) | >) - - ;; A syllable with a pre-base vowel sign. - ;;1 2 3 4 5 6 7 8 9 - ("(RH)?([CRBY]n?(HCn?)*(H[RB])?(J?HY)?)(m)(p)?(A)?(a)?" - < | (6 =) (2 pre-below) (1 otf:beng=rphf+) (8 =) (2 post) (7 =) (9 =) | >) - - ;; A syllable with a non-pre-base vowel sign. - ;;1 2 3 4 5 6 78 9 10 11 - ("(RH)?([CRBY]n?(HCn?)*(H[RB])?(J?HY)?)(N)?J?((b)|(p))(A)?(a)?" - < | (6 =) (2 pre-below) (8 =) (1 otf:beng=rphf+) (10 =) - (2 post) (9 =) (11 =) | >) - - ;; A syllable with a vowel modifier and no vowel signs. - ;;1 2 3 4 5 67 8 - ("(RH)?([CRBY]n?(HCn?)*(H[RB])?(J?HY)?)((A)|(a))" - < | (2 pre-below) (1 otf:beng=rphf+) (7 =) (2 post) (8 =) | >) - - ;; A syllable ending with a halant. - ;;1 2 3 4 5 6 - ("(RH)?([CRBY]n?(HCn?)*(H[RB])?(J?HY)?)(HN?)?" - < | (2 pre-below) (6 =) (1 otf:beng=rphf+) (2 post) | >) - - ;; A syllable starting with an independent vowel. - ;;1 2 3 4 5 6 - ("(V)(J?(H)(Y)(p))?(A?a?)" - < | (1 =) 0x0980 (4 =) (3 =) (5 =) (6 = *) | >) + < (2 =) (1 :otf=beng=rphf+) >) + + ;; Consonant-based syllables + ;;1 23 4 + ("([CBYR]n?((J?H|HJ?)[CBYR]n?)*)(H[NJ]?|m?([NJ]?b)?p?n?a?A?)" + < | (1 :otf=beng=nukt,akhn+) + (4 (cond ("HJ" = =) + ("(H)N?" (1 =) 0x200C) + (".+" = *))) | >) + + ;; Two-part vowel signs + ((0x09C7 0x09BE) + (cond + ((font-facility 0x25CC) < 0x09C7 0x25CC 0x09BE >) + (".+" < 0x09CB >))) + ((0x09C7 0x09D7) + (cond + ((font-facility 0x25CC) < 0x09C7 0x25CC 0x09D7 >) + (".+" < 0x09CC >))) + + ;; Combining marks are displayed with a DOTTED CIRCLE. + ("m" + (cond + ((font-facility 0x25CC) < = 0x25CC >) + ("." [ = ]))) + ("[nHbpaA]" + (cond + ((font-facility 0x25CC) < 0x25CC = >) + ("." [ = ]))) + + ;; Isolated blwf and pstf are displayed with a DOTTED CIRCLE in the + ;; next stage. + ("(J)(H)([BYR])" + < | (1 =) (3 =) (2 =) | >) + + ("." =)) + *)) + +;; Stage 2 +;; Reorder halant for blwf and pstf +(generator + (0 + (cond + ;; Isolated blwf and pstf + (" J([BYR]H) " + (cond + ((font-facility 0x25CC) < 0x25CC (1 :otf=beng=blwf,pstf+) >) + (" J([BYR]H) " [ (1 :otf=beng=blwf,pstf+) ]))) + + ;; Syllables with an overt halant + (" (RHJ?)?([^ ]+)(HN) " + | (1 = *) (2 reorder) (3 = =) |) + + ;; Ordinary syllables + (" (RHJ?)?([^mbpaA ]*[^mbpaANJ ])(m?([NJ]?b)?p?n?a?A?) " + | (1 = *) (2 reorder) (3 = *) |) ("." =)) *) - ;; Move a halant after the base consonant to the end. - ;; Put a special mark after the final belew-base consonant. - ;; Remove post-base parts. - (pre-below + (reorder + ("(.|.+[^YJ])((J?HY)*)$" + (1 reorder-BR) (2 reorder-Y))) + + ;; Unlike Devanagari and Gujarati, vattu in Bengali does not have a + ;; half form. Therefore the sequence CHRHC can be safely reordered + ;; as CRHHC. Same for CHBHC. + (reorder-BR (cond - ("(.+)(H)([RB])(J?HY)?$" - (1 = *) (3 =) (2 =) 0x0980) - ("([^J]+)J?HY$" - (1 = *) 0x0980) - (".+" - = * 0x0980))) - - ;; Extract post-base parts and add a halant at the end. - ;; Produce nothing if there are no post-base parts. - (post + ("J?(H)([BR])(.*)" + (2 =) (1 =) (3 reorder-BR)) + ("(.)(.*)" + (1 =) (2 reorder-BR)))) + + (reorder-Y + ("J?(H)(Y)(.*)" + (2 =) (1 =) (3 reorder-Y))) + ) + +;; Stage 3 +;; Language forms and matra reordering +(generator + (0 (cond - (".*(H)(Y)$" - (2 =) (1 =))))) + ;; Overt halant forms + (" (RHJ?)?([^ ]+)(HN) " + | + (1 (cond ("RHJ" :otf=beng=half+) + ("RH" :otf=beng=rphf+))) + (2 b4post) (2 post) (3 = =) |) + + ;; Syllables with a below matra + ;; 1 2 3 4 5 + (" (RHJ?)?([^mb]*[^mbNJ])(mn?)?([NJ]?bn?)(p?n?a?A?) " + | (3 = *) + (1 (cond ("RHJ" :otf=beng=half+) + ("RH" :otf=beng=rphf+))) + (2 b4post) (4 = *) (2 post) (5 = *) |) + + ;; Other syllables + ;; 1 2 3 4 + (" (RHJ?)?([^mpaA ]*)(mn?)?(p?n?a?A?) " + | (3 = *) + (1 (cond ("RHJ" :otf=beng=half+) + ("RH" :otf=beng=rphf+))) + (2 b4post) (2 post) (4 = *) |) + + ("." =)) + *) + + ;; FIXME: When the constant C has both half and blwf, the partial + ;; sequence CHJ changes into blwf, instead of half, unless it is + ;; placed at the beginning of a syllable. + (b4post + ("(.|.+[^YH]H?)(YH)*$" + (1 (cond ("(.H)(.+)" (1 :otf=beng=half+) (2 :otf=beng=blwf,half,vatu+)) + (".+" :otf=beng=blwf,half,vatu+))))) -;; Apply 'nukt' and 'akhn'. + (post + ("(.|.+[^YH]H?)((YH)+)$" + (2 :otf=beng=pstf+))) + ) + +;; Stage 4 +;; Final reordering #1 (Move pre-base matra after the last halant) (generator (0 (cond - (" ([^Z]+)(Z[^ ]*) " - | (1 otf:beng=nukt,akhn+) (2 = *) |) + ;; 1 2 3 + (" (mn?)([^ ]+HJ?)([^H ]+) " + | (2 = *) (1 = *) (3 = *) |) + ("." =)) *)) -;; Apply 'blwf' and 'pstf' to the concerning parts. +;; Stage 5 +;; Final reordering #2 (Move reph after the first halant) (generator (0 (cond - (" (N?m?.)([^Z]*)(Z)([^ ]*) " - | (1 = *) (2 otf:beng=blwf+) (3 =) (4 otf:beng=pstf+) |) + ;; Syllables with a reph and an explicit halant + ;; 1 2 3 4 + (" (mn?)?(r)([^HP ]+HJ?)([^ ]*) " + | (1 = *) (3 = *) (2 =) (4 = *) |) + + ;; A reph without explicit halant + ;; 1 2 3 4 + (" (mn?)?(r)([^PpaA ]+)(P*(HN)?p?n?a?A?) " + | (1 = *) (3 = *) (2 =) (4 = *) |) + ("." =)) *)) -;; Get pre-base and below-base conjuncts. +;; Stage 6 +;; Nukta for matra and Presentation forms (generator (0 (cond - (" (N?m?)([^Z]+)(Z)([^ ]*) " - | (1 = *) (2 otf:beng=half,vatu,pres,blws+) (3 =) (4 = *) |) + (" (mn?)?([^ ]+) " + | (1 :otf=beng=nukt,init+) (2 :otf=beng=nukt,pres,abvs,blws,psts,haln+) |) + ("." =)) *)) -;; 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. +;; Stage 7 +;; Remove ZWNJ/ZWJ (generator (0 (cond - (" (N)?(m)([^Z]+)([^Z])Z([^ ]*) " - | (1 =) (3 = *) (2 =) (4 =) (5 = *) |) - (" ([^Z]+)Z([^ ]*) " - | (1 = *) (2 = *) |) + ("[NJ]") + ("." =)) *)) -;; Get matra conjuncts. -;; Do not apply 'blws' to syllables that begins with ZWNJ. +;; Stage 8 +;; GPOS processing (generator (0 (cond - (" N([^ ]+) " - (1 otf:beng=init,pres,abvs,psts,haln+abvm,blwm,dist)) (" ([^ ]+) " - (1 otf:beng=init,pres,abvs,blws,psts,haln+abvm,blwm,dist)) - ("." - [ = ])) + (1 :otf=beng=+abvm,blwm,dist)) + + ("." =)) *)) -;; Copyright (C) 2004, 2007 +;; Copyright (C) 2004, 2007, 2010 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 diff --git a/FLT/DEVA-OTF.flt b/FLT/DEVA-OTF.flt index 71913a9..f14a465 100644 --- a/FLT/DEVA-OTF.flt +++ b/FLT/DEVA-OTF.flt @@ -1,16 +1,34 @@ -;; DEVA-OTF.flt -- Font Layout Table for Devanagari OpenType font -;; Copyright (C) 2003, 2004, 2007, 2008 AIST (H15PRO112) +;; DEVA-OTF.flt -- Font Layout Table for Devanagari OpenType fonts +;; Copyright (C) 2003, 2004, 2007, 2008, 2010 AIST (H15PRO112) ;; See the end for copying conditions. (font layouter deva-otf nil - (font (nil nil unicode-bmp :otf=deva=rphf))) + (version "1.6.0") + (font (nil nil unicode-bmp :otf=deva))) ;;;
  • DEVA-OTF.flt ;;; ;;; For Devanagari OpenType fonts to draw the Devanagari script. +;; Accepted modifier sequence: +;; 1. matra (pre, below, above, post) +;; 2. candrabindu (0901) or anusvara (0902) +;; 3. udatta (0951) or anudatta (0952) +;; 4. grave (0953) or acute (0954) +;; 5. visarga (0903) + +;; Rendering glyph order: +;; 1. below matra +;; 2. anudatta (0952) +;; 3. above- or post matra +;; 4. reph +;; 5. candrabindu (0901) or anusvara (0902) +;; 6. udatta (0951) +;; 7. visarga (0903) + (category ;; X: generic + ;; V: independent vowel ;; C: consonant (except for RA) ;; R: consonant RA ;; n: NUKTA @@ -19,18 +37,16 @@ ;; 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 + ;; a: vowel modifier (above) + ;; A: vowel modifier (post) + ;; s: stress sign / accent (above) + ;; S: stress sign (below) ;; Z: internal use ;; N: ZWNJ ;; J: ZWJ (0x0900 0x097F ?X) ; generic - (0x0900 ?Z) ; internal use - (0x0901 0x0902 ?A) ; SIGN CANDRABINDU .. ANUSVARA - (0x0903 ?a) ; SIGN VISARGA + (0x0900 0x0902 ?a) ; SIGN INVERTED CANDRABINDU .. ANUSVARA + (0x0903 ?A) ; SIGN VISARGA (0x0904 0x0914 ?V) ; LETTER SHORT A .. AU (0x0915 0x0939 ?C) ; LETTER KA .. HA (0x0930 ?R) ; LETTER RA @@ -42,24 +58,30 @@ (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 + (0x094E ?m) ; VOWEL SIGN PRISHTHAMATRA E + (0x0951 ?s) ; STRESS SIGN UDATTA + (0x0952 ?S) ; STRESS SIGN ANUDATTA + (0x0953 0x0954 ?t) ; GRAVE ACCENT .. ACUTE ACCENT + (0x0955 ?u) ; VOWEL SIGN CHANDRA LONG E (0x0958 0x095F ?C) ; LETTER QA .. YYA (0x0960 0x0961 ?V) ; LETTER VOCALIC RR .. VOCALIC LL (0x0962 0x0963 ?b) ; VOWEL SIGN VOCALIC L .. VOCALIC LL (0x0972 ?V) ; LETTER CANDRA A - (0x097B 0x097C ?C) ; LETTER GGA .. JJA - (0x097E 0x097F ?C) ; LETTER DDDA .. BBA + (0x0979 0x097F ?C) ; LETTER ZHA .. BBA + (0x200C ?N) ; ZWNJ (0x200D ?J) ; ZWJ + (0x25CC ?X) ; DOTTED CIRCLE + + (rphf ?r) ) ;; Stage 0 -;; Compose consonant and nukta +;; Preprocessing (generator (0 (cond + ;; Compose a consonant and a nukta ((0x0928 0x093C) 0x0929) ((0x0930 0x093C) 0x0931) ((0x0933 0x093C) 0x0934) @@ -71,144 +93,167 @@ ((0x0922 0x093C) 0x095D) ((0x092B 0x093C) 0x095E) ((0x092F 0x093C) 0x095F) + ("." =)) *)) ;; Stage 1 -;; Syllable identification and eordering. +;; Syllable identification +(generator + (0 + (cond + ;; Syllables with an independent vowel + ;; + ("(RH)?(Vn?)((J?HR)?m?u?b?p?n?a?[sS]?t?A?)" + < | (1 = =) (2 :otf=deva=nukt+) (3 = *) | >) + + ;; Consonant-based syllables + ;;1 23 4 + ("([CR]n?((J?H|HJ?)[CR]n?)*)(H[NJ]?|m?u?b?p?n?a?[sS]?t?A?)" + < | (1 :otf=deva=nukt,akhn+) + (4 (cond ("HJ" = =) + ("(H)N?" (1 =) 0x200C) + (".+" = *))) | >) + + ;; Combining marks are displayed with a DOTTED CIRCLE. + ("m" + (cond + ((font-facility 0x25CC) < = 0x25CC >) + ("." [ = ]))) + ("[nHubpaSsA]" + (cond + ((font-facility 0x25CC) < 0x25CC = >) + ("." [ = ]))) + + ;; Isolated blwf is displayed with a DOTTED CIRCLE in the next stage. + ("(J)(H)(R)" + < | (1 =) (3 =) (2 =) | >) + + ("." =)) + *)) + +;; Stage 2 +;; Reorder halant for blwf (generator (0 (cond - ;; A syllable containing a vowel sign. - ;;1 2 34 5 6 7 8 9 10 - ("([CR]n?(HJ?[CR]n?)*)((m)|(b)|(u|p))(A)?(a)?(S)?(s)?" - < | (4 =) (1 move-h) (5 =) (10 =) (6 =) (1 reph) (7 =) (9 =) (8 =) | >) - - ;; A syllable without vowel signs but with a vowel modifier. - ;;1 2 34 5 6 7 - ("([CR]n?(HJ?[CR]n?)*)((A)|(a))(S)?(s)?" - < | (1 move-h) (7 =) (1 reph) (4 =) (6 =) (5 =) | >) - - ;; No vowel signs, No vowel modifiers, but with a stress sign or an accent. - ;;1 2 34 5 - ("([CR]n?(HJ?[CR]n?)*)((S)|(s))" - < | (1 move-h) (5 =) (1 reph) (4 =) | >) - - ;; No marks at all. Need further anylysis. - ("[CR]n?(HJ?[CR]n?)*(H(N|J)?)?" - < | (0 nomarks) | >) - - ;; This combination is used in Marathi. - ((0x0905 0x0945) - < | = = | >) - - ;; A syllable starting with an independent vowel. - ;;1 2 3 4 5 - ("(V)(A)?(a)?(S)?(s)?" - < | (1 =) (5 =) (2 =) (4 =) (3 =) | >) + ;; Isolated blwf + (" J(RH) " + (cond + ((font-facility 0x25CC) < 0x25CC :otf=deva=blwf+ >) + (" J(RH) " [ (1 :otf=deva=blwf+) ]))) + + ;; Syllables with an overt halant + (" (RHJ?)?([^ ]+)(HN) " + | (1 = *) (2 reorder) (3 = =) |) + + ;; Ordinary syllables + (" (RHJ?)?([^mubpasStA ]+)(m?u?b?p?n?a?[sS]?t?A?) " + | (1 = *) (2 reorder) (3 = *) |) ("." =)) *) - (move-h + ;; In Devanagari and Gujarati, vattu has a half form. Thus we handle + ;; the sequence CHRHC as (CH)half + (RH)blwf + C instead of + ;; reordering and interpreting it as C + (RH)blwf + H + C. + (reorder (cond - ;; Starting with an eyelash-RA, which remains there. - ("(RHJ.+)(H)(R)$" - (1 = *) (3 =) (2 =)) - ("RHJ.*" - = *) - - ;; Starting with a reph, which is removed. - ("RH(.+)(H)(R)$" - (1 = *) (3 =) (2 =)) - ("RH(.+)" - (1 = *)) - - ("(.+)(H)(R)$" - (1 = *) (3 =) (2 =)) - (".+" - = *))) - - (reph + ("J?(H)(R)$" (2 =) (1 =)) + ("J?(HR)(.+)$" (1 = =) (2 reorder)) + ("(.)(.*)$" (1 =) (2 reorder)))) + ) + +;; Stage 3 +;; Language forms and matra reordering +(generator + (0 (cond - ("RHJ.*") - ("(RH).*" - (1 otf:deva=rphf+)))) + ;; Overt halant forms + (" (RHJ?)?([^ ]+)(HN) " + | + (1 (cond ("RHJ" :otf=deva=half+) + ("RH" :otf=deva=rphf+))) + (2 (cond ("(.H)(.+)" (1 :otf=deva=half+) (2 :otf=deva=blwf,half+)) + (".+" :otf=deva=blwf,half+))) + (3 = =) |) + + ;; Other syllables + ;; 1 2 3 4 5 6 7 8 + (" (RHJ?)?([^mubpasStA ]*)(mn?)?(un?)?(bn?)?(p?n?a?)(S)?(s?t?A?) " + | (3 = *) + (1 (cond ("RHJ" :otf=deva=half+) + ("RH" :otf=deva=rphf+))) + (2 (cond ("(.H)(.+)" (1 :otf=deva=half+) (2 :otf=deva=blwf,half+)) + (".+" :otf=deva=blwf,half+))) + (5 = *) (7 =) (4 = *) (6 = *) (8 = *) |) - (del-reph + ("." =)) + *)) + +;; Stage 4 +;; Final reordering #1 (Move pre-base matra after the last halant) +(generator + (0 (cond - ("RHJ.*" - = *) - ("RH(.*)" - (1 = *)) - (".+" - = *))) - - (nomarks + ;; 1 2 3 + (" (mn?)([^ ]+HJ?)([^H ]+) " + | (2 = *) (1 = *) (3 = *) |) + + ("." =)) + *)) + +;; Stage 5 +;; Final reordering #2 (Move reph after the first halant) +(generator + (0 (cond - ;; Ending with a Halant and a ZWJ. - (".+HJ$" - (0 del-reph) (0 reph)) + ;; Syllables with a reph and an explicit halant + ;; 1 2 3 4 + (" (mn?)?(r)([^H ]+HJ?)([^ ]*) " + | (1 = *) (3 = *) (2 =) (4 = *) |) - ;; Ending with a Halant and an optional ZWNJ. Add ZWNJ explicitly. - ("(.+)(H)N?$" - (1 move-h) (1 reph) (2 =) 0x200C) + ;; A reph without explicit halant + ;; 1 2 3 4 + (" (mn?)?(r)([^astA ]+)(a?s?t?A?) " + | (1 = *) (3 = *) (2 =) (4 = *) |) - ;; Ending with a consonant. - (".+" - (0 move-h) (0 reph)))) - ) + ("." =)) + *)) -;; Stage 2 -;; Apply GSUB features. If a syllable ends with a halant and a ZWNJ, -;; render the final halant explicitly. +;; Stage 6 +;; Nukta for matra, vattu and presentation forms (generator (0 (cond - ;; Allow eyelash RA to appear at the beginning. - (" (RH)J([^ ]+)(H)N " - | (1 otf:deva=half+) (2 gsub) (3 =) |) - (" (m)?(RH)J([^ ]*) " - | (1 =) (2 otf:deva=half+) (3 gsub) |) - - ;; Avoid applying 'blwf' and 'half' to the "RH" at the beginning; - (" (R)([^ ]*)(H)N " - | (1 =) (2 gsub) (3 =) |) - (" (m?R)([^ ]*) " - | (1 otf:deva=pres+) (2 gsub) |) - - (" ([^ ]+)(H)N " - | (1 gsub) (2 =) |) (" ([^ ]+) " - | (1 gsub) |) + | (1 :otf=deva=nukt,vatu,pres,abvs,blws,psts,haln+) |) ("." =)) - *) + *)) - ;; Dispite Rule R5a (The Unicode Standard 5.0, p.305), we use the - ;; below form to depict the sequence "RHJ" at non-initial positions. - ;; This is to avoid interpreting the sequence "CHRHJ" as "CH" + - ;; "RHJ". It should be parsed as "CHR" + "HJ". - (gsub +;; Stage 7 +;; Remove ZWNJ/ZWJ +(generator + (0 (cond - ("([^J]*)J(.*)" - (1 otf:deva=nukt,akhn,blwf,half,vatu,pres+) (2 gsub)) - (".*" - otf:deva=nukt,akhn,blwf,half,vatu,pres+))) - ) + ("[NJ]") -;; Stage 3 -;; Apply other features. + ("." =)) + *)) + +;; Stage 8 +;; GPOS processing (generator (0 (cond (" ([^ ]+) " - (1 otf:deva=abvs,blws,psts,haln+abvm,blwm,dist)) - ("." - [ = ])) + (1 :otf=deva=+abvm,blwm,dist)) + + ("." =)) *)) -;; Copyright (C) 2003, 2004, 2007, 2008 +;; Copyright (C) 2003, 2004, 2007, 2008, 2010 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 diff --git a/FLT/GUJR-OTF.flt b/FLT/GUJR-OTF.flt index 4711ca1..d01e7d3 100644 --- a/FLT/GUJR-OTF.flt +++ b/FLT/GUJR-OTF.flt @@ -1,150 +1,207 @@ ;; GUJR-OTF.flt -- Font Layout Table for Gujarati OpenType fonts -;; Copyright (C) 2004, 2007 AIST (H15PRO112) +;; Copyright (C) 2004, 2007, 2010 AIST (H15PRO112) ;; See the end for copying conditions. (font layouter gujr-otf nil - (font (nil nil unicode-bmp :otf=gujr=rphf))) + (version "1.6.0") + (font (nil nil unicode-bmp :otf=gujr))) ;;;
  • GUJR-OTF.flt ;;; ;;; For Gujarati OpenType fonts to draw the Gujarati script. (category - ;; C: consonant (except for RA) - ;; R: consonant RA + ;; X: generic + ;; V: independent vowel + ;; C: consonant + ;; R: 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) - ;; V: independent vowel + ;; a: vowel modifier (above) + ;; A: vowel modifier (post) ;; N: ZWNJ ;; J: ZWJ - ;; X: generic (0x0A80 0x0AFF ?X) ; generic - (0x0A81 0x0A82 ?A) ; SIGN CANDRABINDU .. ANUSVARA - (0x0A83 ?a) ; SIGN VISARGA - (0x0A85 0x0A94 ?V) ; LETTER AA .. AU - (0x0A95 0x0AB9 ?C) ; LETTER KA .. HA + (0x0A81 0x0A82 ?a) ; SIGN CANDRABINDU .. ANUSVARA + (0x0A83 ?A) ; SIGN VISARGA + (0x0A85 0x0A94 ?V) ; LETTER A .. AU + (0x0A95 0x0AB9 ?C) ; LETTER KA .. HA (0x0AB0 ?R) ; LETTER RA (0x0ABC ?n) ; SIGN NUKTA - (0x0ABE ?p) ; VOWEL SIGN AA + (0x0ABE ?p) ; VOWEL SIGN AA (0x0ABF ?m) ; VOWEL SIGN I (0x0AC0 ?p) ; VOWEL SIGN II - (0x0AC1 0x0AC4 ?b) ; VOWEL SIGN U .. VOCALIC RR + (0x0AC1 0x0AC4 ?b) ; VOWEL SIGN UU .. VOCALIC RR (0x0AC5 0x0AC8 ?u) ; VOWEL SIGN CANDRA E .. AI (0x0AC9 0x0ACC ?p) ; VOWEL SIGN CANDRA O .. AU (0x0ACD ?H) ; SIGN VIRAMA - (0x0AE0 0x0AE1 ?V) ; LETTER VOCALIC RR .. VOCALIC LL + (0x0AE0 0x0AE1 ?V) ; LETTER VOCALIC RR .. VOCALIC LL (0x0AE2 0x0AE3 ?b) ; VOWEL SIGN VOCALIC L .. VOCALIC LL - (0x0964 0x0965 ?X) ; DANDA .. DOUBLE DANDA + (0x200C ?N) ; ZWNJ (0x200D ?J) ; ZWJ + (0x25CC ?X) ; DOTTED CIRCLE + + (rphf ?r) ) -;; Syllable identification and reordering. +;; Stage 0 +;; Syllable identification (generator (0 (cond - ;; A syllable containing a vowel sign. - ;;1 2 34 5 6 - ("([CR]n?(HJ?[CR]n?)*)((m)|(b|u|p))(A|a)?" - < | (4 =) (1 move-h) (5 =) (1 reph) (6 =) | >) + ;; Syllables with an independent vowel + ("(RH)?(Vn?)((J?HR)?m?u?b?p?n?a?A?)" + < | (1 = =) (2 :otf=gujr=nukt+) (3 = *) | >) + + ;; Consonant-based syllables + ;;1 23 4 + ("([CR]n?((J?H|HJ?)[CR]n?)*)(H[NJ]?|m?u?b?p?n?a?A?)" + < | (1 :otf=gujr=nukt,akhn+) + (4 (cond ("HJ" = =) + ("(H)N?" (1 =) 0x200C) + (".+" = *))) | >) + + ;; Combining marks are displayed with a DOTTED CIRCLE. + ("m" + (cond + ((font-facility 0x25CC) < = 0x25CC >) + ("." [ = ]))) + ("[nHubpaA]" + (cond + ((font-facility 0x25CC) < 0x25CC = >) + ("." [ = ]))) + + ;; Isolated blwf is displayed with a DOTTED CIRCLE in the next stage. + ("(J)(H)(R)" + < | (1 =) (3 =) (2 =) | >) - ;; A syllable without vowel signs but with a vowel modifier. - ;;1 2 3 - ("([CR]n?(HJ?[CR]n?)*)(A|a)" - < | (1 move-h) (1 reph) (3 =) | >) + ("." =)) + *)) + +;; Stage 1 +;; Reorder halant for blwf +(generator + (0 + (cond + ;; Isolated blwf + (" J(RH) " + (cond + ((font-facility 0x25CC) < 0x25CC :otf=gujr=blwf+ >) + (" J(RH) " [ (1 :otf=gujr=blwf+) ]))) - ;; No marks at all. Need further anylysis. - ("[CR]n?(HJ?[CR]n?)*(H(N|J)?)?" - < | (0 nomarks) | >) + ;; Syllables with an overt halant + (" (RHJ?)?([^ ]+)(HN) " + | (1 = *) (2 reorder) (3 = =) |) - ;; A syllable starting with an independent vowel. - ("V(A|a)?" - < | = * | >) + ;; Ordinary syllables + (" (RHJ?)?([^mubpaA ]+)(m?u?b?p?n?a?A?) " + | (1 = *) (2 reorder) (3 = *) |) ("." =)) *) - (move-h + (reorder (cond - ("RH(.+)(H)(R)$" - (1 = *) (3 =) (2 =)) - ("RH(.+)" - (1 = *)) - - ("(.+)(H)(R)$" - (1 = *) (3 =) (2 =)) - (".+" - = *))) + ("J?(H)(R)$" (2 =) (1 =)) + ("J?(HR)(.+)$" (1 = =) (2 reorder)) + ("(.)(.*)$" (1 =) (2 reorder)))) + ) - (reph +;; Stage 2 +;; Language forms and matra reordering +(generator + (0 (cond - ("(RH).*" - (1 otf:gujr=rphf+)))) + ;; Overt halant forms + (" (RHJ?)?([^ ]+)(HN) " + | + (1 (cond ("RHJ" :otf=gujr=half+) + ("RH" :otf=gujr=rphf+))) + (2 (cond ("(.H)(.+)" (1 :otf=gujr=half+) (2 :otf=gujr=blwf,half+)) + (".+" :otf=gujr=blwf,half+))) + (3 = =) |) + + ;; Other syllables + ;; 1 2 3 4 5 6 + (" (RHJ?)?([^mubpaA ]*)(mn?)?(un?)?(bn?)?(p?n?a?A?) " + | (3 = *) + (1 (cond ("RHJ" :otf=gujr=half+) + ("RH" :otf=gujr=rphf+))) + (2 (cond ("(.H)(.+)" (1 :otf=gujr=half+) (2 :otf=gujr=blwf,half+)) + (".+" :otf=gujr=blwf,half+))) + (5 = *) (4 = *) (6 = *) |) - (del-reph + ("." =)) + *)) + +;; Stage 3 +;; Final reordering #1 (Move pre-base matra after the last halant) +(generator + (0 (cond - ("(RH)?(.*)" - (2 = *)))) + ;; 1 2 3 + (" (mn?)([^ ]+HJ?)([^H ]+) " + | (2 = *) (1 = *) (3 = *) |) - (nomarks + ("." =)) + *)) + +;; Stage 4 +;; Final reordering #2 (Move reph after the first halant) +(generator + (0 (cond - ;; Ending with a Halant and a ZWJ. - (".+HJ$" - (0 del-reph) (0 reph)) + ;; Syllables with a reph and an explicit halant + ;; 1 2 3 4 + (" (mn?)?(r)([^H ]+HJ?)([^ ]*) " + | (1 = *) (3 = *) (2 =) (4 = *) |) - ;; Ending with a Halant and an optional ZWNJ. Add ZWNJ explicitly. - ("(.+)(H)N?$" - (1 move-h) (1 reph) (2 =) 0x200C) + ;; A reph without explicit halant + ;; 1 2 3 4 + (" (mn?)?(r)([^aA ]+)(a?A?) " + | (1 = *) (3 = *) (2 =) (4 = *) |) - ;; Ending with a consonant. - (".+" - (0 move-h) (0 reph)))) - ) + ("." =)) + *)) -;; Apply GSUB features. If a syllable ends with a halant and a ZWNJ, -;; render the final halant explicitly. Do not apply 'blwf' to the -;; initial RA. +;; Stage 5 +;; Nukta for matra, vattu and presentation forms (generator (0 (cond - (" (R)([^ ]*)(H)N " - | (1 =) (2 gsub) (3 =) |) - (" (m?R)([^ ]*) " - | (1 otf:gujr=pres+) (2 gsub) |) - - (" ([^ ]+)(H)N " - | (1 gsub) (2 =) |) (" ([^ ]+) " - | (1 gsub) |) + | (1 :otf=gujr=nukt,vatu,pres,abvs,blws,psts,haln+) |) ("." =)) - *) + *)) - (gsub +;; Stage 6 +;; Remove ZWNJ/ZWJ +(generator + (0 (cond - ("([^J]*)J(.*)" - (1 otf:gujr=nukt,akhn,blwf,half,vatu,pres+) (2 gsub)) - (".*" - otf:gujr=nukt,akhn,blwf,half,vatu,pres+))) - ) + ("[NJ]") -;; Apply other features. + ("." =)) + *)) + +;; Stage 7 +;; GPOS processing (generator (0 (cond (" ([^ ]+) " - (1 otf:gujr=abvs,blws,psts,haln+abvm,blwm,dist)) - ("." - [ = ])) + (1 :otf=gujr=+abvm,blwm,dist)) + + ("." =)) *)) -;; Copyright (C) 2004, 2007 +;; Copyright (C) 2004, 2007, 2010 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 diff --git a/FLT/MLYM-OTF.flt b/FLT/MLYM-OTF.flt index 1fc9ef5..01c18e5 100644 --- a/FLT/MLYM-OTF.flt +++ b/FLT/MLYM-OTF.flt @@ -1,44 +1,39 @@ -;; MLYM-OTF.flt -- Font Layout Table for Malayalam OpenType font -;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 AIST (H15PRO112) +;; MLYM-OTF.flt -- Font Layout Table for Malayalam OpenType fonts +;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 AIST (H15PRO112) ;; See the end for copying conditions. (font layouter mlym-otf nil - (font (nil nil unicode-bmp :otf=mlym=akhn))) + (version "1.6.0") + (font (nil nil unicode-bmp :otf=mlym))) ;;;
  • MLYM-OTF.flt ;;; ;;; For Malayalam OpenType fonts to draw the reformed Malayalam script. -;; Tested with the following fonts. All of these fonts require Halant -;; movement for syllable-final YA and VA, but not for RA and LA. +;; AnjaliOldLipi.ttf, Dyuthi3.ttf, Meera_04.ttf, Rachana_04.ttf, suruma2.ttf +;; blwf: 0d32 +;; pstf: 0d2f 0d30 0d35 -;; AnjaliOldLipi.ttf -;; Dyuthi3.ttf -;; Kalyani121.ttf -;; Meera_04.ttf -;; Rachana_04.ttf ;; RaghuMalayalamSans2.ttf -;; suruma2.ttf +;; blwf: 0d32 +;; pstf: 0d2f 0d30 0d35 0d41 + +;; lohit_ml.ttf +;; blwf: 0d32 +;; pstf: 0d2f 0d30 0d31 0d35 0d41 + +;; Kalyani121.ttf +;; blwf: N/A +;; pstf: 0d2f 0d30 0d32 0d35 0d41 (category - ;; C: ordinary consonants (except P) - ;; P: consonants that have a post form - ;; H: HALANT - ;; m: vowel sign (pre) - ;; b: vowel sign (below) - ;; p: vowel sign (post) - ;; A: vowel modifier (post) - ;; V: independent vowel - ;; N: ZWNJ (ZERO WIDTH NON-JOINER) - ;; J: ZWJ (ZERO WIDTH JOINER) - ;; Z: internal use - ;; X: generic (0x0D00 0x0D7F ?X) ; generic - (0x0D00 ?Z) ; internal use (0x0D02 0x0D03 ?A) ; SIGN ANUSVARA .. VISARGA (0x0D05 0x0D14 ?V) ; LETTER A .. AU (0x0D15 0x0D39 ?C) ; LETTER KA .. HA (0x0D2F ?P) ; LETTER YA + (0x0D30 ?R) ; LETTER RA + (0x0D32 ?B) ; LETTER LA (0x0D35 ?P) ; LETTER VA (0x0D3E 0x0D44 ?p) ; VOWEL SIGN AA .. VOCALIC RR (0x0D46 0x0D48 ?m) ; VOWEL SIGN E .. AI @@ -46,119 +41,217 @@ (0x0D57 ?p) ; AU LENGTH MARK (0x0D60 0x0D61 ?V) ; LETTER VOCALIC RR .. VOCALIC LL (0x0D62 0x0D63 ?b) ; VOWEL SIGN VOCALIC L .. LL - (0x0964 0x0965 ?X) ; DANDA .. DOUBLE DANDA + (0x200C ?N) ; ZWNJ (0x200D ?J) ; ZWJ + (0x25CC ?X) ; DOTTED CIRCLE + + (pstf ?r) ) ;; Stage 0 -;; Decompose two-part vowels. +;; Preprocessing (generator (0 (cond - ((0x0D4A) - 0x0D46 0x0D3E) - ((0x0D4B) - 0x0D47 0x0D3E) - ((0x0D4C) - 0x0D46 0x0D57) + ;; Decompose two-part vowel signs + ((0x0D4A) 0x0D46 0x0D3E) + ((0x0D4B) 0x0D47 0x0D3E) + ((0x0D4C) 0x0D46 0x0D57) + + ;; Chillu letters + ((0x0D23 0x0D4D 0x200D) :otf=mlym=akhn,half,haln+) + ((0x0D28 0x0D4D 0x200D) :otf=mlym=akhn,half,haln+) + ((0x0D30 0x0D4D 0x200D) :otf=mlym=akhn,half,haln+) + ((0x0D32 0x0D4D 0x200D) :otf=mlym=akhn,half,haln+) + ((0x0D33 0x0D4D 0x200D) :otf=mlym=akhn,half,haln+) + ((0x0D15 0x0D4D 0x200D) :otf=mlym=akhn,half,haln+) + ("." =)) *)) ;; Stage 1 -;; Syllable identification and reordering. -;; Put the mark Z after the base consonant. +;; Syllable identification (generator (0 (cond - ;; A syllable with a left vowel sign. - ;;1 2 3 4 - ("([CP](H[CP])*)(m)(p?A?)" - < | (3 =) (1 move-h) (4 = *) | >) - - ;; A syllable with a right vowel sign, a below vowel sign - ;; and/or a vowel modifier. - ;;1 2 3 - ("([CP](H[CP])*)(bA?|pA?|A)" - < | (1 move-h) (3 = *) | >) - - ;; Forced chillu form. - ;;1 2 3 - ("([CP](H[CP])*)(HJ)" - < | (1 move-h) (3 = =) | >) - - ;; A syllable with no vowel signs/modifiers, optionally followed by - ;; an H or an HN. - ;;1 2 3 - ("([CP](H[CP])*)(H|HN)?" - < | (1 move-h) (3 0x0D4D) | >) - - ;; Starting with an independent vowel. - ("VA?" - < | (0 = *) | >) + ;; Consonant-based syllables + ;;1 23 4 + ("([CBPR]((J?H|HJ?)[CBPR])*)(H[NJ]?|m?p?A?)" + < | (1 :otf=mlym=akhn+) + (4 (cond ("HJ" = =) + ("(H)N?" (1 =) 0x200C) + (".+" = *))) | >) + + ;; Syllables with an independent vowel + ("V(J?H[BPR])?m?p?A?" + < | = * | >) + + ;; Two-part vowel signs + ((0x0D46 0x0D3E) + (cond + ((font-facility 0x25CC) < 0x0D46 0x25CC 0x0D3E >) + (".+" < 0x0D4A >))) + ((0x0D47 0x0D3E) + (cond + ((font-facility 0x25CC) < 0x0D47 0x25CC 0x0D3E >) + (".+" < 0x0D4B >))) + ((0x0D46 0x0D57) + (cond + ((font-facility 0x25CC) < 0x0D46 0x25CC 0x0D57 >) + (".+" < 0x0D4C >))) + + ;; Combining marks are displayed with a DOTTED CIRCLE. + ("m" + (cond + ((font-facility 0x25CC) < = 0x25CC >) + ("." [ = ]))) + ("[HbpA]" + (cond + ((font-facility 0x25CC) < 0x25CC = >) + ("." [ = ]))) + + ;; Isolated blwf and pstf are displayed with a DOTTED CIRCLE in the + ;; next stage. + ("(J)(H)([BPR])" + < | (1 =) (3 =) (2 =) | >) + + ("." =)) + *)) + +;; Stage 2 +;; Reorder halant for blwf and pstf +(generator + (0 + (cond + ;; Isolated blwf and pstf + (" J([BP]H) " + (cond + ((font-facility 0x25CC) < 0x25CC (1 :otf=mlym=blwf,pstf+) >) + (" J([BP]H) " [ (1 :otf=mlym=blwf,pstf+) ]))) + + ;; Isolated pref + (" J(RH) " + (cond + ((font-facility 0x25CC) < (1 :otf=mlym=pstf+) 0x25CC >) + (" J(RH) " [ (1 :otf=mlym=pstf+) ]))) + + ;; Overt halnt forms + (" ([^ ]+)(HN) " + | (1 reorder) (2 = =) |) + + ;; Ordinary syllables + (" ([^mbpA ]+)(m?p?A?) " + | (1 reorder) (2 = *) |) ("." =)) *) + (reorder + (cond + ;; pref after pstf + ("(.|.+[^PJ])((J?HP)*J?HR)$" + (1 reorder-B) (2 reorder-any)) + ;; pref between blwf and pstf + ("(.*[^J])(J?HR(J?HP)+)$" + (1 reorder-B) (2 reorder-any)) + ;; pref before blwf + ("(.*[^J])(J?HR(J?HB)+(J?HP)*)$" + (1 reorder-B) (2 reorder-any)) + ;; no pref + ("(.|.+[^PJ])((J?HP)*)$" + (1 reorder-B) (2 reorder-any)) + (".+" = *))) - ;; Move the halant that follows the base consonant to the end. - (move-h + (reorder-B (cond - ;; All consonants are P's. - ("(P)(H)([PH]*)$" - (1 =) 0x0D00 (3 = *) (2 =)) + ("J?(H)(B)(.*)" + (2 =) (1 =) (3 reorder-B)) + ("(.)(.*)" + (1 =) (2 reorder-B)))) - ;; One or more Non-P consonants. - ("([CPH]*C)(H)([PH]+)$" - (1 = *) 0x0D00 (3 = *) (2 =)) + (reorder-any + ("J?(H)(.)(.*)" + (2 =) (1 =) (3 reorder-any))) + ) - ;; Otherwise, final consonant is not P. No need to move H. - (".+" - = * 0x0D00))) +;; Stage 3 +;; Language forms and matra reordering +(generator + (0 + (cond + ;; Overt halant forms + (" ([^ ]+)(HN) " + | (1 blwf-pstf) (2 = =) |) + + ;; Other syllables + ;; 1 2 3 + (" ([^mpA ]+)(m)?(p?A?) " + | (2 =) (1 blwf-pstf) (3 = *) |) + + ("." =)) + *) + + (blwf-pstf + (cond + ;;1 23 4 + ("(.|.+BH|.+[^H])((PH)*)(RH)$" + (4 :otf=mlym=pstf) (1 :otf=mlym=blwf+) (2 :otf=mlym=pstf+)) + ;;1 2 3 + ("(.*)(RH)((PH)+)$" + (2 :otf=mlym=pstf+) (1 :otf=mlym=blwf+) (3 :otf=mlym=pstf+)) + ;;1 2 34 5 + ("(.*)(RH)((BH)+)((PH)*)$" + (2 :otf=mlym=pstf+) (1 :otf=mlym=blwf+) (3 :otf=mlym=blwf+) + (5 :otf=mlym=pstf+)) + ;;1 2 + ("(.|.+BH|.+[^H])((PH)*)$" + (1 :otf=mlym=blwf+) (2 :otf=mlym=pstf+)))) ) -;; Stage 2 -;; Apply GSUB features. +;; Stage 4 +;; Final reordering (Move pre-base matra and pref after the last halant) (generator (0 (cond - ;; The tested fonts make LA's below form with 1. 'half' + 'blws', - ;; 2. 'half' + 'pres' or 3. 'akhn'. - ;; 1 2 3 4 - (" (m)?([CPH]*)(Z)([PHbpAJ]*) " - | (1 =) (2 otf:mlym=akhn,half,pstf,pres,abvs,blws+) (3 =) - (4 otf:mlym=pstf+) |) + ;; With a pref, one or more intermediate- and a final overt halant forms. + ;; 1 2 3 + (" (r)([^ ]+HJ?)([^H ]+HN) " + | (2 = *) (1 =) (3 = *) |) + + ;; With a pref and a final overt halant form. Don't move the pref. + (" r[^H ]+HN " + = *) + + ;; 1 2 3 + (" (m?r?)([^ ]+HJ?)([^H ]+) " + | (2 = *) (1 = *) (3 = *) |) ("." =)) *)) -;; Stage 3 -;; Second reordering. If there are glyphs before the base, move left -;; vowel sign to the left of the base. +;; Stage 5 +;; Remove ZWNJ/ZWJ (generator (0 (cond - ;; 1 2 3 4 - (" (m)?([^Z ]*)([^Z])Z([^ ]*) " - | (2 = *) (1 =) (3 =) (4 = *) |) + ("[NJ]") ("." =)) *)) -;; Stage 4 -;; Apply remaining GSUB and GPOS features to all syllables. To get -;; correct Y.YA and V.VA conjunctions, we must apply 'psts' to the -;; entire syllable. +;; Stage 6 +;; GPOS processing (generator (0 (cond (" ([^ ]+) " - (1 otf:mlym=akhn,psts,haln+abvm,blwm,dist)) - ("." - [ = ])) + (1 :otf=mlym=+abvm,blwm,dist)) + + ("." =)) *)) -;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 +;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 diff --git a/FLT/ORYA-OTF.flt b/FLT/ORYA-OTF.flt index 2673409..de61eba 100644 --- a/FLT/ORYA-OTF.flt +++ b/FLT/ORYA-OTF.flt @@ -1,52 +1,38 @@ ;; ORYA-OTF.flt -- Font Layout Table for Oriya OpenType font -;; Copyright (C) 2004, 2007, 2008 AIST (H15PRO112) +;; Copyright (C) 2004, 2007, 2008, 2010 AIST (H15PRO112) ;; See the end for copying conditions. (font layouter orya-otf nil - (font (nil nil unicode-bmp :otf=orya=rphf))) + (version "1.6.0") + (font (nil nil unicode-bmp :otf=orya))) ;;;
  • ORYA-OTF.flt ;;; ;;; For Oriya OpenType fonts to draw the Oriya script. (category - ;; C: consonant (except for R, B and Y) - ;; R: consonant RA - ;; B: consonant (below) - ;; Y: consonant (post) - ;; n: NUKTA - ;; H: HALANT - ;; m: vowel sign (pre) - ;; u: vowel sign (above) - ;; b: vowel sign (below) - ;; p: vowel sign (post) - ;; t: vowel sign (two-part) - ;; A: vowel modifier (above) - ;; a: vowel modifier (post) - ;; V: independent vowel - ;; N: ZWNJ (ZERO WIDTH NON-JOINER) - ;; J: ZWJ (ZERO WIDTH JOINER) - ;; X: generic - ;; Z: internal use + ;; B: consonants that have a below form + ;; C: consonants that do not + ;; This table is made for Samyak-Oriya.ttf and utkal.ttf. + ;; (lohit_or.ttf has more below form consonants.) (0x0B00 0x0B7F ?X) ; generic - (0x0B00 ?Z) ; internal use - (0x0B01 0x0B03 ?a) ; SIGN CANDRABINDU .. VISARGA + (0x0B01 ?a) ; SIGN CANDRABINDU + (0x0B02 0x0B03 ?A) ; SIGN ANUSVARA .. VISARGA (0x0B05 0x0B14 ?V) ; LETTER A .. VOCALIC AU - (0x0B15 0x0B39 ?C) ; LETTER KA .. HA - (0x0B24 ?B) ; LETTER TA - (0x0B28 ?B) ; LETTER NA - (0x0B2C 0x0B2E ?B) ; LETTER BA .. MA + (0x0B15 0x0B39 ?B) ; LETTER KA .. HA + (0x0B18 0x0B1A ?C) ; LETTER GHA .. CA + (0x0B1E ?C) ; LETTER NYA + (0x0B22 ?C) ; LETTER DDHA + (0x0B25 0x0B26 ?C) ; LETTER THA .. DA (0x0B2F ?Y) ; LETTER YA (0x0B30 ?R) ; LETTER RA - (0x0B32 0x0B33 ?B) ; LETTER LA - (0x0B33 ?B) ; LETTER LLA + (0x0B36 0x0B37 ?C) ; LETTER SHA .. SSA (0x0B3C ?n) ; SIGN NUKTA (0x0B3E ?p) ; VOWEL SIGN AA (0x0B3F ?u) ; VOWEL SIGN I (0x0B40 ?p) ; VOWEL SIGN II (0x0B41 0x0B44 ?b) ; VOWEL SIGN U .. VOCALIC RR (0x0B47 ?m) ; VOWEL SIGN E - (0x0B48 0x0B4C ?t) ; VOWEL SIGN AI .. AU (0x0B4D ?H) ; SIGN VIRAMA (0x0B56 ?u) ; AI LENGTH MARK (0x0B57 ?p) ; AU LENGTH MARK @@ -55,11 +41,17 @@ (0x0B60 0x0B61 ?V) ; LETTER VOCALIC RR .. LL (0x0B62 0x0B63 ?b) ; VOWEL SIGN VOCALIC L .. LL (0x0B71 ?C) ; LETTER WA - (0x0B64 0x0B65 ?X) ; DANDA .. DOUBLE DANDA + (0x200C ?N) ; ZWNJ (0x200D ?J) ; ZWJ + (0x25CC ?X) ; DOTTED CIRCLE + + (rphf ?r) + (pstf ?P) ) +;; Stage 0 +;; Preprocessing (generator (0 (cond @@ -70,144 +62,199 @@ 0x0B47 0x0B3E) ((0x0B4C) 0x0B47 0x0B57) + ;; Compose consonant and nukta. ((0x0B21 0x0B3C) 0x0B5C) ((0x0B22 0x0B3C) 0x0B5D) - ;; Move ZWJ before the consonant. - ("([CRBY]n?)(J)" - (2 =) (1 = *)) + ("." =)) *)) -;; Syllable identification and reordering. -;; Do not apply 'rphf' if a syllable begins with a ZWJ. +;; Stage 1 +;; Syllable identification (generator (0 (cond - ;; A syllable with a ZWJ and a pre-base vowel sign. - ;;1 23 4 5 6 7 - ("(J)(([CRBY]n?H)*[CRBY]n?)(m)(u)?(p)?(a)?" - < | (1 =) (4 =) (2 pre-below) (5 =) (2 post) (6 =) (7 =) | >) - - ;; A syllable with a ZWJ and a non-pre-base vowel sign. - ;;1 23 45 6 7 - ("(J)(([CRBY]n?H)*[CRBY]n?)(([bu])|(p))(a)?" - < | (1 =) (2 pre-below) (5 =) (2 post) (6 =) (7 =) | >) - - ;; A syllable with a ZWJ and a vowel modifier, but without vowel signs. - ;;1 23 4 - ("(J)(([CRBY]n?H)*[CRBY]n?)(a)" - < | (1 =) (2 pre-below) (2 post) (4 =) | >) - - ;; Add a ZWNJ explicitly when a syllable ends with a halant. - ;;1 23 4 - ("(J)(([CRBY]n?H)*[CRBY]n?)(HN?)?" - < | (1 =) (2 pre-below) (4 = 0x200C) (2 post) | >) - - ;; With a pre-base vowel sign, without a ZWJ. - ;;1 23 4 5 6 7 - ("(RH)?(([CRBY]n?H)*[CRBY]n?)(m)(u)?(p)?(a)?" - < | - (4 =) (2 pre-below) (5 =) (1 otf:orya=rphf) (2 post) (6 =) (7 =) - | >) - - ;; With a non-pre-base vowel sign, without a ZWJ. - ;; 1 23 45 6 7 - ("(RH)?(([CRBY]n?H)*[CRBY]n?)(([bu])|(p))(a)?" - < | (2 pre-below) (5 =) (1 otf:orya=rphf) (2 post) (6 =) (7 =) | >) - - ;; With a vowel modifier, without vowel signs and a ZWJ. - ;;1 23 4 - ("(RH)?(([CRBY]n?H)*[CRBY]n?)(a)" - < | (2 pre-below) (1 otf:orya=rphf) (2 post) (4 =) | >) - - ;; Add a ZWNJ explicitly when a syllable ends with a halant. - ;;1 23 4 - ("(RH)?(([CRBY]n?H)*[CRBY]n?)(HN?)?" - < | (2 pre-below) (1 otf:orya=rphf) (4 = 0x200C) (2 post) | >) - - ;; A syllable starting with an independent vowel. - ("Va?" - < | = * | >) + ;; Syllables with an independent vowel + ("(RH)?(Vn?)((J?H[BYR])?m?u?b?p?n?a?A?)" + < | (1 = =) (2 :otf=orya=nukt+) (3 = *) | >) + + ;; Consonant-based syllables + ;;1 23 4 + ("([CBYR]n?((J?H|HJ?)[CBYR]n?)*)(H[NJ]?|m?u?b?p?n?a?A?)" + < | (1 :otf=orya=nukt,akhn+) + (4 (cond ("HJ" = =) + ("(H)N?" (1 =) 0x200C) + (".+" = *))) | >) + + ;; Two-part vowel signs + ((0x0B47 0x0B56) + (cond + ((font-facility 0x25CC) < 0x0B47 0x25CC 0x0B56 >) + (".+" < 0x0B48 >))) + ((0x0B47 0x0B3E) + (cond + ((font-facility 0x25CC) < 0x0B47 0x25CC 0x0B3E >) + (".+" < 0x0B4B >))) + ((0x0B47 0x0B57) + (cond + ((font-facility 0x25CC) < 0x0B47 0x25CC 0x0B57 >) + (".+" < 0x0B4C >))) + + ;; Combining marks are displayed with a DOTTED CIRCLE. + ("m" + (cond + ((font-facility 0x25CC) < = 0x25CC >) + ("." [ = ]))) + ("[nHubpaA]" + (cond + ((font-facility 0x25CC) < 0x25CC = >) + ("." [ = ]))) + + ;; Isolated blwf and pstf are displayed with a DOTTED CIRCLE in the + ;; next stage. + ("(J)(H)([BYR])" + < | (1 =) (3 =) (2 =) | >) + + ("." =)) + *)) + +;; Stage 2 +;; Reorder halant for blwf and pstf +(generator + (0 + (cond + ;; Isolated blwf and pstf + (" J([BYR]H) " + (cond + ((font-facility 0x25CC) < 0x25CC (1 :otf=orya=blwf,pstf+) >) + (" J([BYR]H) " [ (1 :otf=orya=blwf,pstf+) ]))) + + ;; Syllables with an overt halant + (" (RHJ?)?([^ ]+)(HN) " + | (1 = *) (2 reorder) (3 = =) |) + + ;; Ordinary syllables + (" (RHJ?)?([^mubpaA ]+)(m?u?b?p?n?a?A?) " + | (1 = *) (2 reorder) (3 = *) |) ("." =)) *) - ;; Move a halant after the base consonant to the end. - ;; Fill the resulting gap with a special mark. - ;; Remove post-base parts. - (pre-below + (reorder + ("(.|.+[^YJ])((J?HY)*)$" + (1 reorder-BR) (2 reorder-Y))) + + (reorder-BR (cond - ("([CRBYnH]*[CYn])H([RBH]+)[YH]+$" - (1 = *) 0x0B00 (2 = *)) - ("([CRBYnH]*[CYn])(H)([RBH]+)$" - (1 = *) 0x0B00 (3 = *) (2 =)) - ("([CRBYnH]*[Cn])[YH]*$" - (1 = *) 0x0B00) - ("([RB]n?)H([RBH]*)[YH]+$" - (1 = *) 0x0B00 (2 = *)) - ("([RB]n?)(H)([RBH]*)$" - (1 = *) 0x0B00 (3 = *) (2 =)) - ("([RBY]n?)[YH]*$" - (1 = *) 0x0B00))) - - ;; Extract post-base parts and add a halant at the end. - ;; Produce nothing if there are no post-base parts. - (post + ("J?(H)([BR])(.*)" + (2 =) (1 =) (3 reorder-BR)) + ("(.)(.*)" + (1 =) (2 reorder-BR)))) + + (reorder-Y + ("J?(H)(Y)(.*)" + (2 =) (1 =) (3 reorder-Y))) + ) + +;; Stage 3 +;; Language forms and matra reordering +(generator + (0 (cond - ("[CRBYnH]*[CRBn]H([YH]+)$" - (1 = *) 0x0B4D) - ("Yn?H([YH]+)$" - (1 = *) 0x0B4D) - (".+" - ))) + ;; Overt halant forms + (" (RHJ?)?([^ ]+)(HN) " + | + (1 (cond ("RHJ" :otf=orya=half+) + ("RH" :otf=orya=rphf+))) + (2 b4post) (2 post) (3 = =) |) + + ;; Other syllables + ;; 1 2 3 4 5 6 7 8 + (" (RHJ?)?([^mubpaA ]*)(mn?)?(un?)?(bn?)?(pn?)?(a)?(A)? " + | (3 = *) + (1 (cond ("RHJ" :otf=orya=half+) + ("RH" :otf=orya=rphf+))) + (2 b4post) (5 = *) (4 = *) (7 =) (2 post) (6 = *) (8 =) |) + + ("." =)) + *) + + (b4post + ("(.|.+[^YH]H?)(YH)*$" + (1 (cond ("(.H)(.+)" (1 :otf=orya=half+) (2 :otf=orya=blwf,half,vatu+)) + (".+" :otf=orya=blwf,half,vatu+))))) + + (post + ("(.|.+[^YH]H?)((YH)+)$" + (2 :otf=orya=pstf+))) ) -;; Apply language forms to concerning segments. +;; Stage 4 +;; Final reordering #1 (Move pre-base matra after the last halant) +(generator + (0 + (cond + ;; 1 2 3 + (" (mn?)([^ ]+HJ?)([^H ]+) " + | (2 = *) (1 = *) (3 = *) |) + + ("." =)) + *)) + +;; Stage 5 +;; Final reordering #2 (Move reph after the first halant) (generator (0 (cond - ;; If a syllable contains a ZWNJ, render the final halant explicitly. - (" ([^Z]+)(Z)([^N]*)(HN)([^ ]*) " - | (1 otf:orya=nukt,akhn,half,pres+) (2 =) (3 otf:orya=blwf+) (4 = =) - (5 otf:orya=pstf+) |) + ;; Syllables with a reph and an overt halant + ;; 1 2 3 4 + (" (mn?)?(r)([^HP ]+HJ?)([^ ]*) " + | (1 = *) (3 = *) (2 =) (4 = *) |) + + ;; A reph without overt halant + ;; 1 2 3 4 + (" (mn?)?(r)([^aPpA ]+)(a?P*(HN)?p?n?A?) " + | (1 = *) (3 = *) (2 =) (4 = *) |) + + ("." =)) + *)) - (" (J?m?)([^Z]+)(Z)([^ ]*) " - | (1 = *) (2 otf:orya=nukt,akhn,half,pres+) (3 =) (4 otf:orya=blwf,pstf+) |) +;; Stage 6 +;; Nukta for matra and Presentation forms +(generator + (0 + (cond + (" ([^ ]+) " + | (1 :otf=orya=nukt,pres,abvs,blws,psts,haln+) |) ("." =)) *)) -;; When the number of glyphs between a pre-base vowel sign and the -;; post-base mark is more than one, move the pre-base vowel sign -;; before the final glyph. +;; Stage 7 +;; Remove ZWNJ/ZWJ (generator (0 (cond - (" (J)?(m)([^Z]+)([^Z])Z([^N ]*)N?([^ ]*) " - | (1 =) (3 = *) (2 =) (4 =) (5 = *) (6 = *)|) - (" ([^Z]+)Z([^N ]*)N?([^ ]*) " - | (1 = *) (2 = *) (3 = *) |) + ("[NJ]") + ("." =)) *)) -;; Apply other features. -;; Do not apply 'vatu' and 'blws' if there is a ZWJ. -;; The 'pres' feature is applied again for pre-base vowel sign. +;; Stage 8 +;; GPOS processing (generator (0 (cond - (" J([^ ]+) " - (1 otf:orya=pres,abvs,pstp,haln+abvm,blwm,dist)) (" ([^ ]+) " - (1 otf:orya=vatu,pres,abvs,blws,pstp,haln+abvm,blwm,dist)) - ("." - [ = ])) + (1 :otf=orya=+abvm,blwm,dist)) + + ("." =)) *)) -;; Copyright (C) 2004, 2007, 2008 +;; Copyright (C) 2004, 2007, 2008, 2010 ;; National Institute of Advanced Industrial Science and Technology (AIST) ;; Registration Number H15PRO112 -- 1.7.10.4