[liblouis-liblouisxml] Re: Problem with capital sign and compbrlAtCursor

  • From: "John J. Boyer" <johnjboyer@xxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 19 Jan 2009 12:35:29 -0600

James,

You can go ahead and commit this change. I don't think it will break 
anything.

There is an "uppercase" opcode, which can be used to define letters that 
have no lower case. CTO_UpperCase is also generated by the "uplow" 
opcode, as is CTO_LowerCase. 

The function insertBrailleIndicators is kind of a rat's nest. I'm not
too happy with the way I coded it, but can't find anything better.

John

On Mon, Jan 19, 2009 at 11:13:34PM +1000, James Teh wrote:
> Hi John,
> 
> There is a bug with regard to the capital sign and compbrlAtCursor.
> 
> Using en-us-g1.ctb, if you pass the string:
> "Aa a"
> with compbrlAtCursor and cursorPos set to 0, the result is:
> "Aaa"
> Observe that the space has been removed. Also, the outputPos array is 
> wrong, indicating a 0 in the position of the space.
> 
> I think this might be another case of for_updatePositions() unexpectedly 
> handling computer braille for compbrlAtCursor. This caused similar 
> problems for my patch in 1.3.9.
> 
> I don't quite understand where capital signs are inserted, etc. in 
> liblouis. I initially started looking at calls to 
> insertBrailleIndicators(), but I had no luck there. I then notice that 
> after the comment:
> /* replacement processing */
> there is a check for CTO_UPPERCASE which checks for a capital sign. This 
> calls putCharacter(), which in turn calls for_updatePositions(). I 
> figure that this *could* be the culprit. I guarded this by placing the 
> following just below the case statement:
> >     case CTO_UpperCase:
> >       if (mode & compbrlAtCursor && src >= compbrlStart && src <= 
> >       compbrlEnd)
> >         break;
> I've attached a patch for further examination.
> 
> This does seem to fix the problem, but I'm not sure if it is the correct 
> solution and I'm concerned it may break something else. Your thoughts 
> and explanations would be greatly appreciated. :) One question in 
> particular is: what is the CTO_UPPERCASE opcode? I assume this isn't 
> quite a direct translation from the tables, given the checking of the 
> capital sign.
> 
> -- 
> James Teh
> Email/MSN Messenger/Jabber: jamie@xxxxxxxxxxx
> Web site: http://www.jantrid.net/

> Index: liblouis/lou_translateString.c
> ===================================================================
> --- liblouis/lou_translateString.c    (revision 79)
> +++ liblouis/lou_translateString.c    (working copy)
> @@ -1851,6 +1851,8 @@
>         src++;
>         break;
>       case CTO_UpperCase:
> +       if (mode & compbrlAtCursor && src >= compbrlStart && src <= 
> compbrlEnd)
> +         break;
>         if (transRule->dotslen == 1 && table->capitalSign)
>           {
>             putCharacter (curCharDef->lowercase);


-- 
My websites:
http://www.godtouches.org
http://www.jjb-software.com
Location: Madison, WI, USA

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

Other related posts: