1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 08:27:22 +03:00
WeasyPrint/weasyprint
Guillaume Ayoub fac5ee94e5 Don't split a line when drawing it
To draw a text line, the previous behaviour didn't rely only on the text
actually set on the layout, but also relied on the fact that the line
was cut again when drawn. This change removes the line cutting when
drawing, and thus only relies on the line splitting done during the
layout. This fixes a bug causing some words not being displayed at the
end of a text line drawn with hinting, and the actual drawing size with
hinting was bigger than the size calculated during the layout.

The text included in the drawn layout object was sometimes not cut at
the right position, it was longer but cut when actually drawn. This
commit also fixes this, by always setting the right text in the layout
object.

Fixing this bug enables us to remove a hack introduced to fight against
an "accumulation of floating point errors". I now think that "it wasn't
our war"™. I think that the real reasons of this hack were probably:

- a problem with trailing spaces in the shrink-to-fit functions fixed in
  commit 3a620db, and
- this line-cutting bug while drawing, fixed now.

I've tried hard to reproduce the shink-to-fit problem without this hack,
with no success. I don't see anymore how it can theorically happen with
the current code of the "preferred" module. The only bug fixed by this
hack that I've been able to reproduce is the hinting problem explained
in the first paragraph, and this bug is now really fixed.

Moreover, this hack used to cause another problem: as the maximum size
allowed to an inline block was actually bigger than the real size
available in the line, an inline block whose size was between the real
and the allowed sizes was put on a new line by the split_inline_box
function. This commit fixes #288, the bug reported about this problem.
2016-01-01 16:48:15 +01:00
..
css Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
formatting_structure Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
layout Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
tests Fix attachments support for command line 2015-12-31 13:22:30 +01:00
__init__.py Version 0.25 2015-12-17 12:01:34 +01:00
__main__.py Fix attachments support for command line 2015-12-31 13:22:30 +01:00
compat.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
document.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
draw.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
html.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
images.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
logger.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
navigator.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
pdf.py Fix pdf_escape for python 2 again 2015-12-16 18:45:41 +01:00
stacking.py Replace utf8 with utf-8 for gettext compatibility 2015-11-25 09:38:01 +02:00
text.py Don't split a line when drawing it 2016-01-01 16:48:15 +01:00
urls.py Fix typo 2015-12-16 13:50:04 +01:00