You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please explain your intent
It would be greate to have support for striketrough text on write_html function. Currently it already works for bold, italic and underline.
Describe the solution you'd like
When using write_html() function it is already possible to use tag_styles argument to map the tag <s> to a TextStyle or FontFace, but unfortunately there is no way to set the emphasis to striketrough. Maybe adding a new Text Emphasis for striketrough ("S") would be enough. However I am not sure how to actually render this on the PDF itself.
Additional context
With the following snippet it's possible to see that <b> tag works just fine but when I try with <s> tag it does not work:
fromfpdfimportFPDFpdf=FPDF()
pdf.write_html(
text="<b>Bold Text works </b> <s> but strikethrough does not </s>.",
)
pdf.output("issue_1322.pdf")
The text was updated successfully, but these errors were encountered:
First, we could either implement this in HTML2FPDF, or else in the base FPDF class, similarly to how "underlined text" is implemented.
If we chose the second option, "strikethrough" should be part of the GraphicsState.
But another question arise: should it be included in TextEmphasis, that currently combines bold, italics & underline text styling?
IMHO, yes, we should implement strikethrough in exactly the same way that underline is currently implemented.
But it would be very interesting to have other people view on this 🙂
Ping other maintainers @andersonhc & @gmischler
I agree it would be a nice addition and we should implement strikethrough like underline.
We load underline thickness and position from the font's "post" table - with hardcoded values for the core fonts.
I believe the equivalent for strikethrough would be yStrikeoutPosition and yStrikeoutSize on the OS/2 table.
Please explain your intent
It would be greate to have support for striketrough text on
write_html
function. Currently it already works for bold, italic and underline.Describe the solution you'd like
When using
write_html()
function it is already possible to usetag_styles
argument to map the tag<s>
to aTextStyle
orFontFace
, but unfortunately there is no way to set the emphasis to striketrough. Maybe adding a new Text Emphasis for striketrough ("S") would be enough. However I am not sure how to actually render this on the PDF itself.Additional context
With the following snippet it's possible to see that
<b>
tag works just fine but when I try with<s>
tag it does not work:The text was updated successfully, but these errors were encountered: