Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Underline block element with different font sizes without an interrupted line

I am trying to underline an block element that contains text. The block has an font-size attribute and the text within the block is surrounded by an inline element which has a different font-size attribute.

Is there any way to ensure, that the line resulting from the text-decoration="underline" of the outer block is a straight line over all the block element (without any 'gaps' - please see the attached picture) that is not changing its position with the font-size ?

My code:

<fo:block font-size="14pt" text-decoration="underline">
    Some text
    <fo:inline font-size="10pt"> text with a smaller font size </fo:inline>
    Another text
</fo:block>

My result:

Problem with undelined block with different font sizes

Thanks in advance!

like image 462
M.E. Avatar asked Jul 02 '13 11:07

M.E.


People also ask

How do you underline text in XSLT?

Underlining can be added to inline text using the XSL-FO property text-decoration="underline" . Likewise, text with a horizontal line through it can be generated using text-decoration="line-through" .

How do I change the underline position in CSS?

In the horizontal text we use text-underline-position: under; to put the underline below all the descenders. In the text with a vertical writing-mode set, we can then use values of left or right to make the underline appear on the left or right of the text as required.


1 Answers

I have two versions of XSL-FO engine from one supplier, and the most up-to-date version renders a common underline without gaps, while the older version renders what you see with FOP. So it seems to be implementation dependent.

But you can mimic the appearance of what you want by selectively using the border rather than relying on the implementation:

  <block font-size="14pt">
    <inline border-after-width="1pt" border-after-style="solid">
Some text
<inline font-size="10pt"> text with a smaller font size </inline>
Another text
    </inline>
   </block>

Whether this mimic works in FOP or not, I don't know as I don't use FOP.

like image 117
G. Ken Holman Avatar answered Oct 28 '22 17:10

G. Ken Holman