[liblouis-liblouisxml] Re: compbrlAtCursor mode with Chinese braille tables

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Thu, 5 Aug 2010 09:17:03 -0500

This patch looks OK to me, so you can go ahead and commit it.

John

On Thu, Aug 05, 2010 at 07:55:34PM +1000, James Teh wrote:
> Hi all,
> 
> The Chinese braille tables (and possibly other tables as well) simply 
> define signs for individual unicode characters using the "sign" opcode. 
> There are no contractions, etc. A single sign may be several cells long 
> in braille. For example:
> sign \x9019 14-15-6
> This unfortunately presents problems with cursorPos when the 
> compbrlAtCursor mode is set. For example, if you have two \x9019 
> characters and set the input cursorPos to 1 with compbrlAtCursor, the 
> resultant output cursorPos is 1 instead of 3.
> 
> Of course, the work around is to avoid using compbrlAtCursor. However, 
> in NVDA, this is enabled by default and users shouldn't be expected to 
> change this to work around this issue.
> 
> The problem here is that liblouis is assuming that output will always be 
> a 1-to-1 mapping between input and output within compbrlStart and 
> compbrlEnd. The attached patch fixes this. It works for me, but I'd 
> appreciate a quick glance from John.
> 
> Jamie
> 
> -- 
> James Teh
> Vice President
> NV Access Inc, ABN 61773362390
> Email: jamie@xxxxxxxxxxxx
> Web site: http://www.nvaccess.org/

> Index: liblouis/lou_translateString.c
> ===================================================================
> --- liblouis/lou_translateString.c    (revision 371)
> +++ liblouis/lou_translateString.c    (working copy)
> @@ -401,7 +401,6 @@ for_updatePositions (const widechar * outChars, in
>       {
>         if (src >= compbrlStart)
>           {
> -           cursorPosition = dest + cursorPosition - compbrlStart;
>             cursorStatus = 2;
>             return (doCompTrans (compbrlStart, compbrlEnd));
>           }
> @@ -418,6 +417,8 @@ for_updatePositions (const widechar * outChars, in
>         cursorStatus = 1;
>       }
>      }
> +  else if (cursorStatus == 2 && cursorPosition == src)
> +    cursorPosition = dest;
>    if (inputPositions != NULL || outputPositions != NULL)
>      {
>        if (outLength <= inLength)


-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: