Bug 25732 - [PATCH] Supress leading spaces after a line-break.
Summary: [PATCH] Supress leading spaces after a line-break.
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: trunk
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-23 19:22 UTC by Finn Bock
Modified: 2012-04-01 06:48 UTC (History)
0 users



Attachments
The patch against HEAD (1.67 KB, patch)
2003-12-23 19:24 UTC, Finn Bock
Details | Diff
A test .fo that illustrate the problem. (1.39 KB, text/plain)
2003-12-23 19:26 UTC, Finn Bock
Details
A new unified patch against HEAD that overrides the previous patch. (2.72 KB, patch)
2003-12-24 13:53 UTC, Finn Bock
Details | Diff
A slightly diffrent test that also checks for the bug in 25743. (1.78 KB, text/plain)
2003-12-24 13:54 UTC, Finn Bock
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Finn Bock 2003-12-23 19:22:46 UTC
This patch fixes the problem with leading spaces after a line-break. 

Such spaces should be suppressed according to J.Pietschmann:
http://marc.theaimsgroup.com/?l=fop-dev&m=107185453129923&w=2
Comment 1 Finn Bock 2003-12-23 19:24:52 UTC
Created attachment 9687 [details]
The patch against HEAD
Comment 2 Finn Bock 2003-12-23 19:26:30 UTC
Created attachment 9688 [details]
A test .fo that illustrate the problem.
Comment 3 Simon Pepping 2003-12-23 21:00:38 UTC
I think the new boolean first is equivalent to vecInlineBreaks.isEmpty(), so
that the patch could be:

   inlineLC.setFlags(LayoutContext.SUPPRESS_LEADING_SPACE,
				   (vecInlineBreaks.size() == iPrevLineEnd
-                               && !vecInlineBreaks.isEmpty()
                                && ((BreakPoss)
vecInlineBreaks.get(vecInlineBreaks.size() - 1)).
                                    isForcedBreak() == false));
Comment 4 Finn Bock 2003-12-23 21:21:25 UTC
Simon, your patch is certainly too simple. When vecInlineBreaks happens to be 
empty, then we are not allowed to access the vecInlineBreaks()-1 'th element.
So there have to be at least a check for that.
Comment 5 Glen Mazza 2003-12-23 21:33:22 UTC
We need code comments, also a more descriptive variable name so people 
understand X months from now what it is for--what does the boolean "first" 
variable refer to -- first line?

Thanks,
Glen
Comment 6 Glen Mazza 2003-12-23 22:31:23 UTC
Finn, I can add the comments in, but, apologies for my slowness here--what 
does "first" precisely indicate within the processing of the document?  First 
line after a preceding line-break or block or what?

Thanks,
Glen
Comment 7 Finn Bock 2003-12-24 12:30:52 UTC
The use of 'first' is to indicate that space suppression should only happen at 
the very first flow object in a block. But Simon and Glen's comments have made 
me realize that that is probably wrong. Space suppression should occur for each 
flow object until a bp is added. So the test 
   vecInlineBreaks.size() == iPrevLineEnd
is enough and the badly named 'first' vrbl can be removed.

Unfortunately this triggers a different bug where setting space suppression on 
a InlineStackingLM cause space suppression to occurs for each of the LM's 
children.

I'll take a look at that problem, and until I come up with something, this 
patch should be suspended.
Comment 8 Finn Bock 2003-12-24 13:52:25 UTC
A new patch, that doesn't introduce new vrbls but uses the existing test for a 
new line.

The patch also ensure that a child InlineStackingLM always uses the parent LM 
value for SUPPRESS_LEADING_SPACES. As it were, the parent value was only used 
when the InlineStackingLM started a new area.

This patch also fixes bug 25743.

Thank you Simon and Glen for your help.

regards,
finn
Comment 9 Finn Bock 2003-12-24 13:53:24 UTC
Created attachment 9696 [details]
A new unified patch against HEAD that overrides the previous patch.
Comment 10 Finn Bock 2003-12-24 13:54:24 UTC
Created attachment 9697 [details]
A slightly diffrent test that also checks for the bug in 25743.
Comment 11 Finn Bock 2005-09-12 10:12:00 UTC
Problem fixed long ago by knuth algo, patch no longer valid anyway.
Comment 12 Glenn Adams 2012-04-01 06:48:14 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed