Sunday 28 September 2014

NVDA And Custome Braille Display

It is not possible, within NVDA, to create and add your own braille tables, but it is possible to edit / change an existing one.

Background

The need to change arose for a couple of reasons - firstly, we did not like the number character, and preferred instead to use the dot-8 to indicate numbers.  Secondly, we wanted some of the accents to be included, but, in general, to stick the the English Grade 1 wherever possible.

How To

So, we Edited en-gb1-g1.utb, then re-started NVDA to load the new table.  Note that editing on Windows 8 involved copying the file elsewhere, editing and copying back.  A word of warning - make sure that your text editor (I used wordpad) does not change the filename to en-gb1-g1.utb.txt, because that file will never be loaded!

If you want to check that you've edited the file correctly, and not introduced any errors, you can check it using the liblouis tools (the underlying braille translation uses this library).  The program you want is called: lou_checktable.exe.

By default, the file we used  includes a few others, but we have managed to get by without using them - it also means that there is only one file to back-up! One of the files included contains a whole bunch of "display" commands, which do not seem to have any effect on the output, so the file can be dropped.

The File Contents

For numbers, we want to use dot-8, rather than the number character prefix, so the first part of the configuration file contains the braille dots for the numbers:
#
# Numbers
#
digit 0 2458
digit 1 18
...
digit 8 1258
digit 9 248
Next are the standard letters A-Z.  I've included the upper and lower case, using dot-7 to indicate upper case:
#
# Standard Letters
#
uplow Aa 17,1
uplow Bb 127,12
...
uplow Yy 134567,13456
uplow Zz 13567,1356
Now, the extras that we need - the braille display is used for both English and French, but of course, the English braille does not support French accents, so we need to add a few extra entries in.

All characters are referred to with their unicode number, often written in the form u+0000, but in the configuration file, written in the form \x0000.  Search the web for unicode characters to find the codes, but here is a start.

Some of the accents (e.g. a with tilde) do not exist in French, so you will see that these map to a standard 'a'.  The lines could actually been removed from the file, but have been left in in case you have a different language you are trying to support ...
#
# Accents
#
uplow \x00C0\x00E0 123567,12356    # a with grave
uplow \x00C1\x00E1 17,1            # a with acute
uplow \x00C2\x00E2 167,16          # a with circumflex
uplow \x00C3\x00E3 17,1            # a with tilde
uplow \x00C4\x00E4 3457,345        # a with dieresis
uplow \x00C5\x00E5 17,1            # a with ring above
uplow \x00C6\x00E6 3457,345        # letter ae
uplow \x00C7\x00E7 123467,12346    # c with cedilla
uplow \x00C8\x00E8 23467,2346      # e with grave
uplow \x00C9\x00E9 1234567,123456  # e with acute
uplow \x00CA\x00EA 1267,126        # e with circumflex
uplow \x00CB\x00EB 12467,1246      # e with dieresis
uplow \x00CC\x00EC 347,34          # i with grave above
uplow \x00CD\x00ED 247,24          # i with acute above
uplow \x00CE\x00EE 1467,146        # i with circumflex
uplow \x00CF\x00EF 124567,12456    # i with dieresis
uplow \x00D0\x00F0 157,15          # letter eth
uplow \x00D1\x00F1 13457,1345      # n with tilde
uplow \x00D2\x00F2 3467,346        # o with grave above
uplow \x00D3\x00F3 1357,135        # o with acute above
uplow \x00D4\x00F4 14567,1456      # o with circumflex
uplow \x00D5\x00F5 1357,135        # o with tilde
uplow \x00D6\x00F6 2467,246        # o with dieresis
uplow \x0152\x0153 2467,246        # letter oe
uplow \x00F9\x00D9 234567,23456    # u with grave
uplow \x00FB\x00DB 1567,156        # u wih circumflex
uplow \x00FC\x00DC 12567,1256      # u with dieresis
The last section in the file is the punctuation - all of this, I cut and paste from the original en-gb-g1.utb file, but it needs a good bit of tidying up.

#
# Punctuation
#

space \t 0 tab
space \x000A 0
space \x000D 0
space \s 0 blank
punctuation ! 2346
punctuation " 5
sign # 3456
sign $ 1246
sign % 146
sign & 12346
punctuation ' 3
punctuation ( 12356
punctuation ) 23456
sign * 16
math + 346
punctuation , 6
punctuation - 36
punctuation . 46
math / 34
punctuation : 156
punctuation ; 56
math < 126
math = 123456
math > 345
punctuation ? 1456
sign @ 2346
punctuation [ 2467
sign \\ 12567
punctuation ] 124567
sign ^ 457
sign _ 456
sign ` 4
punctuation { 246
sign | 1256
punctuation } 12456
math ~ 45
space \X00A0 0
sign \x00A2 4-14           # 162 ¢ cents sign
sign \x00A3 4-123          # 163 £ pounds sign
sign \x00A5 4-13456        # 165 ¥ yen sign
sign
\x00A7 4-234-3        # 167 § section sign  
sign \x00A9 2356-6-14-2356 # 169 © copyright sign
punctuation \x00Ad 36      # 173 soft hyphen
sign \x00B0 356            # 176 ° degrees sign
sign \x00B5 46-134         # 181 ยต micro sign
sign \x00B6 4-1234-345     # 182 ¶ pilcrow sign
math \x00D7 56-236         # 215 × multiplication sign
math \x00F7 56-256         # 247 ÷ division sign
punctuation \x2010 36      # 8208  hyphen
punctuation \x2013 6-36    # 8211  en dash
punctuation    \x2018 3    # 8216  smart single left quotation mark
punctuation    \x2019 3    # 8217    smart single right quotation mark
punctuation    \x201C 236  # 8220    smart opening double quote
punctuation    \x201D 356  # 8221    smart closing double quote
punctuation    \x201E 236  # 8222    smart double low quotation mark
punctuation    \x201F 356  # 8223    smart double high reverse quotation mark
punctuation \x2026 3-3-3   # 8230 smart ellipsis
sign \x20AC 4-15           # 8364 Euro sign