(0x200D ?J) ; ZWJ
)
+;; Stage 0
;; Compose consonant and nukta
(generator
(0
("." =))
*))
-;; Reordering
+;; Stage 1
+;; Syllable identification and eordering.
(generator
(0
(cond
(nomarks
(cond
- ;; Ending with a Halant and ZWJ.
+ ;; Ending with a Halant and a ZWJ.
(".+HJ$"
(0 del-reph) (0 reph))
(0 move-h) (0 reph))))
)
-;; Apply 'nukt' and 'akhn'.
-(generator
- (0
- (cond
- (" ([^ ]+) "
- | (1 otf:deva=nukt,akhn+) |)
- ("." =))
- *))
-
-;; Apply either 'half' or 'blwf' to consonants. If a syllable ends
-;; with a halant and a ZWNJ, render the final halant explicitly.
+;; Stage 2
+;; Apply GSUB features. If a syllable ends with a halant and a ZWNJ,
+;; render the final halant explicitly.
(generator
(0
(cond
(" (m)?(RH)J([^ ]*) "
| (1 =) (2 otf:deva=half+) (3 gsub) |)
- ;; Avoid applying 'half' and 'blwf' to the initial RA.
+ ;; Avoid applying 'blwf' and 'half' to the "RH" at the beginning;
(" (R)(.*)(H)N "
| (1 =) (2 gsub) (3 =) |)
(" (m?R)([^ ]*) "
- | (1 = *) (2 gsub) |)
+ | (1 otf:deva=pres+) (2 gsub) |)
(" (.+)(H)N "
| (1 gsub) (2 =) |)
("." =))
*)
- ;; Dispite Rule R5a (p.305), we use the below form to depict the
- ;; sequence "RHJ" at a non-initial position. This is to avoid
- ;; interpreting the sequence "CHRHJ" as "CH" + "RHJ". It should be
- ;; parsed as "CHR" + "HJ".
+ ;; Dispite Rule R5a (The Unicode Standard 5.0, p.305), we use the
+ ;; below form to depict the sequence "RHJ" at a non-initial position.
+ ;; This is to avoid interpreting the sequence "CHRHJ" as "CH" +
+ ;; "RHJ". It should be parsed as "CHR" + "HJ".
(gsub
- (cond
- ("(.H)J?(.*)"
- (1 otf:deva=blwf,half+) (2 gsub))
- ("(.)(.*)"
- (1 =) (2 gsub))))
+ otf:deva=nukt,akhn,blwf,half,vatu,pres+)
)
+;; Stage 3
+;; ZWJ's are used to prevent consonant conjuncts, so they are removed
+;; only after 'vatu' and 'pres' have been applied.
+(generator
+ (0
+ (cond
+ ("J")
+ ("." =))
+ *))
+
+;; Stage 4
;; Apply other features.
(generator
(0
(cond
(" ([^ ]+) "
- (1 otf:deva=vatu,pres,abvs,blws,psts,haln+abvm,blwm,dist))
+ (1 otf:deva=abvs,blws,psts,haln+abvm,blwm,dist))
("."
[ = ]))
*))