xml2rfc icon indicating copy to clipboard operation
xml2rfc copied to clipboard

Clipped descenders in PDF

Open cabo opened this issue 11 months ago • 2 comments

Describe the issue

For

https://www.ietf.org/archive/id/draft-ietf-core-dns-over-coap-11.html#figure-1

(using the XML in the I-D archive), I get in HTML:

Image

and in PDF form:

Image

In the PDF form, some descenders (apparently in the bottom lines in text boxes, and maybe not just the descenders) are clipped.

Code of Conduct

cabo avatar Feb 13 '25 12:02 cabo

Work around for this might be, removing text-anchor="middle" which will avoid the clipping issue in PDFs. But that needs SVG diagram to be adjusted manually.

kesara avatar Feb 13 '25 21:02 kesara

That shouldn't be the problem, as text-anchor only affects text placement horizontally, though I wouldn't rule out bugs.

More seriously, that change would reposition the text in ways that are hard to rectify.

The current design here relies on centering of text (hence text-anchor=middle). Changing the anchor isn't straightforward because we don't have a precise understanding of the font metrics. Setting a different anchor and maintaining the same positioning means knowing how big the text will be. Right now, it doesn't matter too much what the metrics are because of text-anchor=middle.

There is an option on aasvg to stretch text. which uses textLength and lengthAdjust attributes. Those are not permitted by RFC 7996, but might be allowed by an upcoming replacement for that document. That could allow for using a different anchoring by normalizing font metrics through stretching. It might end up looking wonky though.

martinthomson avatar Feb 14 '25 03:02 martinthomson

The RPC is also seeing this issue with a doc in AUTH48

ajeanmahoney avatar Feb 28 '25 14:02 ajeanmahoney

See the figures in https://www.rfc-editor.org/authors/rfc9678.pdf Please note that this RFC is otherwise ready for publication.

sginoza avatar Feb 28 '25 15:02 sginoza

Regarding 9678 pdfs over time, it appears:

OK - v1 was xml2rfc 3.23.2 and weasyprint 62.3
OK - v2 was xml2rfc 3.25.0 and weasyprint 62.3
OK - v3 was xml2rfc 3.25.0 and weasyprint 62.3
OK - v4 was xml2rfc 3.25.0 and weasyprint 62.3   
bad  v5 was xml2rfc 3.27.0 and weasyprint 61.2

I've copied rfc9678v*.pdf into https://www.rfc-editor.org/v3test/ (The version data is from the "Generator version information" in the corresponding HTML files, which were created at the same time.)

alicerusso avatar Feb 28 '25 18:02 alicerusso

fwiw, the weasyprint 62.3 above is odd bc the pinning to weasyprint 61.2 was apparently in Aug 2024 w/ release v3.23.0 which included PR #1147

alicerusso avatar Feb 28 '25 18:02 alicerusso

Regarding 9733 pdfs over time, it appears:

OK   rfc9733v1.pdf   xml2rfc 3.26.0 and weasyprint 62.3
bad  rfc9733v2.pdf   xml2rfc 3.27.0 and weasyprint 61.2 

alicerusso avatar Feb 28 '25 19:02 alicerusso

PR https://github.com/ietf-tools/xml2rfc/pull/1215 updates xml2rfc to WeasyPrint 64.1. This change is in the main branch, but has not been release yet. The plan is to make a release later today.

kesara avatar Feb 28 '25 20:02 kesara

This has been fixed with WeasyPrint 64.1 update. This pdf was generated from the current main branch.

kesara avatar Mar 01 '25 08:03 kesara