You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Cornelius Hald <ha...@icandy.de> on 2006/11/28 14:12:41 UTC

Hyphenation problems with source code like text

Hi,

as some other on this list I have the problem of very long strings 
without whitespaces. In my case these strings contains source code. So 
for example I have the following line:

this.element.nextElement.getSomething(foo).getAnotherThing();

The string might of cause be much longer... Now I tried to create a 
custom hyphenation file, which should allow this string to break at the 
dot character or at the "(" character. Unfortunately it is not working. 
It is working for normal text, but if I try to break after special 
characters like "#", "*", "+", ".", etc. it's not working. I'm using 
fop-0.92beta.

I would appreciate any hints and tips. Below I've attached a very small 
hyphenation file, which of cause is far from complete.

Best regards
Conny


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE hyphenation-info SYSTEM "hyphenation.dtd">
<hyphenation-info>
   <hyphen-char value="-"/>
   <hyphen-min before="2" after="2"/>
   <classes>
     #({[=-
     aA
     bB
     cC
     <!-- ... -->
   </classes>
   <patterns>
     .cup9 #9
   </patterns>
</hyphenation-info>





---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Hyphenation problems with source code like text

Posted by Manuel Mall <ma...@apache.org>.
On Tuesday 28 November 2006 21:12, Cornelius Hald wrote:
> Hi,
>
> as some other on this list I have the problem of very long strings
> without whitespaces. In my case these strings contains source code.
> So for example I have the following line:
>
> this.element.nextElement.getSomething(foo).getAnotherThing();
>
> The string might of cause be much longer... Now I tried to create a
> custom hyphenation file, which should allow this string to break at
> the dot character or at the "(" character. Unfortunately it is not
> working. It is working for normal text, but if I try to break after
> special characters like "#", "*", "+", ".", etc. it's not working.
> I'm using fop-0.92beta.

Cornelius,

I don't know much about hyphenation however you could, for example in 
your stylesheet, add a zero width space (0x200b) after each character 
you would like to behave as a line breaking possibility.

Manuel
>
> I would appreciate any hints and tips. Below I've attached a very
> small hyphenation file, which of cause is far from complete.
>
> Best regards
> Conny
>
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE hyphenation-info SYSTEM "hyphenation.dtd">
> <hyphenation-info>
>    <hyphen-char value="-"/>
>    <hyphen-min before="2" after="2"/>
>    <classes>
>      #({[=-
>      aA
>      bB
>      cC
>      <!-- ... -->
>    </classes>
>    <patterns>
>      .cup9 #9
>    </patterns>
> </hyphenation-info>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail:
> fop-users-help@xmlgraphics.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Hyphenation problems with source code like text

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Cornelius Hald wrote:
> dot character or at the "(" character. Unfortunately it is not working. 
> It is working for normal text, but if I try to break after special 
> characters like "#", "*", "+", ".", etc. it's not working. I'm using 
> fop-0.92beta.

Hmm, the . (dot) is reserved as begin/end of word character in patterns
and can't be used as charclass representation (i.e. as the first 
character in a class). The charclass parser wont check for this. But
other than that, the hyphenator should work. Maybe the text parser
already has some opinion of what constitutes a word. This is somewhat
hard to get from the source, but you can check by setting the log level
to "trace", you should see "Word to hyphenate: ..." messages which
should help tracking the problem down.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org