1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 16:07:57 +03:00
Commit Graph

4546 Commits

Author SHA1 Message Date
Guillaume Ayoub
82e15f6ce1 Don’t launch PyPy tests on macOS 2022-02-13 23:11:28 +01:00
Guillaume Ayoub
a28447dbb0 Try to launch tests with PyPy 3.8 2022-02-13 22:44:19 +01:00
Guillaume Ayoub
86e0362e0e Fix PyPy version 2022-02-13 22:31:31 +01:00
Guillaume Ayoub
d69f7d0a7e Launch tests with supported version of PyPy 2022-02-13 16:44:44 +01:00
Guillaume Ayoub
7399ddbae7 Drop Python 3.6 support 2022-02-13 16:34:34 +01:00
Guillaume Ayoub
0214311c33
Merge pull request #1566 from aschmitz/fix-1564
fix: don't output footnotes before their call sites
2022-02-13 13:18:43 +01:00
Lucie Anglade
19f1283139
Merge pull request #1569 from xjlin0/pango_doc
update pango webpage
2022-02-12 16:31:20 +01:00
Jack Lin
6e0455a97f update pango webpage 2022-02-12 07:27:54 -08:00
aschmitz
f953fb8de0 fix: don't output footnotes before their call sites
If a footnote has been output but we then decide to cancel the line it
was output on, we should cancel the output of the footnote itself.

This requires a bit of extra bookkeeping, so we know which footnotes are
relevant, but otherwise largely works using the existing
remove_placeholders code.

Includes a minor refactor of footnote area management in LayoutContext,
and a new testing utility: `tree_position`.

Closes #1564.
2022-02-10 01:02:21 -06:00
Guillaume Ayoub
9003fd0490 Use utf-8 instead of utf8 2022-02-08 22:41:03 +01:00
Guillaume Ayoub
c3c5f08e91 Merge branch '54.x' 2022-02-08 12:19:41 +01:00
Guillaume Ayoub
562a2499a1 Fix line break when breaks occur between a nbsp and an inline block
This commit:

- fixes the trailing space detection, by handling all trailing spacing
  characters that could be ignored by Pango’s line break algorithm;
- tries harder to break waiting children when a line break occurs in an
  inline block that can’t be separated from the previous one.

Fix #1562.
2022-02-08 12:16:10 +01:00
Guillaume Ayoub
98ce588b1a Use the same workaround everywhere for floating numbers 2022-02-07 15:59:25 +01:00
Guillaume Ayoub
2ad7143bff
Merge pull request #1559 from aschmitz/box-break-page-slippage
fix: handle float rounding when extending boxes over page breaks
2022-02-07 15:52:29 +01:00
Guillaume Ayoub
9ffc124ab8 Merge branch '54.x' 2022-02-06 20:48:12 +01:00
Guillaume Ayoub
e4a35cbf88 Always set the child index
Fix #1560.
2022-02-06 20:46:09 +01:00
Guillaume Ayoub
d60433a1da Don’t duplicate the definition of SVG attributes
We want to get this list set only once, because we don’t want to change it
twice each time we add or remove an attribute.

This change probably means that extra work is now done, for style and for
definitions. This should definitely be optimized, but at least it shouldn’t be
wrong.

Tests definitely have to be added for SVG rendering.

Fix #1558.
2022-02-06 20:35:39 +01:00
aschmitz
7f8545c560 fix: handle float rounding when extending boxes over page breaks
When a box would break over the edge of a page, its height is extended
to the bottom of that page (per
https://www.w3.org/TR/css-break-3/#box-splitting , primarily to allow
backgrounds and borders to continue to the end of the page).

When this happened, sometimes the values that would be calculated for
the height of the extended element would be rounded *over* the
calculated height that remained on the page, forcing the entire
containing box to wrap to the next page.

Rather than trying to carefully manage the order of operations to try to
be safe in IEEE floats for directions, we apply a small "fudge factor":
if an element fits very nearly (within a thousandth of a pixel) into the
remaining space, it is still accepted.
2022-02-01 18:13:39 -06:00
Guillaume Ayoub
4ddcd95041 Merge branch '54.x' 2022-01-31 23:00:22 +01:00
Guillaume Ayoub
75f92c2ade Explicitly set white background for tests
With the release of Little CMS 2.13, Ghostscript sets a grey background when
generating raster images with no alpha channel. It’s probably a bug in
Ghostscript or in Little CMS, but the specification gives the possibility to
PDF renderers to choose the backdrop color (even if most of them use white).

