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 Carlos Villegas <ca...@uniscope.jp> on 2016/02/12 05:23:38 UTC
fo:character and zero width space
I'm trying to use FOP 2.0 to render Thai language. FOP doesn't really
support Thai script, 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.
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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: fo:character and zero width space
Posted by Glenn Adams <gl...@skynav.com>.
On Fri, Feb 12, 2016 at 3:17 AM, Carlos Villegas <ca...@uniscope.jp> wrote:
> 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!
>
Perhaps adding support for treat-as-word-space would be a sufficient fix
for this problem. Feel free to post a patch.
>
> 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 < <ca...@uniscope.jp>
> cav@uniscope.jp> 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'>​</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">​​</fo:inline>
>
> or
>
> <fo:inline letter-spacing.minimum="0em"
> letter-spacing.maximum="0.1em">​<fo:character
> treat-as-word-space='true'>​</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: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: <fo...@xmlgraphics.apache.org>
>> fop-users-help@xmlgraphics.apache.org
>>
>>
>
>
Re: fo:character and zero width space
Posted by Carlos Villegas <ca...@uniscope.jp>.
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 <ca...@uniscope.jp> 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'>​</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">​​</fo:inline>
>
> or
>
> <fo:inline letter-spacing.minimum="0em"
> letter-spacing.maximum="0.1em">​<fo:character
> treat-as-word-space='true'>​</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:
> fop-users-unsubscribe@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
Re: fo:character and zero width space
Posted by Glenn Adams <gl...@skynav.com>.
On Fri, Feb 12, 2016 at 12:08 AM, Carlos Villegas <ca...@uniscope.jp> wrote:
> Thanks, I'll try your suggestions.
>
> The open issues in Thai glyph composition are major, basically the output
> is simply not acceptable.
>
Understood.
> 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!
>
Actually, I read and speak Thai, so I would agree. It will be useful to
resolve these last bugs on the Thai script support so folks can start using
FOP for Thai content.
>
> 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.
>
This approach is not acceptable in FOP due to the reliance upon
non-standard coding and font dependent usage. FOP will only use of
GSUB/GPOS font tables, so we need to make this work properly for Thai.
> 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 < <ca...@uniscope.jp>
> cav@uniscope.jp> 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'>​</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">​​</fo:inline>
>
> or
>
> <fo:inline letter-spacing.minimum="0em"
> letter-spacing.maximum="0.1em">​<fo:character
> treat-as-word-space='true'>​</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: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: <fo...@xmlgraphics.apache.org>
>> fop-users-help@xmlgraphics.apache.org
>>
>>
>
>
Re: fo:character and zero width space
Posted by Carlos Villegas <ca...@uniscope.jp>.
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 <cav@uniscope.jp
> <ma...@uniscope.jp>> 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'>​</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">​​</fo:inline>
>
> or
>
> <fo:inline letter-spacing.minimum="0em"
> letter-spacing.maximum="0.1em">​<fo:character
> treat-as-word-space='true'>​</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:
> fop-users-unsubscribe@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
> For additional commands, e-mail:
> fop-users-help@xmlgraphics.apache.org
> <ma...@xmlgraphics.apache.org>
>
>
Re: fo:character and zero width space
Posted by Glenn Adams <gl...@skynav.com>.
On Thu, Feb 11, 2016 at 9:23 PM, Carlos Villegas <ca...@uniscope.jp> 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'>​</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">​​</fo:inline>
or
<fo:inline letter-spacing.minimum="0em"
letter-spacing.maximum="0.1em">​<fo:character
treat-as-word-space='true'>​</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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>