Re: fo:character and zero width space

Carlos Villegas <[email protected]>
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
This is the result of my tests so far:

treat-as-word-space doesn't have any effect. Looking at the compliance 
page, it's listed as not supported!

By wrapping the thai text in a fo:inline, using a regular space as word 
separator and setting word-spacing property, I get some results but I 
haven't been able to get zero width on the spaces for non-justified 
text. According to the spec, word-spacing is used to adjust the word 
spacing "in addition to normal spacing", so I tried something like the 
following:

<fo:inline word-spacing.minimum="-2em" 
word-spacing.maximum="0.05em">Thai text with normal spaces as word 
separators</fo:inline>

When justifying I do get some lines where the word spacing is zero, but 
when justifying left, there's always some interword spacing. I tried 
several values, but can't get it to zero.
One complication I have is how to know the "normal" word space so I can 
adjust it to zero.

Anyway to get word-spacing optimum and minimum to zero?

Carlos

On 2/12/16 15:11, Glenn Adams wrote:
>
>
> 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]
>     <mailto:[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.