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

Increased space between text lines #717

Closed
RafaelLinux opened this Issue Oct 23, 2018 · 11 comments

Comments

Projects
None yet
3 participants
@RafaelLinux

RafaelLinux commented Oct 23, 2018

I discovered an estrange behavior after change all size measurement to "rem" units. All is working as it should on screen and when I print from Firefox/Chromium, the space between each line is correct. However, WeasyPrint increase at least twice the space between lines. It seems to be the line-height of lines inside <details> HTML5 marker, but I'm not sure.

Update: I have had a problem editing, but with Firefox, that doesn't let me attach files or even "edit" the post after published. Now, with Chromium, attach the captured image and the example html/css files
weasyprint issue.zip

weasyprint - interline space duplicated

@Tontyna

This comment has been minimized.

Contributor

Tontyna commented Oct 23, 2018

It's neither rem nor line-height -- it's WeasyPrint having issues with <details>.

omg-details

Corresponding HTML:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>issue with details</title>  

<style type="text/css">
p {
  border: 1px solid black; padding:0
}
 
details, div.details {
  border: 1px solid blue; 
  padding: .5em;
  margin: 1em;
  background-color: #eee;
}
</style>
</head>
<body>
<details open="true">
  Strange things happen in &lt;details&gt; 
  <p>just a (default) paragraph</p>
  <p>just a (default) paragraph</p>
  ... really weird things
</details>

<details style="display:block" open="true">
  ... unless you declare <code>details{display:block}</code>
  <p>just a (default) paragraph</p>
  <p>just a (default) paragraph</p>
</details>

</body>
</html>
@Tontyna

This comment has been minimized.

Contributor

Tontyna commented Oct 23, 2018

@liZe quick fix via the default stylesheets? Shall I / willl you?

I know it's more complicate (wish they'd never invented HTML 5)

@RafaelLinux

This comment has been minimized.

RafaelLinux commented Oct 24, 2018

I'm sorry, I forgot to ask about other thing that in this case I can not get to work. Maybe I'm coding something wrong in CSS, but I don't see any wrong in my coding, so as a last chance I ask you. I have a first page and last page declared. Both have no text in headers, footers on any text in no margin. Declaration in CSS (attached before) is exactly the same for first and last page, but despite first page is not showing nothing around margin, the last page is showing the root page declared CSS. I even try to declare using @page:first, @page:last { ............} but this didn't work neither.

Please, what am I doing something incorrectly?

Thank you

@Tontyna

This comment has been minimized.

Contributor

Tontyna commented Oct 24, 2018

I, too, wish users would read WeasyPrint's output on stdout:

....
Step 2 - Fetching and parsing CSS - [..]/maquetacion.css
....
Error: Expected ':' after declaration name, got {} block. at 417:3.
Unsupported @page selector ":last
	", the whole @page rule was ignored at 465:2.
@liZe

This comment has been minimized.

Member

liZe commented Oct 24, 2018

Declaration in CSS (attached before) is exactly the same for first and last page, but despite first page is not showing nothing around margin, the last page is showing the root page declared CSS. I even try to declare using @page:first, @page:last { ............} but this didn't work neither.

@page:last doesn't exist, that's why you get this error.

@liZe quick fix via the default stylesheets? Shall I / willl you?

I'll check this.

@RafaelLinux

This comment has been minimized.

RafaelLinux commented Oct 24, 2018

I'm sorry, my fault. I launch Weasyprint from PHP page, so at this stage, in rare cases I open console to see logs. My imagination made me guess an (interesting) page pseudoclass.
I'll take it into account next time before asking :(

Thank you!!

@liZe liZe closed this in 495af10 Oct 29, 2018

@liZe

This comment has been minimized.

Member

liZe commented Oct 29, 2018

@liZe quick fix via the default stylesheets? Shall I / willl you?

I know it's more complicate (wish they'd never invented HTML 5)

After losing myself for a while in HTML5 specs, I've just added a rule for details. I should try to find a quite recent CSS user agent stylesheet to upgrade WeasyPrint's one.

@liZe liZe added this to the 43 milestone Oct 29, 2018

@liZe liZe added the conformance label Oct 29, 2018

@RafaelLinux

This comment has been minimized.

RafaelLinux commented Oct 29, 2018

So, should I update to get correct result??

@Tontyna

This comment has been minimized.

Contributor

Tontyna commented Oct 29, 2018

You can either install the WeasyPrint master branch or add the following definition to your stylesheet's @media print section:

details { display: block; unicode-bidi: isolate; }
@RafaelLinux

This comment has been minimized.

RafaelLinux commented Oct 30, 2018

