xsltxsl-foapache-fop

How can I strike text with custom thickness XSL:FO


I strike text with text-decoration="line-through", but I find out the thickness is not suitable.

<fo:inline text-decoration="line-through">
...
</fo:inline>

I tried to use but I can't find a way to overlay the text. Is there any way to adjust the thickness of the strike? Or a way to use fo:leader to do the same thing?


Solution

  • You should be able to just set the padding-bottom to negative 1/2 the font-height coupled with a bottom-border. Like this if say the font-size is 24pt.

            <fo:block>Testing line-through 
                <fo:inline text-decoration="line-through">
                    I have regular line-through
                </fo:inline>
            </fo:block>
            <fo:block space-before="48pt">Testing line-through 
                <fo:inline border-bottom="5px solid black" padding-bottom="-12pt">
                    I have custom line-through
                </fo:inline>
            </fo:block>
    

    This in RenderX results in:

    enter image description here

    Unfortunately nothing tried in FOP will work as it apparently does not respect any margin or padding settings on fo:inline.