Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align attribute seems ignored in HTML and PDF rendering of artwork align="center" #834

Open
alicerusso opened this issue Jul 18, 2022 · 3 comments
Assignees
Labels
accepted bug Something isn't working html Issues in HTML output pdf Issues in PDF output

Comments

@alicerusso
Copy link

In RFC 9251 (e.g., Section 9.1), XML contains artwork align="center" but the output has it left-aligned in PDF and HTML. (It's as expected in the text output.) See the first and second artworks in S9.1:
https://www.rfc-editor.org/rfc/rfc9251.html#section-9.1
https://www.rfc-editor.org/rfc/rfc9251.pdf#section-9.1
https://www.rfc-editor.org/rfc/rfc9251.txt

In the prepped XML file (https://www.rfc-editor.org/rfc/rfc9251.xml), they are:

<artwork name="" type="" align="center" alt="" pn="section-9.1-2">   
<artwork name="" type="" align="center" alt="" pn="section-9.1-4">

Guessing that it's supposed to yield the same alignment in all 3 outputs. (Here's the documentation for ''align''.)

Another example: see artwork in Section 3.3.4 of RFC 9260:
https://www.rfc-editor.org/rfc/rfc9260.html#section-3.3.4-7.16.3 (left aligned)
vs. https://www.rfc-editor.org/rfc/rfc9260.txt (centered, as expected)
(This issue occurs with other artwork elements within that document, but it's more obvious when the artwork is narrow.)

Perhaps this issue only occurs when <artwork> is not within <figure> bc there are examples where the 3 outputs match (when XML contains artwork align="center"), e.g., Figure 1 in https://www.rfc-editor.org/rfc/rfc9174.html, Figure 1 in https://www.rfc-editor.org/rfc/rfc9125.html, Figure 1 in https://www.rfc-editor.org/rfc/rfc9182.html.

@kesara kesara added bug Something isn't working accepted html Issues in HTML output pdf Issues in PDF output labels Jul 18, 2022
@kesara
Copy link
Member

kesara commented Jul 18, 2022

This is caused by #788 and this occurs regardless of <figure> is present as a parent element.
Removal of display: table; from .alignCenter > *:first-child in CSS is causing this issue.

@kesara kesara self-assigned this Jul 18, 2022
@kesara
Copy link
Member

kesara commented Jul 19, 2022

Looks like new Weasyprint versions will play nicely with display: table.
I will revert this CSS style back to display: table when Weasyprint update (#802) is complete.
Reverting back should fix both this issue and #787.

@martinthomson
Copy link
Contributor

It is possible that the right answer here is to use flexbox layout for figures, which would allow for better placement. No idea if weasyprint is able to handle that though.

@kesara kesara assigned kesara and unassigned kesara Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working html Issues in HTML output pdf Issues in PDF output
Projects
None yet
Development

No branches or pull requests

3 participants