Skip to content

FOP-2469: Auto table layout - #95

Open
chkpnt wants to merge 2 commits into
apache:mainfrom
chkpnt:auto-layout
Open

FOP-2469: Auto table layout#95
chkpnt wants to merge 2 commits into
apache:mainfrom
chkpnt:auto-layout

Conversation

@chkpnt

@chkpnt chkpnt commented Oct 23, 2025

Copy link
Copy Markdown

Draft for FOP-2469 by applying FOP-2469-2018-07-17.patch.

Comment thread fop-core/src/main/java/org/apache/fop/fo/flow/table/Table.java Outdated
*/
protected int getLineWidth(int line) {
assert lineWidth >= 0;
// assert lineWidth >= 0;

@chkpnt chkpnt Oct 23, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What could be the reason for commenting out this assertion? I've compared the patches in FOP-2469 and this was introduced in Eric Lim's version of the patch. @esclim Do you remember, why you did this 7 years ago? ;-)

private int increaseMinimumWidthOfSpannedColumns(List columnsToWiden, int minSpanWidthOfSpannedCells, int minIPD, LayoutContext context) {
int totalIncrease = 0;

for (Iterator iter = columnsToWiden.iterator(); iter.hasNext();) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raw type

@esclim

esclim commented Oct 30, 2025 via email

Copy link
Copy Markdown

@siebej

siebej commented Jul 22, 2026

Copy link
Copy Markdown

While stress-testing this patch on a 943-page document (Dutch government publication with 536 auto-layout tables) we hit an NPE in ColumnSetup.redistributeAuto: tLM.getPossibleWidths(tcol, context) returns null for columns without PrimaryGridUnits (empty columns in a table with a fixed width), but unlike redistribute() this method does not null-check before calling getMax().

Suggested fix, mirroring the null handling in redistribute():

MinOptMax possibleWidth = tLM.getPossibleWidths(tcol, context);
if (possibleWidth == null) {
    // no PrimaryGridUnits in this column; its width is zero
    continue;
}

With that fix (and a rebuilt event model for columnsInAutoTableTooWide) the whole 943-page document renders in ~9 seconds with sensible content-based column widths. Happy to share test material if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants