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 Matthias Reischenbacher <ma...@gmx.at> on 2010/09/09 21:27:31 UTC

How to prevent line break when hyphenation is enabled?

Hi,

is there a way to prevent a line break inside a word, when hyphenation 
is enabled?

I've tried two things, but neither of them did the trick:
1. Insert WORD JOINER characters (Ux2060) between all characters of the word
2. <fo:inline keep-together.within-line="always"/>

I'm attaching a sample fo file, in case somebody wants to give it a try.

Thanks & Regards,
Matthias Reischenbacher

Re: How to prevent line break when hyphenation is enabled?

Posted by Matthias Reischenbacher <ma...@gmx.at>.
Hi,

just in case somebody else has this problem: I ended up wrapping every 
single character inside a fo:character element and set the hyphenate 
attribute to false. This also prevents hyphenation and doesn't require 
the Arial Unicode MS font.
e.g.
<fo:character hyphenate="false" character="C"/>
<fo:character hyphenate="false" character="A"/>
<fo:character hyphenate="false" character="N"/>
<fo:character hyphenate="false" character="o"/>
<fo:character hyphenate="false" character="p"/>
<fo:character hyphenate="false" character="e"/>
<fo:character hyphenate="false" character="n"/>

I'm still wondering why XSL-FO doesn't allow the hyphenate attribute on 
fo:inline elements....

Regards,
Matthias Reischenbacher

On 10.09.2010 12:09, Matthias Reischenbacher wrote:
> Hi Simon,
>
>> Any non-word character prevents hyphenation. Word characters are
>> defined in the classes element in the source hyphenation file. For
>> German these are a-z, ä, å, ö, ü and ß. WORD JOINER is not one of
>> them, but apparently it is filtered out. I tried ZERO WIDTH JOINER,
>> but that is rendered as an 'unknown glyph' #.
>
> Thanks for pointing into this direction. Using the ZERO WIDTH JOINER
> prevents hyphenation. I had to use Arial Unicode MS font in order to not
> get the "unknown glyph" error.
>
> What is kind of strange although, when using some other font, which also
> contains this character (e.g. Arial, Calibri, Times New Roman etc. [1]),
> the character gets displayed in a weird way (have a look at the attached
> screenshot).
>
> I'd prefer to use Arial because it's a Windows standard font, but if
> that's not possible I'm happy with the current solution too. Which part
> of the FOP code is responsible for drawing this character in PDF output?
>
> [1] http://www.fileformat.info/info/unicode/char/200d/fontsupport.htm
>
> Regards,
> Matthias
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 5440 (20100910) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 5440 (20100910) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>

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


Re: How to prevent line break when hyphenation is enabled?

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Fri, Sep 10, 2010 at 12:09:40PM -0300, Matthias Reischenbacher wrote:
> Hi Simon,
> 
> What is kind of strange although, when using some other font, which
> also contains this character (e.g. Arial, Calibri, Times New Roman
> etc. [1]), the character gets displayed in a weird way (have a look
> at the attached screenshot).
> 
> I'd prefer to use Arial because it's a Windows standard font, but if
> that's not possible I'm happy with the current solution too. Which
> part of the FOP code is responsible for drawing this character in
> PDF output?
> 
> [1] http://www.fileformat.info/info/unicode/char/200d/fontsupport.htm

Interesting site. When you click on the link 'Local fonts', you see
that some fonts have this glyph for the zero-width joiner. I guess
those fonts focus more on insight in the character string than on
rendering texts.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

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


Re: How to prevent line break when hyphenation is enabled?

Posted by Matthias Reischenbacher <ma...@gmx.at>.
Hi Simon,

> Any non-word character prevents hyphenation. Word characters are
> defined in the classes element in the source hyphenation file. For
> German these are a-z, �, �, �, � and �. WORD JOINER is not one of
> them, but apparently it is filtered out. I tried ZERO WIDTH JOINER,
> but that is rendered as an 'unknown glyph' #.

Thanks for pointing into this direction. Using the ZERO WIDTH JOINER 
prevents hyphenation. I had to use Arial Unicode MS font in order to not 
get the "unknown glyph" error.

What is kind of strange although, when using some other font, which also 
contains this character (e.g. Arial, Calibri, Times New Roman etc. [1]), 
the character gets displayed in a weird way (have a look at the attached 
screenshot).

I'd prefer to use Arial because it's a Windows standard font, but if 
that's not possible I'm happy with the current solution too. Which part 
of the FOP code is responsible for drawing this character in PDF output?

[1] http://www.fileformat.info/info/unicode/char/200d/fontsupport.htm

Regards,
Matthias

Re: How to prevent line break when hyphenation is enabled?

Posted by Simon Pepping <sp...@leverkruid.eu>.
On Thu, Sep 09, 2010 at 04:27:31PM -0300, Matthias Reischenbacher wrote:
> Hi,
> 
> is there a way to prevent a line break inside a word, when
> hyphenation is enabled?
> 
> I've tried two things, but neither of them did the trick:
> 1. Insert WORD JOINER characters (Ux2060) between all characters of the word
> 2. <fo:inline keep-together.within-line="always"/>

Any non-word character prevents hyphenation. Word characters are
defined in the classes element in the source hyphenation file. For
German these are a-z, ä, å, ö, ü and ß. WORD JOINER is not one of
them, but apparently it is filtered out. I tried ZERO WIDTH JOINER,
but that is rendered as an 'unknown glyph' #.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu

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