Bug 51984 - Complex script version of FOP goes into infinite loop
Summary: Complex script version of FOP goes into infinite loop
Status: CLOSED WORKSFORME
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: trunk
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-06 23:00 UTC by Jonathan Levinson
Modified: 2012-04-01 13:42 UTC (History)
0 users



Attachments
FO File for reproducing problem (3.44 KB, text/xml)
2011-10-06 23:00 UTC, Jonathan Levinson
Details
fop.xconf used in reproducing problem (26.97 KB, application/octet-stream)
2011-10-06 23:01 UTC, Jonathan Levinson
Details
generated PDF using arial with current dev branch code (22.16 KB, application/pdf)
2011-10-09 03:02 UTC, Glenn Adams
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Levinson 2011-10-06 23:00:19 UTC
Created attachment 27712 [details]
FO File for reproducing problem

I used complex script from the following location:

http://people.apache.org/~spepping/

I ran the command to generate an FO as follows:

c:\fop-ComplexScripts\fop.cmd -c c:\fop-ComplexScripts\conf\fop.xconf -fo Arabic.fo -pdf Arabic.pdf

I attach the fo file and the fop.xconf file.

The FOP code seems to go into an infinite loop.

Here is the output before FOP seemingly hangs forever.

C:\InterSystems\cache121\MGR\Temp>c:\fop-ComplexScripts\fop.cmd -c c:\fop-Comple
xScripts\conf\fop.xconf -fo Arabic.fo -pdf Arabic.pdf
Oct 6, 2011 6:49:16 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-height set to: 11in
Oct 6, 2011 6:49:16 PM org.apache.fop.apps.FopFactoryConfigurator configure
INFO: Default page-width set to: 8.26in
Oct 6, 2011 6:49:18 PM org.apache.fop.layoutmgr.table.ColumnSetup computeTableUn
it
WARNING: No space remaining to distribute over columns.
Comment 1 Jonathan Levinson 2011-10-06 23:01:30 UTC
Created attachment 27713 [details]
fop.xconf used in reproducing problem

This is the fop.xconf I used in what looks like an infinite loop problem.
Comment 2 Glenn Adams 2011-10-09 03:00:22 UTC
The supplied input FO file WORKSFORME without any loop behavior, execution time 3 secs (mostly startup). I'm attaching the output PDF file.

I did not use the XCONF file. For the most part, you do not need to use XCONF to configure fonts in FOP 1.0 and later,  unless you wish to subset your system installed fonts. My XCONF file has the following PDF renderer configuration:

    <renderer mime="application/pdf">
      <filterList>
        <value>flate</value>
      </filterList>
      <fonts>
        <auto-detect/>
      </fonts>
    </renderer>

I'm using my current dev work branch at [1]. I can't say whether the build you tried works or not, as that is not one of my builds.

Also, please note the following:

(1) in general, you should use fonts designed for Arabic and indicated to be supported at [2], e.g., Simplified Arabic, Traditional Arabic, etc.; other OpenType fonts that contain Arabic glyphs and OpenType AAT (GSUB/GPOS) tables may work, but haven't been verified; [apparently Arial on my Mac does happen to have Arabic glyphs and OTF AAT tables, so it happens to work]

(2) you should use the writing-mode attribute on fo:page-sequence (or on fo:block-container) to specify the writing mode of the generated reference areas; for example, specifying writing-mode="rl" on fo:page-sequence will automatically make the first column in a multi-column page the right-most column, and make the first column in a table the right-most column, and will align the start edge with the right edge, so you don't need to explicitly specify right alignment; note that text-align="start|end" is now resolved according to writing mode;

[1] http://github.com/skynavga/fop
[2] http://skynav.trac.cvsdude.com/fop/wiki/SupportedFonts
Comment 3 Glenn Adams 2011-10-09 03:02:29 UTC
Created attachment 27743 [details]
generated PDF using arial with current dev branch code
Comment 4 Matthias Reischenbacher 2011-10-10 15:01:09 UTC
This could be related to:
https://issues.apache.org/bugzilla/show_bug.cgi?id=51282
which was actually a bug introduced in trunk. Probably you are using an older version of the complex script branch, where the fix hasn't been merged yet.
Comment 5 Glenn Adams 2011-10-10 23:23:43 UTC
(In reply to comment #2)
> (2) you should use the writing-mode attribute on fo:page-sequence (or on
> fo:block-container) to specify the writing mode of the generated reference
> areas; for example, specifying writing-mode="rl" on fo:page-sequence will
> automatically make the first column in a multi-column page the right-most
> column, and make the first column in a table the right-most column, and will
> align the start edge with the right edge, so you don't need to explicitly
> specify right alignment; note that text-align="start|end" is now resolved
> according to writing mode;

I should also add that an important effect of using writing-mode="rl" on fo:page-sequence is that this makes the default bidirectional level right-to-left on blocks (e.g., paragraphs). If you then need to have certain blocks use left-to-right as their default bidi level, then you can use one of the following:

(1) wrap the block's content with fo:bidi-override, e.g.,

<fo:block><fo:bidi-override unicode-bidi="embed" direction="ltr">...</fo:bidi-override></block>

(2) wrap the block's content with explicit Unicode bidi control characters (i.e., RLE and PDF):

<fo:block>&#x202A;...&#x202C;</block>

(3) wrap the block with a relative block-container with a left-to-right writing mode, e.g.,

<fo:block-container writing-mode="lr"><fo:block>...</fo:block></fo:block-container>

These techniques actually produce slightly different treatment at the bidi level. The first and second above keep the block at the same default bidi level prescribed by the page-sequence's writing mode, namely right-to-left, but inserts a new left-to-right embedding level into which the block's content is scoped. In contrast, the third technique actually changes the default bidi level of the blocks contained in the block-container to left-to-right.
Comment 6 Glenn Adams 2012-04-01 13:42:57 UTC
batch transition to closed for remaining resolved bugs