I don't understand how is working "unicode-bidi" in this case, but the fact is that IS WORKING!!!
Thank you

@liZe

This comment has been minimized.

Member

liZe commented Oct 30, 2018

unicode-bidi: isolate;

The relevant part is just display: block. unicode-bidi is just a property that often has to be set in block-mode boxes to handle bidirectional text (that's not really supported by WeasyPrint by the way).

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 14, 2018

py-weasyprint: Update to 43.
Version 43
----------

Released on 2018-11-09.

Bug fixes:

* `#726 <https://github.com/Kozea/WeasyPrint/issues/726>`_:
  Make empty strings clear previous values of named strings
* `#729 <https://github.com/Kozea/WeasyPrint/issues/729>`_:
  Include tools in packaging

This version also includes the changes from unstable rc1 and rc2 versions
listed below.

Version 43rc2
-------------

Released on 2018-11-02.

**This version is experimental, don't use it in production. If you find bugs,
please report them!**

Bug fixes:

* `#706 <https://github.com/Kozea/WeasyPrint/issues/706>`_:
  Fix text-indent at the beginning of a page
* `#687 <https://github.com/Kozea/WeasyPrint/issues/687>`_:
  Allow query strings in file:// URIs
* `#720 <https://github.com/Kozea/WeasyPrint/issues/720>`_:
  Optimize minimum size calculation of long inline elements
* `#717 <https://github.com/Kozea/WeasyPrint/issues/717>`_:
  Display <details> tags as blocks
* `#691 <https://github.com/Kozea/WeasyPrint/issues/691>`_:
  Don't recalculate max content widths when distributing extra space for tables
* `#722 <https://github.com/Kozea/WeasyPrint/issues/722>`_:
  Fix bookmarks and strings set on images
* `#723 <https://github.com/Kozea/WeasyPrint/issues/723>`_:
  Warn users when string() is not used in page margin


Version 43rc1
-------------

Released on 2018-10-15.

**This version is experimental, don't use it in production. If you find bugs,
please report them!**

Dependencies:

* Python 3.4+ is now needed, Python 2.x is not supported anymore
* Cairo 1.15.4+ is now needed, but 1.10+ should work with missing features
  (such as links, outlines and metadata)
* Pdfrw is not needed anymore

New features:

* `Beautiful website <https://weasyprint.org>`_
* `#579 <https://github.com/Kozea/WeasyPrint/issues/579>`_:
  Initial support of flexbox
* `#592 <https://github.com/Kozea/WeasyPrint/pull/592>`_:
  Support @font-face on Windows
* `#306 <https://github.com/Kozea/WeasyPrint/issues/306>`_:
  Add a timeout parameter to the URL fetcher functions
* `#594 <https://github.com/Kozea/WeasyPrint/pull/594>`_:
  Split tests using modern pytest features
* `#599 <https://github.com/Kozea/WeasyPrint/pull/599>`_:
  Make tests pass on Windows
* `#604 <https://github.com/Kozea/WeasyPrint/pull/604>`_:
  Handle target counters and target texts
* `#631 <https://github.com/Kozea/WeasyPrint/pull/631>`_:
  Enable counter-increment and counter-reset in page context
* `#622 <https://github.com/Kozea/WeasyPrint/issues/622>`_:
  Allow pathlib.Path objects for HTML, CSS and Attachment classes
* `#674 <https://github.com/Kozea/WeasyPrint/issues/674>`_:
  Add extensive installation instructions for Windows

Bug fixes:

* `#558 <https://github.com/Kozea/WeasyPrint/issues/558>`_:
  Fix attachments
* `#565 <https://github.com/Kozea/WeasyPrint/issues/565>`_,
  `#596 <https://github.com/Kozea/WeasyPrint/issues/596>`_,
  `#539 <https://github.com/Kozea/WeasyPrint/issues/539>`_:
  Fix many PDF rendering, printing and compatibility problems
* `#614 <https://github.com/Kozea/WeasyPrint/issues/614>`_:
  Avoid crashes and endless loops caused by a Pango bug
* `#662 <https://github.com/Kozea/WeasyPrint/pull/662>`_:
  Fix warnings and errors when generating documentation
* `#666 <https://github.com/Kozea/WeasyPrint/issues/666>`_,
  `#685 <https://github.com/Kozea/WeasyPrint/issues/685>`_:
  Fix many table layout rendering problems
* `#680 <https://github.com/Kozea/WeasyPrint/pull/680>`_:
  Don't crash when there's no font available
* `#662 <https://github.com/Kozea/WeasyPrint/pull/662>`_:
  Fix support of some align values in tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment