liblouis: Character-Definition Opcodes

1 
1 2.3 Character-Definition Opcodes
1 ================================
1 
1 These opcodes are needed to define attributes such as digit,
1 punctuation, letter, etc.  for all characters and their dot patterns.
1 liblouis has no built-in character definitions, but such definitions are
11 essential to the operation of the 'context' opcode (⇒context
 context opcode.), the 'correct' opcode (⇒correct correct opcode.),
1 the multipass opcodes and the back-translator.  If the dot pattern is a
1 single cell, it is used to define the mapping between dot patterns and
1 characters, unless a 'display' opcode (⇒display display opcode.)
1 for that character-dot-pattern pair has been used previously.  If only a
1 single-cell dot pattern has been given for a character, that dot pattern
1 is defined with the character's own attributes.  If more than one cell
1 is given and some of them have not previously been defined as single
1 cells, the undefined cells are entered into the dots table with the
1 space attribute.  This is done for backward compatibility with old
1 tables, but it may cause problems with the above opcodes or
1 back-translation.  For this reason, every single-cell dot pattern should
1 be defined before it is used in a multi-cell character representation.
1 The best way to do this is to use the 8-dot computer braille
1 representation for the particular braille code.  If a character or dot
1 pattern used in any rule, except those with the 'display' opcode, the
1 'repeated' opcode (⇒repeated repeated opcode.) or the 'replace'
1 opcode (⇒replace replace opcode.), is not defined by one of the
1 character-definition opcodes, liblouis will give an error message and
1 refuse to continue until the problem is fixed.  If the translator or
1 back-translator encounters an undefined character in its input it
1 produces a succinct error indication in its output, and the character is
1 treated as a space.
1 
1 'space character dots'
1      Defines a character as a space and also defines the dot pattern as
1      such.  for example:
1 
1           space \s 0 \s is the escape sequence for blank; 0 means no dots.
1 
1 'punctuation character dots'
1      Associates a punctuation mark in the particular language with a
1      braille representation and defines the character and dot pattern as
1      punctuation.  For example:
1 
1           punctuation . 46 dot pattern for period in NAB computer braille
1 
1 'digit character dots'
1      Associates a digit with a dot pattern and defines the character as
1      a digit.  For example:
1 
1           digit 0 356 NAB computer braille
1 
1 'uplow characters dots [,dots]'
1      The characters operand must be a pair of letters, of which the
1      first is uppercase and the second lowercase.  The first dots
1      suboperand indicates the dot pattern for the upper-case letter.  It
1      may have more than one cell.  The second dots suboperand must be
1      separated from the first by a comma and is optional, as indicated
1      by the square brackets.  If present, it indicates the dot pattern
1      for the lower-case letter.  It may also have more than one cell.
1      If the second dots suboperand is not present the first is used for
1      the lower-case letter as well as the upper-case letter.  This
1      opcode is needed because not all languages follow a consistent
1      pattern in assigning Unicode codes to upper and lower case letters.
1      It should be used even for languages that do.  The distinction is
1      important in the forward translator.  for example:
1 
1           uplow Aa 17,1
1 
1 'grouping name characters dots ,dots'
1      This opcode is used to indicate pairs of grouping symbols used in
1      processing mathematical expressions.  These symbols are usually
1      generated by the MathML interpreter in liblouisutdml.  They are
1      used in multipass opcodes.  The name operand must contain only
1      letters, but they may be upper- or lower-case.  The characters
1      operand must contain exactly two Unicode characters.  The dots
1      operand must contain exactly two braille cells, separated by a
1      comma.  Note that grouping dot patterns also need to be declared
1      with the 'exactdots' opcode (⇒exactdots exactdots opcode.).
1      The characters may need to be declared with the 'math' opcode
1      (⇒math math opcode.).
1 
1           grouping mrow \x0001\x0002 1e,2e
1           grouping mfrac \x0003\x0004 3e,4e
1 
1 'letter character dots'
1      Associates a letter in the language with a braille representation
1      and defines the character as a letter.  This is intended for
1      letters which are neither uppercase nor lowercase.
1 
1 'lowercase character dots'
1      Associates a character with a dot pattern and defines the character
1      as a lowercase letter.  Both the character and the dot pattern have
1      the attributes lowercase and letter.
1 
1 'uppercase character dots'
1      Associates a character with a dot pattern and defines the character
1      as an uppercase letter.  Both the character and the dot pattern
1      have the attributes uppercase and letter.  'lowercase' and
1      'uppercase' should be used when a letter has only one case.
1      Otherwise use the 'uplow' opcode (⇒uplow uplow opcode.).
1 
1 'litdigit digit dots'
1      Associates a digit with the dot pattern which should be used to
1      represent it in literary texts.  For example:
1 
1           litdigit 0 245
1           litdigit 1 1
1 
1 'sign character dots'
1      Associates a character with a dot pattern and defines both as a
1      sign.  This opcode should be used for things like at sign ('@'),
1      percent ('%'), dollar sign ('$'), etc.  Do not use it to define
1      ordinary punctuation such as period and comma.  For example:
1 
1           sign % 4-25-1234 literary percent sign
1 
1 'math character dots'
1      Associates a character and a dot pattern and defines them as a
1      mathematical symbol.  It should be used for less than ('<'),
1      greater than('>'), equals('='), plus('+'), etc.  For example:
1 
1           math + 346 plus
1