xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan (Jira)" <j...@apache.org>
Subject [jira] [Commented] (FOP-2374) space missing before fo:page-number-citation-last in PDF output
Date Wed, 16 Jun 2021 11:48:00 GMT

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

Juan commented on FOP-2374:
---------------------------

Got into the same issue with a <fo:page-number-citation/> element. Upon further analysis,
this happens whenever a block ends with an empty inline element.

Tracked the issue up to XMLWhiteSpaceHandler, see proposed patch [^FOP-2374_Clear_pendingInlines_when_text_is_found_.patch].
This is partially covered by the already existent test "inline_white-space-treatment_bugzilla45097.xml"
and further tested it using this input: [^test-input.fo].

Patch explanation:
Case: 
* Given: Inline element that ends with space, followed by plain text.
* Processing the Inline element adds a pending inline.
* Processing the text. That left the pending inline unprocessed.
** This should only happen when text is only white space ( nonWhiteSpaceCount == 0 )
** Otherwise, it should clear all pending inlines because they're not trailing space anymore.

The problem:
* That unprocessed pending inline becomes a problem **IF** it's procesed (that's what removes
the valid space).
** It is cleared by XMLWhiteSpaceHandler in line 227 ( pendingInlines.clear(); ) if it's followed
by any inline that has text (not only next one, there can be many empty inlines and then and
inline with text).
** When there's no inline with text, 227 is not executed, and when reaching the end of the
block, it processes all pending inlines in a shortcut path (line 153/155 `if (endOfBlock)
{ handlePendingInlines(); }`).

> space missing before fo:page-number-citation-last in PDF output
> ---------------------------------------------------------------
>
>                 Key: FOP-2374
>                 URL: https://issues.apache.org/jira/browse/FOP-2374
>             Project: FOP
>          Issue Type: Bug
>          Components: renderer/pdf
>    Affects Versions: 1.1
>            Reporter: Jason Harrop
>            Priority: Minor
>         Attachments: FOP-2374_Clear_pendingInlines_when_text_is_found_.patch, _test.fo,
test-input.fo
>
>
> When you generate a PDF from FO such as:
> <fo:block><fo:inline>of </fo:inline><fo:page-number-citation-last
ref-id="page2"/></fo:block>
> the whitespace between the word "of" and the page-number-citation-last element is lost.
> In http://apache-fop.1065347.n5.nabble.com/preserving-a-trailing-space-in-inline-td40644.html
 Pascal Sancho 
> diagnosed that the issue arises when a fo:page-number-citation-last (PNCL) comes after
a fo:inline element
> and no content comes after the PNCL.
> He also identified a workaround: "Just add a character AFTER the PNCL element other than
a regular white space"
> I'm also attaching his test FO file



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message