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

Re: Word Wrap, Line breaks, and Arabic in KDE3



> I may be able to help as I have reviewed the interaction of Bidi,
> Arabic joining and Line breaking recently.
>
> behdad
>
> On Sat, 6 Apr 2002, Christoph Cullmann wrote:
> > > One big issue is kate/kwrite, as the editor is unusable both with
> > > arabic and hebrew, but I din't find any time to look into the code. It
> > > seems to me the editor is doing lots of drawing optimisations that
> > > assume left to right text layout.
> >
> > As where are just on the way to change the whole draw behaviour for
> > folding, someone whit knowledge of bidi could jump in and help out to
> > implement it now ;) would be the a real good chance, as the dynamic word
> > wrap could than be implemented with bidi in mind too.

Well, also feel free to ask me. I will probably not have a lot of time to 
help, but I'm surely always available for questions. The easiest way to 
achieve arabic/hebrew support is probably by cutting out drawing 
optimizations in that case and let Qt handle most of it.

The way to go is IMO pretty simple in that case:

Line breaking/folding is always done in logical order, so the reordering only 
takes place on a line by line basis. If you draw the whole line with one 
QPainter::drawText(), Qt will completely take care of the reordering and 
joining issues. You might loose some drawing optimisations in that case, but 
it is the easiest way to go.

You can easily test if a string needs some reordering (ie. if you can not 
apply drawing optimisations) by testing the QString::simpleText() flag (it's 
marked as internal in Qt, but will probably not change.

If you need/want to do things more by yourself, you can also get all the 
information you need for reordering by using QComplextext. The class is 
internal, and I might do some changes to it, so I wouldn't recommend using it 
for now, and the approach described above is simple and should get you to a 
result rather fast.

Cheers,
Lars