childContext.setAlignmentContext(context.getAlignmentContext());
contentList = clm.getNextKnuthElements(childContext, 0);
int width = clm.getStackingSize();
- Space spacer = null;
- if (fobj.getLeaderPatternWidth().getValue(this) > width) {
- spacer = new Space();
- spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
- width = fobj.getLeaderPatternWidth().getValue(this);
- }
- fa.setUnitWidth(width);
- if (spacer != null) {
- fa.addChildArea(spacer);
+ if (width != 0) {
+ Space spacer = null;
+ if (fobj.getLeaderPatternWidth().getValue(this) > width) {
+ spacer = new Space();
+ spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
+ width = fobj.getLeaderPatternWidth().getValue(this);
+ }
+ fa.setUnitWidth(width);
+ if (spacer != null) {
+ fa.addChildArea(spacer);
+ }
+ leaderArea = fa;
+ } else {
+ //Content collapsed to nothing, so use a space
+ leaderArea = new Space();
+ leaderArea.setBPD(1);
}
- leaderArea = fa;
}
TraitSetter.setProducerID(leaderArea, fobj.getId());
return leaderArea;
<changes>
<release version="FOP Trunk" date="TBD">
+ <action context="Layout" dev="JM" type="fix">
+ Fixed the source for a NullPointerException when the content of an fo:leader with
+ leader-pattern="use-content" collapses to zero width during layout.
+ </action>
<action context="Renderers" dev="JM" type="fix">
Fixed border trait parsing for the area tree XML when CMYK or ICC colors were used.
</action>
</fo:instream-foreign-object></fo:leader>
Content is svg 20 x 10 which is wider than the leader-length
</fo:block>
+ <fo:block>
+ <fo:leader leader-length="36pt" leader-pattern="use-content"> </fo:leader>
+ Content is " "
+ </fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
<eval expected="0" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/@offset"/>
<eval expected="20000" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@ipd"/>
<eval expected="-1384" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@offset"/>
+
+ <eval expected="11100" xpath="//flow/block[8]/lineArea/@bpd"/>
+ <eval expected="36000" xpath="//flow/block[8]/lineArea/space[1]/@ipd"/>
+ <eval expected="0" xpath="//flow/block[8]/lineArea/space[1]/@offset"/>
</checks>
</testcase>