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

160 Commits

Author SHA1 Message Date
Guillaume Ayoub
5ce71e48fe Merge branch 'master' of github.com:Kozea/WeasyPrint 2021-11-29 15:08:51 +01:00
Guillaume Ayoub
80b88db154 Don’t crash when the font size is really small
Fix #1499.
2021-11-29 15:08:18 +01:00
Guillaume Ayoub
677b083d78
Merge pull request #1505 from ColinKinloch/woff_cache
Reuse decompressed woff files based on hash
2021-11-29 12:24:43 +01:00
Colin Kinloch
82f98b16ab Correct comment on woff font test 2021-11-28 20:41:27 +00:00
Colin Kinloch
a273b08a59 Fix woff cache read and add woff cache test 2021-11-28 20:30:55 +00:00
Guillaume Ayoub
424f080311 Don’t draw empty glyphs at all
Fix #1508.
2021-11-28 19:47:37 +01:00
Colin Kinloch
4549913644 Add test to make sure woff fonts load and fix typo 2021-11-24 20:10:28 +00:00
Guillaume Ayoub
aafb119e29 Copy boxes when using them in stacking contexts
If we don’t copy the boxes, rendering pages twice will fail because creating
stacking contexts can change the boxes’ children.

Fix #1473.
2021-11-14 19:41:10 +01:00
Guillaume Ayoub
58c9dbc231 Add an option to return split images when testing PNGs 2021-11-14 19:41:04 +01:00
Guillaume Ayoub
837d64111b Use the BATCH mode of ghostscript
Without this mode, we get the "GS>" prompt at the end of the standard output.
2021-11-14 19:27:34 +01:00
Guillaume Ayoub
046f27bf98 Split blocks in blocks when possible
Related to #1476.
2021-11-14 13:25:04 +01:00
Guillaume Ayoub
f46e254107 Fix column height with column-span content
Fix #1094.
2021-11-10 21:20:30 +01:00
Guillaume Ayoub
ce44a72318 Fix images embedded from multiple pages
Fix #1486.
2021-11-05 21:59:09 +01:00
Guillaume Ayoub
d62974e0b4 Simplify reference creation for API test
This change also uses the same source file for reference and tests, allowing
identifiers to be related to URLs.

Related to #1486.
2021-11-05 21:33:47 +01:00
Guillaume Ayoub
bd753560b4 Remove float width from inline box available width 2021-10-29 16:06:13 +02:00
Guillaume Ayoub
511033471a Merge remote-tracking branch 'origin/53.x' 2021-10-29 16:04:02 +02:00
Lucie Anglade
abd54c4bd4 Set SVG ratio when width and height are 0 2021-10-28 11:21:37 +02:00
Guillaume Ayoub
482dc6bf1e Merge branch '53.x' 2021-10-13 22:16:07 +02:00
Guillaume Ayoub
0524421ec1 Only enable letter- and word-spacing when needed
Enabling letter-spacing with a value of 0 breaks ligatures, and probably other
typography features.

Fix #1469.
2021-10-13 22:11:58 +02:00
Guillaume Ayoub
833afb68df Remove original_text attribute
This "hack" was introduced to ignore the text-transform property for bookmarks.
Now that the whitespace management logic is done after the box creation (just
before building the bookmark label), we can do the same for the text
transformation (just after building the bookmark label).

Related to #607 and #137.
2021-10-13 21:26:49 +02:00
Guillaume Ayoub
e5beff677a Process whitespaces as soon as box children are set
This early process enables properties with <content-list> values (string-set,
bookmark-label, etc.) to be defined using whitespace-processed strings.

Fix #607.
2021-10-13 09:48:39 +02:00
Guillaume Ayoub
313fb3a7f0 Remove deprecated options 2021-09-22 18:51:49 +02:00
Guillaume Ayoub
df25719cdb Fix background size of pages with a bleed margin
Fix #1446.
2021-09-18 18:37:37 +02:00
Guillaume Ayoub
0cc24e5a18 Fix background size of pages with a bleed margin
Fix #1446.
2021-09-18 18:34:12 +02:00
Guillaume Ayoub
35fa9037fd Rename layout files to follow "display" values 2021-09-13 15:37:29 +02:00
Guillaume Ayoub
37af386852 Cache SVG use tags
Fix #1439.
2021-09-11 14:57:47 +02:00
Guillaume Ayoub
f2cf74d31a Merge branch '53.x' 2021-09-07 22:27:21 +02:00
Guillaume Ayoub
3fd70e10b4 Don’t crash when transparent images are used twice in CSS
Fix #1440.
2021-09-07 22:25:46 +02:00
Guillaume Ayoub
85e1ea1043 Don’t use "text-transform"ed text for content-based uses
This solution is far from perfect. What we could do is to have a getter/setter
for the "text" attribute of TextBox using the "original_text" attribute, so
that we’re sure that we change one when we change the other.

But… That would be much more complicated and much slower, only to solve corner
use cases.

Of course, an issue will be open soon, when someone finds one of these cases ;).

Fix #137.
2021-09-06 21:29:25 +02:00
Guillaume Ayoub
17cf6239b5 Fix the "contents" value of bookmark-label 2021-08-31 16:42:26 +02:00
Guillaume Ayoub
31cd0d7233 Fix the "contents" value of bookmark-label 2021-08-31 16:38:51 +02:00
Guillaume Ayoub
d3e39055cf Merge branch '53.x' 2021-08-27 14:48:59 +02:00
Guillaume Ayoub
c51bc60764 Re-add make_bookmark_tree method
Fix #1428.
2021-08-27 14:43:17 +02:00
Guillaume Ayoub
bb29eca337 Transform text-align into shorthand
text-align is now a shorthand, setting text-align-all and text-align-last.

Related to #1389.
2021-08-24 13:27:59 +02:00
Guillaume Ayoub
61ff7f0e1c Handle full "display" property
In CSS Display Module Level 3, the "display" property gets a long
representation allowing:

- a clear separation between inner and outer display type,
- new supported types (contents, run-in, flow-root…),
- inline list items.

This commit allows the (retrocompatible) new long syntax for "display". It also
supports the "flow-root" value. It doesn’t support values related to ruby, and
it doesn’t support the new "contents" and "run-in" display types.

This work gives the possibility to simplify the code in the block_*_layout
functions, and to improve the overall layout.

Related to #36.
2021-08-23 21:54:28 +02:00
Guillaume Ayoub
3aca9f1f84 Change the resume_at and skip_stack structure
Many operations, including page breaks, require a pointer to a specific
position of the box tree. For example, we used to have this structure to point
to the beginning of the first child of the second child:

(1, (2, None))

We now use:

{1: {2: None}}

This change is the first step to handle parallel flows (see #36). It doesn’t
change anything to the layout for now, but it allows us to store multiple
pointers in the same structure.

The next step is to handle multiple pointers in skip_stack during boxes layout.
It means that most of the *_layout() function need an extra for-loop to manage
multiple skip stacks.

We’ll then need to split new types of boxes: table cells, floats, absolutes…
2021-08-22 12:10:48 +02:00
Guillaume Ayoub
c191372e07 Test empty links and relative links with base 2021-08-06 20:04:57 +02:00
Guillaume Ayoub
35d20308e0 Test absolute tables and remove dead code
Table translation’s (dx, dy) can’t be (0, 0), because the table is in a table wrapper
that already takes care of (0, 0) values.
2021-08-06 19:32:49 +02:00
Guillaume Ayoub
f162d1b762 Fix and test line-clamp 2021-08-06 19:05:03 +02:00
Guillaume Ayoub
f16b4c32d5 Test media queries 2021-08-06 18:38:06 +02:00
Guillaume Ayoub
ebd1064984 Test deprecated -o option 2021-08-06 18:14:13 +02:00
Guillaume Ayoub
143565e08d Test object-fit and object-position 2021-08-06 11:19:47 +02:00
Guillaume Ayoub
ccbe420d35 Fix optimization test 2021-08-04 17:14:52 +02:00
Guillaume Ayoub
c5590dd86d Test CLI optimizations 2021-08-04 16:54:09 +02:00
Guillaume Ayoub
0a1b2e9c64 Remove useless helper 2021-08-04 10:48:50 +02:00
Guillaume Ayoub
2e96bdee35 Simplify API to get intrinsic size of images
The previous API wasn’t stateless, as it sometimes required to call
get_intrinsic_size before accessing intrinsic_ratio. The new API offers a
single method to get width, height and ratio.
2021-08-03 18:39:14 +02:00
Guillaume Ayoub
694eddbc71 Embed images once
Images were already embedded once when included in the same stream.
Unfortunately, patterns have their own streams, meaning that a pattern used
multiple times includes the image each time. That’s especially bad for
different boxes using the same background, as backgrounds are drawn as
patterns.

Fix #1414.
2021-08-03 18:39:02 +02:00
Guillaume Ayoub
f327a9e353 Don’t crash when leaders are in floats
Fix #1409.
2021-08-01 19:06:13 +02:00
Guillaume Ayoub
2a8e23d3c4 Fix tests failing beacause of Ghostscript roundings 2021-07-27 22:55:19 +02:00
Guillaume Ayoub
5a53e11608 Clean and fix some cases of SVG gradients 2021-07-25 18:30:32 +02:00