KHTML Thai Word Break patchc

Pattara Kiatisevi ott at linux.thai.net
Thu May 6 17:39:20 BST 2004


Hello again,

For the performance problem, I'm not sure do you mean something like this. 
Please have a look at the attached file. I have tested it and it seems to 
work okay.

Regards,
Pattara

On Thursday 06 May 2004 06:08, Lars Knoll wrote:
> Hi Pattara,
>
> The principle is correct, but your patch has a few problems.
>
> * Using dlopen and related is not completely portable. You should use
> KLibLoader (QLibrary in Qt only code) insstead.
> * The code leaks a lot of memory, as everytime you have to change the cache
> you allocate a QString and a QCString on the heap that are never cleaned
> up. * libkhtml is a kpart, and can get dynamically opened and closed. It
> should therefore cleanup the data it allocates when the part gets unloaded.
> * static int foo[32000] always allocates 128 kB. It's probably better to
> just allocate as much as needed
>
> Another small issue I can see is a performance issue. You iterate linearily
> over the list of break positions. The line breaking algorithm always will
> ask for every character if we can break here in a linear fashion. So
> storing the position isBreakable() queried in the last call should speed
> this up from O(n) to O(1).
>
> I've attached a patch (compiles, but untested), that should fix all but the
> performance issue. Please have a look.
>
> Cheers,
> Lars
>
> On Wednesday 05 May 2004 18:51, Pattara Kiatisevi wrote:
> > Hello kfm-devel,
> >
> > Thai sentences have no space between words and at the end of the line it
> > is common to wrap the sentences at the word boundary.
> >
> > Here is the patch (for kdelibs/khtml/rendering/break_lines.h) to enable
> > Thai word break in KHTML (tested with kdelibs-3.2.2). It will need
> > "libthai.so". I have been testing it for a few weeks and it works so far
> > okay. Please comment.
> >
> > Libthai:
> > http://linux.thai.net/plone/TLWG/libthai/
> >
> > Regards,
> > Pattara
-------------- next part --------------
A non-text attachment was scrubbed...
Name: break_lines.cpp
Type: text/x-c++src
Size: 3094 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20040507/3f59bd88/attachment.cpp>


More information about the kfm-devel mailing list