[ 
https://issues.apache.org/jira/browse/FOP-2351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13914728#comment-13914728
 ] 

Vu commented on FOP-2351:
-------------------------

I've performed some debugging and here is what I've found:
1. In TXTState.refineCTM(), it is still using TXTRenderer.CHAR_HEIGHT instead 
of TXTRenderer.CHAR_HEIGHT + 2 * TXTRenderer.LINE_LEADING and that causes the 
text to fall outside of visible area and not written to the Buffer
2. In 0.95, I've set my "line-height" to "7.86pt" and it works but in this 
version because of new changes introduced (LINE_LEADING), the "line-height" 
must be set to 10pt for all blocks

My recommend solution is:
1.  In TXTRenderer, create a new constant LINE_HEIGHT = CHAR_HEIGHT + 2 * 
LINE_LEADING
2.  Replace all "CHAR_HEIGHT + 2 * LINE_LEADING" expression with LINE_HEIGHT
3.  In TXTState.refineCTM(), replace TXTRenderer.CHAR_HEIGHT with 
TXTRenderer.LINE_HEIGHT
4.  In fo.xml file, make sure to set "line-height" to 10pt for all blocks


During debugging, I've also found the following abnormality:
1.  The method AbstractPathOrientedRenderer.establishTransformationMatrix() 
calls saveGraphicsState() and then concatenateTransformationMatrix() and then 
later on, it will call restoreGraphicsState()
2.  The TXTRenderer class do 2 pushes on to the TXTState: 1 at 
saveGraphicsState() and 1 at concatenateTransformationMatrix() but only do 1 
pop() at restoreGraphicsState().  The end result is it has unbalanced of items 
in the TXTState's stack.

Even though that it seems to cause no harms, it is still consume memory and 
affects performance.  Here is my recommendations:
1.  Do not perform the push at saveGrapicsState() (recommended fix)
or
2. Perform 2 pops() at restoreGrpahicsState()

Other recommendations:
1.  In TXTState, the LinkList stackCTM could be corrected with generics so 
there will be no warning
2.  In TXTRenderer, consider replacing StringBuffer with StringBuilder to 
improve performance as StringBuffer is synchronized.

> Text output swallow text when spanning multi pages
> --------------------------------------------------
>
>                 Key: FOP-2351
>                 URL: https://issues.apache.org/jira/browse/FOP-2351
>             Project: Fop
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 1.1
>            Reporter: Vu
>         Attachments: fo-txt-debug.txt.txt, fo-txt-debug.xml.txt
>
>
> When creating txt output, about 9 lines of content was swallowed 
> (disappeared) at the end of each page



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to