Setting a white background for tests fixes this problem. We keep the
transparent background in the normal user agent for compatibility purpose, and
users will be able to set a white background if they need a "workaround".
2022-01-31 22:54:59 +01:00
Guillaume Ayoub
3a1242b5af Merge branch '54.x' 2022-01-31 19:48:10 +01:00
Guillaume Ayoub
7882ff1a25 Version 54.1 2022-01-31 19:47:15 +01:00
Guillaume Ayoub
7108a16f87 Add a test about text rotation
Related to #1554.
2022-01-30 14:30:57 +01:00
Guillaume Ayoub
970574663f
Merge pull request #1554 from ClearCalcs/svg_text_pdf_bug
Avoid invalid PDF operators when drawing SVG text
2022-01-30 14:29:56 +01:00
Rian McGuire
9a845cfdbb Avoid invalid PDF operators when drawing SVG text
According to the PDF specification, "special graphics state" operators (q, Q, cm) aren't permitted while a text object is being drawn.
2022-01-27 17:14:20 +11:00
Guillaume Ayoub
15f5b3ca62 Remove useless variable 2022-01-26 19:53:36 +01:00
Guillaume Ayoub
7c58bf880d Remove useless variables 2022-01-26 16:09:08 +01:00
Guillaume Ayoub
8d19ab4157 Merge branch '54.x' 2022-01-25 15:58:36 +01:00
Guillaume Ayoub
563ee6f98c Handle break-inside: avoid in tr
Fix #1547.
2022-01-25 15:57:58 +01:00
Guillaume Ayoub
8b0f147688 Handle more cases of margin-break use cases
This solution is not perfect, but at least it works for table cells (whose
top margins never collapse) and avoids the related workaround.

Related to #1547.
2022-01-25 15:20:10 +01:00
Guillaume Ayoub
4f434343ba Avoid infinite loops with td with break-inside: avoid
Related to #1547.
2022-01-25 12:35:59 +01:00
Guillaume Ayoub
476a8f593b Uncomment passing test 2022-01-24 21:32:33 +01:00
Guillaume Ayoub
4bf4c08200 Remove old comment 2022-01-24 21:25:30 +01:00
Guillaume Ayoub
f993dfbff5
Merge pull request #1548 from Kozea/fast-tests
Improve tests’ speed
2022-01-24 21:01:53 +01:00
Guillaume Ayoub
85d9c6fc07 Merge branch 'master' into fast-tests 2022-01-24 16:18:13 +01:00
Guillaume Ayoub
51f8a0dc52 Merge branch '54.x' 2022-01-24 16:14:25 +01:00
Guillaume Ayoub
0ae65b8297 Layout positioned boxes in page margins
Fix #1540.
2022-01-24 16:11:18 +01:00
Guillaume Ayoub
6bf127d1bc Merge branch 'master' into fast-tests 2022-01-24 11:43:31 +01:00
Guillaume Ayoub
21314bc726 Use math.inf instead of float('inf') 2022-01-24 11:35:43 +01:00
Guillaume Ayoub
b62d5a3f26 Use explicit attributes instead of hasattr function 2022-01-24 11:11:06 +01:00
Guillaume Ayoub
f8110d6841 Remove useless font tables
Related to #1457.
2022-01-23 20:29:28 +01:00
Guillaume Ayoub
e5a6ac856e Don’t go through counters rule descriptors twice 2022-01-23 19:04:26 +01:00
Guillaume Ayoub
43abe66f8a Don’t deepcopy counter styles
Counter styles keys are strings, and values are dicts. These dicts are only
created when new counters are created, but they are never modified, so there’s
no need to deepcopy them.

Tests are ~15% faster on my computer. We should get an interesting boost for
very small documents too.
2022-01-23 18:52:24 +01:00
Guillaume Ayoub
274c230497
Merge pull request #1541 from aschmitz/patch-1
fix: space out no-repeat patterns more
2022-01-17 10:14:51 +01:00
aschmitz
35386ab275
fix: space out no-repeat patterns more
This ensures the edges of a repeating pattern don't show up on the edge of the painting area in some PDF viewers. Closes #1539.
2022-01-16 20:10:25 -06:00
Guillaume Ayoub
6cce297816 Add word-break support into documentation 2022-01-16 10:09:34 +01:00
Guillaume Ayoub
27a001c082 Clean code for line break condition 2022-01-16 09:33:49 +01:00
Guillaume Ayoub
d06ad070d5
Merge pull request #1534 from aschmitz/wrap-improvements
Fix `overflow-wrap`, support `word-break: break-all`
2022-01-16 09:31:18 +01:00
Lucie Anglade
cd8a4637aa Related to #1540.
Regression test
2022-01-14 15:26:03 +01:00
Lucie Anglade
f8c9747962 Don’t crash when running elements aren’t ParentBoxes 2022-01-14 15:19:26 +01:00