Re: fo:character and zero width space

Glenn Adams <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <CACQ=j+c5kXGQwFHAsMgi9K4mNrYG_x5-jh_pJM0DsCpcjyhZng@mail.gmail.com>
On Thu, Feb 11, 2016 at 9:23 PM, Carlos Villegas <[email protected]> wrote:

> I'm trying to use FOP 2.0 to render Thai language. FOP doesn't really
> support Thai script


FOP does support Thai, at least glyph composition, though there appears to
be a few open issues (FOP-2092
<https://issues.apache.org/jira/browse/FOP-2092>, FOP-2355
<https://issues.apache.org/jira/browse/FOP-2355>). It is also true that FOP
is not presently performing line breaking in phrase internal positions (
FOP-2066 <https://issues.apache.org/jira/browse/FOP-2266>), which proposes
a solution to employ ICU and use dictionary based LB.


> , so I'm using an external program (libthai) to do glyph composition and
> word breaking.
> Thai doesn't use spaces to separate words, so I was just inserting zero
> width spaces to separate words. This works fine.
> However, for justified text, these zero width spaces don't stretch, so
> nothing happens, I get no justified text.
> So, I tried to use fo:character with character set to zero width space,
> and setting the letter-spacing.maximum to allow some stretching.
>

Zero width space (U+200B) is not treated as a word separator space by
default. Have you tried something like:

<fo:character treat-as-word-space='true'>&#x200B</fo:character>

If that doesn't work, then keep in mind that letter spacing has no meaning
when applied to a single character, but applies to a sequence of
characters. Accordingly, I would try something like:

<fo:inline letter-spacing.minimum="0em"
letter-spacing.maximum="0.1em">&#x200B;&#x200B;</fo:inline>

or

<fo:inline letter-spacing.minimum="0em"
letter-spacing.maximum="0.1em">&#x200B;<fo:character
treat-as-word-space='true'>&#x200B;</fo:character></fo:inline>

If neither approach works, it may require some time with a visual debugger,
e.g., Eclipse, to step through the code and find out where things go wrong.



> But now FOP doesn't seem to treat the zero width space as such this way,
> it doesn't break anymore at all!
>
> Note that Thai does make use of regular spaces to separate sentences and
> for other purposes but there's no guarantee that you have spaces in a given
> paragraph or in case of long sentences.
>
> Is there a way to insert a breakable space with minimum and optimum to
> zero width and some small value for maximum?
>
> Carlos
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.