[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: Implementing hyphenation / wordwrap for Thai
From:       Rudiger Koch <rkoch () sas ! co ! th>
Date:       1999-09-12 5:19:49
[Download RAW message or body]

What about to have a shared lib that contains the code to separate words and
does the hyphenation/separation and to have the K-App to do something with the
result. The lib could implement a static method separate():

separate (char* sepstr,   // string to be separated
               int pos,   // rightmost position for separation
            char* lstr,   // left side of the separated String
           char* rstr);   // right side of the separated String

Example: Hyphenation of the German word "Neckar".

sepstr = "Neckar";
pos    = 3;   // no separation right of pos 3 (the "k")

separate(sepstr, pos, lstr, rstr);

// Now lstr == "Nek-"
// and rstr == "kar"

The K-App now has to check if "Nek-" fits into the line and if not call
separate() again with a smaller value of pos

This allows separate() to implement all kinds rules that are in languages,
it frees to authors of the language specific separate() functions from
knowing details about internals of K-Applications. 

The lib might also have a user interface to configure some parameters in
separate().

-Rudiger


On Sun, 12 Sep 1999, Reginald Stadlbauer wrote:
> On Fri, 10 Sep 1999, Rudiger Koch wrote:
> Hi!
> Unfortunately I was away for a few days so I couldn't follow the whole thread.
> Also unfortunately I'm currently full with work but ASA I can find some time
> I'll think about a way this can be done efficient and fast (that's the most
> important part here!!!!!!!)
> 
> Also if somebody wants to work on it: Please don't commit changes in the
> formatting suff, kernel, etc. This part of KWord is very complicated and
> optimized, so if you don't know everything about it it's very easy to break it.
> So please send me patches.
> 
> >On Fri, 10 Sep 1999, Jo Dillon wrote:
> >> 
> >>   Ok, I think I see. Hmmm, I don't know exactly how kword represents
> >> text internally, but I suspect it's possible to have some sort of marker
> >> within the structures holding the text.
> >
> >After looking through the sources is seems to me that a paragraph object
> >separates the actual text and the layout. But I really don't understand how
> >it works so I'd appreciate some input from the KOffice gurus. Please keep
> >in mind that the approach should work for other Apps, KMail for instance.
> 
> That's easy, what do you not understand? A paragraph contains the text which is
> a KWString and the style (paragraph layout). Both have NOTHING todo with word
> wrap. This is done in the format context. This one looks for spaces to break a
> line. I guess for the Thai stuff we would have to indroduce another special
> character which acts as a marker for linebreaking (is invisible). When
> changing a paragraph the markers for the changed part have to be updated. And
> when the formatcontext does the linebreaking it doesn't look for spaces but for
> the special char.
> 
> As I said, the only problem will be to make the updating of markers (special
> chars) efficient.
> 
> BTW: You will never be able to use the same code for all KDE apps. It will work
> the same for most, but as KWord's string class does a bit more than just
> working with strings, you will need some different code there.
> 
> >- I couldn't get Thai fonts to show up in KWord and KIllustrator, probably
> >  because they don't use X fonts. Do they use Ghostscript fonts? I 
> 
> They use X fonts!!!!!!!
> 
> --
> Reggie
--
 Software Advanced Solutions           Fon: +66 76 218 826 
 48 Villa 1 Yaowarat Soi 1             Fax: +66 76 214 041
 Phuket, Thailand 83000                rkoch@sas.co.th

 // Why use Windows when the door is open and free of charge?
 // Linux: The choice of a GNU generation

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic