Re: fo:character and zero width space

2016-02-12 Thread Carlos Villegas

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:


word-spacing.maximum="0.05em">Thai text with normal spaces as word 
separators


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  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 
, FOP-2355 
). It is also true 
that FOP is not presently performing line breaking in phrase internal 
positions (FOP-2066 ), 
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:


​

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:


letter-spacing.maximum="0.1em">​​


or

letter-spacing.maximum="0.1em">​treat-as-word-space='true'>​


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-unsubscr...@xmlgraphics.apache.org

For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org






Re: fo:character and zero width space

2016-02-12 Thread Glenn Adams
On Fri, Feb 12, 2016 at 3:17 AM, Carlos Villegas  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:
>
> Thai
> text with normal spaces as word separators
>
> 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 < 
> c...@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
> , FOP-2355
> ). It is also true that
> FOP is not presently performing line breaking in phrase internal positions (
> FOP-2066 ), 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:
>
> ​
>
> 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:
>
>  letter-spacing.maximum="0.1em">​​
>
> or
>
>  letter-spacing.maximum="0.1em">​ treat-as-word-space='true'>​
>
> 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-unsubscr...@xmlgraphics.apache.org
>> For additional commands, e-mail: 
>> fop-users-h...@xmlgraphics.apache.org
>>
>>
>
>


Custom hyphenation files

2016-02-12 Thread John Brown

I was tring to follow the instructions for manually installing OFFO
hyphenation files.
 https://xmlgraphics.apache.org/fop/1.0/hyphenation.html shows
how to use the source files (not the compiled fop-hyph.jar). I did the
following:

1) I renamed $FOP_HOME/lib/fop-hyph.jar.
2) I copied en_GB.xml from offo-hyphenation.zip to /path/to/book.xml
3) Added the following entry to fop.xconf:
  en_GB
4) Then
  cd /path/to/book.xml
  xsltproc -o book.fo xsl-ns/fo/docbook.xsl book.xml
  fop -c fop.xconf book.fo book.pdf

The result was:
INFO: Rendered page #1.
Exception in thread "main" java.lang.StackOverflowError
    at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:191)
    at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:244)
...[line above repeated several times]

        at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:244)

Two questions:

1) What am I doing wrong? By the way, it is fop-svn 1728886.

2) How do you choose the location of en_GB.xml? I tried setting
hyphenation-base. https://xmlgraphics.apache.org/fop/2.0/configuration.html
says that relative URIs for hyphenation-base are evaluated relative to the base
URI of the configuration file. Does that mean that mean that hyphenation-base
would have to be set to ..//full/path/to/en_GB-location?

For what it is worth, I set ..

Regards,
John Brown.
   
-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Custom hyphenation files

2016-02-12 Thread Mathieu Malaterre
On Fri, Feb 12, 2016 at 5:37 PM, John Brown  wrote:
> Exception in thread "main" java.lang.StackOverflowError
> at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:191)
> at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:244)
> ...[line above repeated several times]
>
> at org.apache.fop.hyphenation.TernaryTree.insert(TernaryTree.java:244)

Looks like:

https://issues.apache.org/jira/browse/FOP-2569

2cts

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