You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2010/10/27 13:54:00 UTC
DO NOT REPLY [Bug 50163] New: Problem with list containing
multi-line items in RTF
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
Summary: Problem with list containing multi-line items in RTF
Product: Fop
Version: 1.0
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: rtf
AssignedTo: fop-dev@xmlgraphics.apache.org
ReportedBy: dmitro@newground.ch
I have a problem rendering a list with multi-line items in RTF.
I have html
<ul>
<li>
<p>
Item 1 Line 1<br />
Item 1 Line 2<br />
Item 1 Line 3
</p>
</li>
<li>
<p>
Item 2 Line 1<br />
Item 2 Line 2<br />
Item 2 Line 3
</p>
</li>
</ul>
which gets transformed into fo as
<fo:list-block>
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:inline>•</fo:inline>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
Item 1 Line 1
</fo:block>
<fo:block>
Item 1 Line 2
</fo:block>
<fo:block>
Item 1 Line 3
</fo:block>
</fo:list-item-body>
</fo:list-item>
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:inline>•</fo:inline>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
Item 2 Line 1
</fo:block>
<fo:block>
Item 2 Line 2
</fo:block>
<fo:block>
Item 2 Line 3
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
It renders to PDF correctly as
* Item 1 Line 1
Item 1 Line 2
Item 1 Line 3
* Item 2 Line 1
Item 2 Line 2
Item 2 Line 3
but in RTF it appears as
* Item 1 Line 1
* Item 1 Line 2
* Item 1 Line 3
* Item 2 Line 1
* Item 2 Line 2
* Item 2 Line 3
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 50163] Problem with list containing multi-line
items in RTF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
--- Comment #1 from Jerry Fan <01...@tongji.edu.cn> 2010-12-21 07:59:49 EST ---
Created an attachment (id=26433)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26433)
Fixed the Problem with list containing multi-line items in RTF
I have tried it on my fo file and it works
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 50163] Problem with list containing multi-line
items in RTF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
--- Comment #2 from Jerry Fan <01...@tongji.edu.cn> 2010-12-21 08:05:08 EST ---
Created an attachment (id=26434)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26434)
My fo file
The orignal fo file
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
RE: Copyfitting and Flexible Layout
Posted by Patrick Jaromin <pa...@jgsullivan.com>.
Jeremias-
Yeah, I recall reading this wiki page back when I started looking into this. In my case, there aren't alternative contents -- I needed to adjust various properties of the contents -- namely the font-size and line-spacing.
In my system, custom attributes are added to the fo:block-container element that look something like:
myrx:copyfit-strategy="min-opt-max" myrx:copyfit-ruleset="font(36,20,80,1) line(2.0,1.1,2.2,.1)"
This would notify the copyfitter to first adjust the font, starting at 36pt and increment/decrement by 1pt until best fit. Then it will adjust the linespacing the same way. There can be as many rulesets as desired...so the refinement can continue, though at the cost of more iterations.
In my initial version I hacked in my own layout listener that I could register to be notified of overflows in various layout manager classes. The actual adjustments take place outside of FOP. Back when I did this, I noticed the EventProducer interfaces in HEAD, however there were rendering issues with the code in HEAD at the time so I was unable to use it.
Reviewing FOP 1.0, it looks like I should be able to use the EventBroadcaster to be notified of the overflow events I need...though I haven't worked out if I will have everything I need from the event. I was passing up the FObj in the event. I'll need to dig some more.
Ideally I would be able to make the adjustments and perform another pass within the main render process instead of kicking off a new trial render each time there's at least one overflowing section. However, it's unclear to me how this could work, or even if it's practical/possible as, if I remember correctly, the attributes I'd need to modify are read only by this point in the process. If there's a way to make this work as part of the core renderer or as some kind of plugin to it, I'd be happy to see if I can get the budget and contribute the results.
BTW: In reviewing the code, it looks like LineLayoutManager line #385, the event is only thrown if the log level is WARN. Bug?
-Patrick
-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
Sent: Thursday, October 28, 2010 1:44 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: Copyfitting and Flexible Layout
We've written down some thoughts about the topic some time ago:
http://wiki.apache.org/xmlgraphics-fop/WhitespaceManagement
But there were no further actions on this.
On 27.10.2010 20:11:29 Patrick Jaromin wrote:
> Early last year I implemented copyfitting and flexible layouts into our
> FOP-based rendering process by locally branching FOP 0.95, adding my
> own listener/event mechanism and FO extensions, and a pre-processor that
> implements the copyfitting strategies through an iterative process of
> render-modify-render-...
>
> I'm hoping to upgrade to the FOP 1.0 codebase and rather than branching
> and re-implementing my hacks, I'd prefer to extend the base in a more
> maintainable way that perhaps others could also benefit from.
>
> Before I embark on this process (or even discuss it in more depth) I
> figured I'd see if anyone else has made any movements on this or has
> any thoughts. My system uses my own namespace/attributes, however I would
> likely adopt the specifications outlined in XSL:FO 2.0 working draft
> (http://www.w3.org/TR/xslfo20/#req_2_1_4).
>
> Thoughts/Comments?
>
>
> Patrick K. Jaromin
> VP Technology
> 312.943.1600 * fax 312.640.8100
>
> JGSullivan Interactive, Inc.
>
>
Jeremias Maerki
RE: Copyfitting and Flexible Layout -- Changes to EventProducers?
Posted by Patrick Jaromin <pa...@jgsullivan.com>.
Yes, Chris, this is "copyfitting" as I understand it -- we have a block of text that may vary in length at runtime that must be fit into a fixed-size block.
I was away on vacation last week, but have finally managed to get back to this and it looks like I can *almost* make my system work using the EventBroadcaster model in FOP 1.0. However, the problem I'm having is I am unable to consistently get a handle on the actual block where the overflow occurred.
When the event source isn't a subclass AbstractBaseLayoutManager (such as line overflows from a LineLayoutManager$LineBreakingAlgorithm) I have no way of reliably finding the offending block so that I can make adjustments. The org.xml.sax.Locator is really only for debug messages and not useful for this purpose.
My hacked version of 0.95 passed the FObj into the event.
Are others using their own EventProducers?
I would prefer if possible to patch the existing code instead of making a local fork again...but I'm not sure what the "right" or even the best solution would be. Easiest would be simply adding a new parameter -- FObj -- to the three producer methods I need, however this seems rather messy. Perhaps instead the Locator argument could be replaced with either an FObj arg (not sure if ALL that throw have access to FObj), or some interface that extends Locator but includes a getFObj() method?
Thoughts?
-Patrick
-----Original Message-----
From: Chris Bowditch [mailto:bowditch_chris@hotmail.com]
Sent: Wednesday, November 03, 2010 7:25 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: Copyfitting and Flexible Layout
On 28/10/2010 07:44, Jeremias Maerki wrote:
Hi Jeremias,
sorry for the late reply:
> We've written down some thoughts about the topic some time ago:
> http://wiki.apache.org/xmlgraphics-fop/WhitespaceManagement
> But there were no further actions on this.
I just wanted to clarify: copyfitting is different from whitespace
management. The difference is that copyfitting is about making
adjustments to font sizes and other attributes to make an object of
unknown size fit into pre-defined space. The size of the object is not
known until runtime but the space we allocate for the object is known at
design time.
Whitespace management is where we have space of unknown size, e.g.
remaining space on a page, and we have several alternative objects. The
object chosen to be placed into the space of unknown size, depends on
which objects fits the space best at layout stage.
I hope I have explained the difference clearly.
Thanks,
Chris
>
> On 27.10.2010 20:11:29 Patrick Jaromin wrote:
>> Early last year I implemented copyfitting and flexible layouts into our
>> FOP-based rendering process by locally branching FOP 0.95, adding my
>> own listener/event mechanism and FO extensions, and a pre-processor that
>> implements the copyfitting strategies through an iterative process of
>> render-modify-render-...
>>
>> I'm hoping to upgrade to the FOP 1.0 codebase and rather than branching
>> and re-implementing my hacks, I'd prefer to extend the base in a more
>> maintainable way that perhaps others could also benefit from.
>>
>> Before I embark on this process (or even discuss it in more depth) I
>> figured I'd see if anyone else has made any movements on this or has
>> any thoughts. My system uses my own namespace/attributes, however I would
>> likely adopt the specifications outlined in XSL:FO 2.0 working draft
>> (http://www.w3.org/TR/xslfo20/#req_2_1_4).
>>
>> Thoughts/Comments?
>>
>>
>> Patrick K. Jaromin
>> VP Technology
>> 312.943.1600 * fax 312.640.8100
>>
>> JGSullivan Interactive, Inc.
>>
>>
>
>
>
> Jeremias Maerki
>
>
>
Re: Copyfitting and Flexible Layout
Posted by Chris Bowditch <bo...@hotmail.com>.
On 28/10/2010 07:44, Jeremias Maerki wrote:
Hi Jeremias,
sorry for the late reply:
> We've written down some thoughts about the topic some time ago:
> http://wiki.apache.org/xmlgraphics-fop/WhitespaceManagement
> But there were no further actions on this.
I just wanted to clarify: copyfitting is different from whitespace
management. The difference is that copyfitting is about making
adjustments to font sizes and other attributes to make an object of
unknown size fit into pre-defined space. The size of the object is not
known until runtime but the space we allocate for the object is known at
design time.
Whitespace management is where we have space of unknown size, e.g.
remaining space on a page, and we have several alternative objects. The
object chosen to be placed into the space of unknown size, depends on
which objects fits the space best at layout stage.
I hope I have explained the difference clearly.
Thanks,
Chris
>
> On 27.10.2010 20:11:29 Patrick Jaromin wrote:
>> Early last year I implemented copyfitting and flexible layouts into our
>> FOP-based rendering process by locally branching FOP 0.95, adding my
>> own listener/event mechanism and FO extensions, and a pre-processor that
>> implements the copyfitting strategies through an iterative process of
>> render-modify-render-...
>>
>> I'm hoping to upgrade to the FOP 1.0 codebase and rather than branching
>> and re-implementing my hacks, I'd prefer to extend the base in a more
>> maintainable way that perhaps others could also benefit from.
>>
>> Before I embark on this process (or even discuss it in more depth) I
>> figured I'd see if anyone else has made any movements on this or has
>> any thoughts. My system uses my own namespace/attributes, however I would
>> likely adopt the specifications outlined in XSL:FO 2.0 working draft
>> (http://www.w3.org/TR/xslfo20/#req_2_1_4).
>>
>> Thoughts/Comments?
>>
>>
>> Patrick K. Jaromin
>> VP Technology
>> 312.943.1600 * fax 312.640.8100
>>
>> JGSullivan Interactive, Inc.
>>
>>
>
>
>
> Jeremias Maerki
>
>
>
Re: Copyfitting and Flexible Layout
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
We've written down some thoughts about the topic some time ago:
http://wiki.apache.org/xmlgraphics-fop/WhitespaceManagement
But there were no further actions on this.
On 27.10.2010 20:11:29 Patrick Jaromin wrote:
> Early last year I implemented copyfitting and flexible layouts into our
> FOP-based rendering process by locally branching FOP 0.95, adding my
> own listener/event mechanism and FO extensions, and a pre-processor that
> implements the copyfitting strategies through an iterative process of
> render-modify-render-...
>
> I'm hoping to upgrade to the FOP 1.0 codebase and rather than branching
> and re-implementing my hacks, I'd prefer to extend the base in a more
> maintainable way that perhaps others could also benefit from.
>
> Before I embark on this process (or even discuss it in more depth) I
> figured I'd see if anyone else has made any movements on this or has
> any thoughts. My system uses my own namespace/attributes, however I would
> likely adopt the specifications outlined in XSL:FO 2.0 working draft
> (http://www.w3.org/TR/xslfo20/#req_2_1_4).
>
> Thoughts/Comments?
>
>
> Patrick K. Jaromin
> VP Technology
> 312.943.1600 * fax 312.640.8100
>
> JGSullivan Interactive, Inc.
>
>
Jeremias Maerki
Re: Copyfitting and Flexible Layout
Posted by Tony Graham <To...@MenteithConsulting.com>.
On Wed, October 27, 2010 8:11 pm, Patrick Jaromin wrote:
...
> Before I embark on this process (or even discuss it in more depth) I
> figured I'd see if anyone else has made any movements on this or has any
> thoughts. My system uses my own namespace/attributes, however I would
> likely adopt the specifications outlined in XSL:FO 2.0 working draft
> (http://www.w3.org/TR/xslfo20/#req_2_1_4).
The XSL FO 2.0 Requirements note [1] includes a section on copyfitting
[2]. I expect, but can't promise, that the next, real-soon-now version of
the XSL FO 2.0 Working Draft [3]. When copyfitting is in a published WD,
it would be useful for the next version of XSL FO if you could review the
WD in light of your experience and provide feedback using the W3C Bugsilla
[4].
Regards,
Tony Graham Tony.Graham@MenteithConsulting.com
Director W3C XSL FO SG Invited Expert
Menteith Consulting Ltd XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599 http://www.menteithconsulting.com
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
xmlroff XSL Formatter http://xmlroff.org
xslide Emacs mode http://www.menteith.com/wiki/xslide
Unicode: A Primer urn:isbn:0-7645-4625-2
[1] http://www.w3.org/TR/xslfo20-req/
[2] http://www.w3.org/TR/xslfo20-req/#copyfitting
[3] http://www.w3.org/TR/xslfo20/
[4] http://www.w3.org/XML/2008/01/xsl-fo-bugzilla.html
Copyfitting and Flexible Layout
Posted by Patrick Jaromin <pa...@jgsullivan.com>.
Early last year I implemented copyfitting and flexible layouts into our FOP-based rendering process by locally branching FOP 0.95, adding my own listener/event mechanism and FO extensions, and a pre-processor that implements the copyfitting strategies through an iterative process of render-modify-render-...
I'm hoping to upgrade to the FOP 1.0 codebase and rather than branching and re-implementing my hacks, I'd prefer to extend the base in a more maintainable way that perhaps others could also benefit from.
Before I embark on this process (or even discuss it in more depth) I figured I'd see if anyone else has made any movements on this or has any thoughts. My system uses my own namespace/attributes, however I would likely adopt the specifications outlined in XSL:FO 2.0 working draft (http://www.w3.org/TR/xslfo20/#req_2_1_4).
Thoughts/Comments?
Patrick K. Jaromin
VP Technology
312.943.1600 * fax 312.640.8100
JGSullivan Interactive, Inc.
DO NOT REPLY [Bug 50163] Problem with list containing multi-line
items in RTF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
--- Comment #3 from Jerry Fan <01...@tongji.edu.cn> 2010-12-21 08:07:01 EST ---
Created an attachment (id=26435)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26435)
The generated rtf file
The generated rtf file
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 50163] Problem with list containing multi-line
items in RTF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
Jerry Fan <01...@tongji.edu.cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #4 from Jerry Fan <01...@tongji.edu.cn> 2010-12-21 08:08:30 EST ---
The uploaded patch does work for me.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 50163] Problem with list containing multi-line
items in RTF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
Jerry <wh...@hotmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |whitekingdom0105@hotmail.co
| |m
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 50163] Problem with list containing multi-line
items in RTF
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50163
Glenn Adams <gl...@skynav.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #5 from Glenn Adams <gl...@skynav.com> 2012-04-01 13:42:46 UTC ---
batch transition to closed for remaining resolved bugs
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.