Search code examples
xsl-fo

How to force a series of inline objects to wrap with XEP RenderX XSLFO


The following image is an extract from a PDF I generated via RenderX XEP. This fragment contains a series of hyperlinked keywords with padding between them. As is evident, the line is not wrapping and because of that the text of each word is compressed:

compressed keywords

The code that generates this block is:

     <fo:block-container wrap-option="wrap" space-after="10pt">
        <fo:block space-after="5pt">
             <fo:inline font-weight="bold">Keywords</fo:inline>
        </fo:block>
        <fo:block wrap-option="wrap" start-indent="20pt">
             <fo:inline padding-right="10pt">
                 <fo:basic-link color="blue" external-destination="http://example.com">Boat</fo:basic-link>
              </fo:inline>
              <fo:inline padding-right="10pt">
                  <fo:basic-link color="blue" external-destination="http://example.com">Dragon</fo:basic-link>
              </fo:inline>
               [...]
         </block>
     </fo:block-container>

I cannot identify the property that will allow the fo:inline objects to wrap. I attempted keep-together="no" on fo:block and on fo:inline, but they are not allowed.

What am I missing to allow this series of inlines to wrap?

Many thanks in advance.


Solution

  • The padding doesn't count as a space, so the line-breaking algorithm has nothing to work with.

    You could use &#x200B; to insert a ZERO-WIDTH SPACE instead of &#32; for a regular space.

    You could instead use a 10pt space character:

    <fo:basic-link color="blue" external-destination="http://example.com">Boat</fo:basic-link>
    <fo:inline width="10pt"> </fo:inline>
    

    (Don't include the line break in your generated XSL-FO, otherwise there'll be a regular space and a 10pt space in your output.)