Hi Rajeev,

I am trying to implement a BreakIterator/Hyphenator for my script. The "hyphenator" is purely algorithmic, (i.e., it doesn't require any external dictionaries or tables). So I thought of reimplementing getLineBreak.


Please don't!
The proper way is to implement a component that implements the XHyphenation interface. It is possible to have more than one Hyphenator
for each language and the user should be allowed to choose which
implementation is to be used.
See dialog Tools/Options/Language Settings - Writing Aids where you can
edit which one should be used on a per language base if you press the
uppermost Edit button.

The correct way would be to write and register a component that implements the XHyphenator interface. And the breakiterator will choose the component to ask for hyphenation points according to the settings of the above mentioned dialog.

If you implement the hyphenation in the breakiterator itself you will impose your implementation over any existing or later added hyphenation component for that language.


Although I have successfully subclassed BreakIterator_CTL, I am not able to return the right results. When I set the LineBreakResults.breakType to BreakType::Hyphenation, OOo (1.9.116) just crashes. The value in which it works is BreakType::WordBoundary, but this always breaks on a word boundary and never at the correct hyphenation point.

I am assuming that it is because I don't correctly initialize the lbr.rHyphenatedWord.

At this point, I am stuck. What value do I copy into the rHyphenatedWord ? In my script, there is no hyphen to denote a line break; the line just breaks after the grapheme. So do I insert ZWSP at the appropriate position or some other Unicode character ? How would I do that in code ? An example code to copy the word and insert the appropriate break character at any position would be greatly appreciated.

Also if possible, a link to the API documentation for BreakIterator would be very helpful.

http://api.openoffice.org/docs/common/ref/com/sun/star/i18n/BreakIterator.html

But as mentioned above please don't implement hypheantion in the breakiterator itself.

Regards,
Thomas




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to