SIL Non-Roman Script Initiative


A free and open rendering engine for complex scripts

Graphite Tutorial

Unit 16: Reordering



Now we return to the substitution table, to discuss yet another behavior it can be used to implement. This is reordering, specifically of the sort that we find in many scripts of South and Southeast Asia.

Here we extend the use of the @ symbol, which we saw briefly in our discussion of ligatures. The @ symbol is used to access an item in a rule. The number following the @ symbol indicates the position of the referenced slot with respect to its position in the context (the @ symbol alone indicates the slot itself).

gA  gB  >  @3  @1  /  _  gX  _;

The rule above replaces the A with the item at position 3 (the B) and replaces the B with the item at position 1 (the A) when an X occurs between the two characters. In other words, the A and the B switch places. Notice that the slot number for gB is not 2, but 3, its position within the entire context.

The @ symbol can also be used to copy a glyph with no changes, or with changes only to the slot attributes.


Write a program to reorder back rounded vowels (o and u) such that they occur before a preceeding consonant. (Remember that reordering is handled in the substitution table.) You may ignore the problem of vowel sequences (unless you feel particularly ambitious).


Copyright © 2012 SIL International® and released under the  Creative Commons Attribution-ShareAlike 3.0 license (CC-BY-SA) unless noted otherwise.