Paragraphs in table cells in PDF via XSL-FO output
Posted: Thu May 07, 2020 12:22 am
I've noticed that any time a table cell's content is wrapped in a paragraph, it shifts the text down unconditionally in the rendered output beyond the padding of 3pt. The shift is
I just rendered a simple test with Oxygen 22's DITA to PDF via XSL-FO. If a table cell just has text in it, there are 3pts of space around it within the cell's borders. If the text is wrapped in a paragraph, then it's about 7.4pts worth of space. The stylesheets have a common.block attr set with .6em above and below, which converts to 7.2pts, roughly.
The generated FO in topic.fo has:
Given my measurements, it appears that the 0.6em spacing is used and the 3pts from the block inside the cell isn't used, presumably because of the area stacking algorithm. It seems to me that the space-before and space-after attributes may need to be adjusted in general so the stacking algorithm can do the right thing or overridden just for the first paragraph in a cell. Is there some combination of the conditionality, minimum, maximum, or optimum qualifiers that would take care of commonblock spacing in such circumstances? It seems that the actual spacing at the top and bottom of a paragraph in a table cell should be 3pts and ignore the commonblock's space-before measurement, which is the opposite of what it's doing.
What is the expected layout behavior in this case?
Here is my attempt at using Acrobat's measuring "tool" to document the results:

I just rendered a simple test with Oxygen 22's DITA to PDF via XSL-FO. If a table cell just has text in it, there are 3pts of space around it within the cell's borders. If the text is wrapped in a paragraph, then it's about 7.4pts worth of space. The stylesheets have a common.block attr set with .6em above and below, which converts to 7.2pts, roughly.
Code: Select all
<!-- paragraph-like blocks -->
<xsl:attribute-set name="common.block">
<xsl:attribute name="space-before">0.6em</xsl:attribute>
<xsl:attribute name="space-after">0.6em</xsl:attribute>
</xsl:attribute-set>
Code: Select all
<fo:table-cell border-after-color="black" border-after-style="solid"
border-after-width="1pt" border-before-color="black"
border-before-style="solid" border-before-width="1pt" text-align="left">
<fo:block end-indent="3pt" font-weight="bold" space-after="3pt"
space-after.conditionality="retain" space-before="3pt"
space-before.conditionality="retain" start-indent="3pt">
<fo:block space-after="0.6em" space-before="0.6em" text-indent="0em"
>Header is wrapped in paragraph</fo:block>
</fo:block>
</fo:table-cell>
What is the expected layout behavior in this case?
Here is my attempt at using Acrobat's measuring "tool" to document the results:
