[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VIM-6 - rightleft redisplay



On Tue, 04 Dec 2001 12:37:33 -0500
 "David Harrison Jr." <david at motionrealityinc dot com> wrote:
>
> Did you get my previous post about calling "screen_update()"?

Yes I did, but it unfortunately it wasn't what I was looking for;
thanks for responding non-the-less.

> >With the current code in search.c (function 'screen_line' line #3953)
> >
> 
> You mean in the file "screen.c"?

Oops, yah it should have been "screen.c (function 'screen_line' line #3953)".

> > there
> >is a 'while' which in essence redisplays everything (which seems to always
> >happen upon entering a new character).  Here's my question - in "rightleft"
> >mode the redrawing is still done from left-to-right instead of right-to-left
> >and that is playing havoc with the new Arabic shaping code 
> >
> 
> >(Arabic as you
> >might know or have guessed by now is a right-to-left language).
> >
> 
> What about numbers?  Are they drawn in the same direction?  I seem to 
> remember there was one language that had its numbers drawn in the 
> opposite direction from its words, thus making it a combination of 
> "rightleft" and "leftright" type of writing.  If this is the case, then 
> drawing everything in one direction may not be flexible enough, no 
> matter which direction you are drawing.

Numbers aside (and we can live with them not being processed correctly
until Bidi is adopted).  The question still stands on how to modify the
above noted logic/code to redisplay the characters in "rightleft" mode.
 
> >  It seems
> >only logical that in "rightleft" mode that the redrawing be done in the
> >same direction (ie. from right to left).
> >
> 
> That does seem logical.  However, I think Vim is assuming that the 
> characters can be laid out in a regular grid.
> If this is the case, then it shouldn't matter which direction you draw 
> your characters because the glyphs that are drawn will be self-contained 
> (each to it's own cell).
>
> Actually, I think that the final solution will be something like "draw a 
> line at a time".  This way, you can account for the direction and draw 
> it appropriately.  When I say "draw a line", I'm thinking of one line of 
> text on the screen.... and drawing it as one long string, possibly.  The 
> X-Windows FontSet handling/drawing routines should take care of the rest.
> 
> I don't know enough about Unicode (specifically UTF-8) and other 
> encodings to really know what the best solution is.

As noted, for the new Arabic code to work properly and for it to do
the shaping correctly, the redisplay needs to be done in a right-to-left
manner.  Let me tell you why - I intercept the displaying of a character 
and have to look at what's before and what's after a certain character for
me to make a decision on how to process (or shape) that character.  In
":set rightleft" mode the processing is done correctly when a character is
entered, but when the redisplay happens - the direction is reversed and the
new Arabic code is thrown for a loop (instead of it processing characters
from right-to-left, it gets characters from left-to-right thus rendering
the previous and next characters all wrong).

> >Is someone out there familiar enough with the code to offer an ifdef'ed
> >solution that would redraw and traverse the characters from right-to-left
> >in "rightleft" mode ?  I've attempted to do that myself, but there are bits
> >and pieces of the code that I don't understand and can't seem to get right,
> >thus rendering my subtle attempts non-functional.
> >
> 
> Unfortunately, I'm not that familiar with the code to offer a solution 
> (I need to see Arabic examples.... lots of them).

Well, I would suggest downloading our work-in-progress code,

   http://www.arabeyes.org/cgi-bin/cvsweb/arabeyes/vim
-or-
   http://www.arabeyes.org/~nadim/vim/vim-shaping.tar.gz

Please CC those that are already included.

 - Nadim


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com