Next: , Previous: , Up: Using Fonts   [Contents][Index]


5.19.5 Character Classes

GNU troff can group characters into classes, making manipulation of their breaking and/or sentential properties convenient; recall the cflags request in Using Symbols. Classes are particularly useful for East Asian languages such as Chinese, Japanese, and Korean, which have much larger character repertoires than the Latin, Greek, Cyrillic, or Thai scripts. In such large character sets, many characters share the same properties. Only class and cflags requests can operate on character classes.

Request: .class ident c …

Define a character class (or simply “class”) ident comprising the members c …, where each c is an ordinary, special, or indexed character; or a range expression. A class thus defined can then be referred to in a cflags request in lieu of listing all the characters within it.

.class [quotes] ' \[aq] \[dq] \[oq] \[cq] \[lq] \[rq]

Since class and special character names share the same name space, we recommend starting and ending the class name with ‘[’ and ‘]’, respectively, to avoid collisions with existing special character names defined by GNU troff or the user (with char and related requests). This practice applies the presence of ‘]’ in the class name to prevent the use of the special character escape form ‘\[]’, you must therefore access a class thus named via the \C escape sequence.

An argument c can alternatively be a range expression consisting of a start character followed by ‘-’ and then an end character. Internally, GNU troff converts these two symbol names to Unicode code points (according to the groff glyph list [GGL]), which determine the start and end values of the range. If that conversion fails, GNU troff skips the range expression and any remaining arguments.

If you want to include ‘-’ in a class, it must be the first character in a c argument; otherwise GNU troff interprets the argument as a range expression.


Next: , Previous: , Up: Using Fonts   [Contents][Index]