Thanks, I'll try your suggestions.

The open issues in Thai glyph composition are major, basically the output is simply not acceptable. Correct positioning of vowels, diacritics and tonemarks is not a esthetic thing only, sometimes when they are in the wrong position they print on top of each other or on top of the wrong base character. So I wouldn't say FOP supports Thai!

I have Java code that I can donate that does glyph substitution for Thai, but this is based on the fact that Thai fonts also encode alternate glyphs into the Unicode user range. There are basically two encodings: Microsoft's and Mac's, and my code works with Microsoft's fonts. However, I think, the right way to do this is to read the font's own substitution tables, this information must be there inside the fonts, and use that. But if the font doesn't really have that information, my code could be use as a fallback if you at least know that it is a Microsoft encoded font.

Carlos

On 2/12/16 15:11, Glenn Adams wrote:


On Thu, Feb 11, 2016 at 9:23 PM, Carlos Villegas <[email protected] <mailto:[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]
    <mailto:[email protected]>



Reply via email to