So far the right-hand (output) side of our GDL rules have contained single glyphs. It is also possible to use a multi-glyph class for substititution.
When one glyph is substituted for another, the Graphite engine determines the position of the input glyph within the input class, and uses the corresponding item from the output class in the substitution. For instance, the following two classes define classes of uppercase and lowercase letters:
table(glyph); clsUppercase = unicode(65..90); // A .. Z clsLowercase = unicode(97..122); // a .. z endtable; table(sub); clsUppercase > clsLowercase; endtable;
When, say, the uppercase “H” is encountered in the input, the corresponding lowercase “h” is placed into the output. Keep in mind that the order of the items in the classes becomes very significant when this mechanism is being used.
Note that you need to use parenthesis around the members of a class when there are more than one. For instance:
clsConsVoiced = (gB, gD, gG); clsConsVoiceless = (gP, gT, gK);
Write a program to capitalize all text.
Write a program to make all vowels uppercase and all consonants lowercase.
Write a program to create a Greek transliteration of Roman text, using the mappings in the table below. (You may ignore uppercase for this exercise.) Note that the Unicode codepoints are not in strict numerical order, and that there are no mappings for the letters j and v.
|Roman letter||Greek letter||Glyph||Unicode (hex)|
Compile your program against the SIL Galatia Unicode font (SilGalUni20b1.ttf) that is provided with the tutorial materials.
If you use lowercase in the hexadecimal numbers representing your Unicode codepoints, you may see a compilation error: "Undefined glyph class: oundingbox". This a bug in the pre-processor, where it interprets the hex digits 'bb' as 'boundingbox'. The work-around is to use 'BB' in instead of 'bb'.