1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00
Commit Graph

2665 Commits

Author SHA1 Message Date
Guillaume Ayoub
d4561b13af Sort anchors
Name trees, used to store PDF destinations (HTML anchors) have to be sorted
according to section 7.9.6 of the PDF 1.7 specification.

Fix #1352.
2021-05-12 18:24:04 +02:00
Guillaume Ayoub
815c01f735 Add a warning when a font size can’t be optimized 2021-05-10 12:05:08 +02:00
Guillaume Ayoub
8acedd3e1b Don’t duplicate embedded fonts when they have the same face 2021-05-09 20:42:53 +02:00
Guillaume Ayoub
9d7bf5ccd7 Remove useless variable 2021-05-09 19:56:13 +02:00
Guillaume Ayoub
f32cc56e25 Minor performance tweaks 2021-05-09 19:44:56 +02:00
Guillaume Ayoub
6d91c7ad29 Use __missing__ instead of __getitem__ for style 2021-05-08 09:03:45 +02:00
Guillaume Ayoub
2976292f5c Make Style inherit from dict 2021-05-08 00:48:58 +02:00
Guillaume Ayoub
86796ed044 Use style class instead of computer dictionary 2021-05-07 22:39:57 +02:00
Guillaume Ayoub
b17b08dae7 Don’t crash with ex units in spacing properties 2021-05-07 16:38:51 +02:00
Guillaume Ayoub
bec7c37dc9 Minor cleanups for lazy style 2021-05-07 15:48:44 +02:00
Guillaume Ayoub
8504cfd65c Calculate CSS properties on demand
Instead of calculating all the CSS properties for each element, we only get
them on demand. It saves A LOT of time and memory.

This implementation is just a quick and dirty hack that make tests pass. Even
with this suboptimal code, we get really good results.

Work in progress, has to be improved and cleaned.
2021-05-06 19:32:17 +02:00
Guillaume Ayoub
2d19becf19 Improve SVG support 2021-04-30 18:13:08 +02:00
Guillaume Ayoub
4f35e063d6 Add TODO for inline svg tags 2021-04-29 22:38:35 +02:00
Guillaume Ayoub
3818df4b96 Use a "more elegant way" to handle stroke-dasharray="none"
Related to #1346.
2021-04-29 17:54:04 +02:00
Guillaume Ayoub
264246959b
Merge pull request #1346 from pbregener/svg-stroke-dasharray-none
SVG: Allow stroke-dasharray:none
2021-04-29 17:45:26 +02:00
Guillaume Ayoub
9f38063379 Use page coordinates when no bounding box is found for opacity 2021-04-29 16:52:00 +02:00
pbregener
06ef510ddf
SVG: Allow stroke-dasharray:none
Fixes a crash when a SVG contains
`style="stroke-dasharray:none"`
2021-04-29 11:42:46 +02:00
Guillaume Ayoub
26cc19ce16 Fix double x/y transform for use tags
Fix #1345.
2021-04-28 21:57:15 +02:00
Guillaume Ayoub
e126beb5fa Comment and fix default stylesheets 2021-04-28 21:56:16 +02:00
Guillaume Ayoub
b476f2f606 Re-add deprecated CLI options
Related to #1232.
2021-04-28 15:15:35 +02:00
Guillaume Ayoub
becd494f91 Add an option to optimize fonts
Fix #359.
2021-04-28 14:55:52 +02:00
Guillaume Ayoub
71c49b58d1 Don’t crash when UA stylesheets can’t be read
That’s the case when flit builds packages and tries to get the package version.
2021-04-27 22:51:11 +02:00
Guillaume Ayoub
c76e1a3ba6 Use pkgutil instead of manual ROOT to load data
It avoids useless code and should work with all the packagers.
2021-04-27 22:11:27 +02:00
Guillaume Ayoub
6069fcd61a Remove unused code 2021-04-26 18:03:59 +02:00
Guillaume Ayoub
51c673b343 Use almost the same code for gradients and patterns 2021-04-26 17:59:20 +02:00
Guillaume Ayoub
3ec32732aa Fix gradients and tests 2021-04-26 17:36:18 +02:00
Guillaume Ayoub
f804d59cf3 Fix font flags
Related to #630.
2021-04-26 15:06:35 +02:00
Guillaume Ayoub
3de9ff408d Fix lint 2021-04-26 11:31:07 +02:00
Guillaume Ayoub
e983d88284 Version 53.0b1 2021-04-22 12:56:13 +02:00
Guillaume Ayoub
eae3540c55 Merge branch 'pydyfsvg' 2021-04-22 12:29:04 +02:00
Guillaume Ayoub
79bb88932c Fix text rotation 2021-04-20 17:21:40 +02:00
Guillaume Ayoub
66f9720f9b Allow strokes for text 2021-04-20 17:15:17 +02:00
Guillaume Ayoub
a4a5342bfb Fix tspan 2021-04-20 17:05:05 +02:00
Guillaume Ayoub
b44bf650bd Forget shapes that are not drawn 2021-04-20 16:53:21 +02:00
Guillaume Ayoub
82047b08e1 Fix text position 2021-04-20 16:44:31 +02:00
Guillaume Ayoub
dc861c785a Add more tests for SVG images 2021-04-19 17:52:25 +02:00
Guillaume Ayoub
6bf74c7de2 Remove unneeded line breaks 2021-04-18 19:11:44 +02:00
Guillaume Ayoub
7e164db984 Use colorsys instead of home-made color conversion 2021-04-18 19:11:23 +02:00
Guillaume Ayoub
0c0367b2f2 Use "stream" instead of "context" when possible
We already have stacking contexts and layout contexts, there’s no need to use
"context" for "streams-with-context" too.
2021-04-18 18:50:11 +02:00
Guillaume Ayoub
4c56bb0851 Fix text position 2021-04-18 18:10:40 +02:00
Guillaume Ayoub
e00e027c9c Fix SVG arcs 2021-04-18 18:01:56 +02:00
Guillaume Ayoub
3fc7273756 Test SVG bounding boxes 2021-04-18 17:20:07 +02:00
Guillaume Ayoub
541ed24472 Test SVG images 2021-04-18 16:01:26 +02:00
Guillaume Ayoub
0935813e75 Don’t handle text on a path 2021-04-17 18:30:18 +02:00
Guillaume Ayoub
6391139040 Add tests for text 2021-04-17 18:15:26 +02:00
Guillaume Ayoub
496ca5b14d Update packaging information 2021-04-17 17:37:19 +02:00
Guillaume Ayoub
399413571e Draw crop and cross marks 2021-04-17 14:41:03 +02:00
Guillaume Ayoub
d503bab165 Handle alpha in fill and stroke colors 2021-04-17 12:30:40 +02:00
Guillaume Ayoub
54fa4f95f5 Fix bug in matrix transformation 2021-04-17 12:29:48 +02:00
Guillaume Ayoub
604ed6e99e Try to handle gradientTransform 2021-04-16 15:33:04 +02:00
Guillaume Ayoub
84f945d396 Fix userSpaceOnUse for gradients 2021-04-16 11:21:46 +02:00
Guillaume Ayoub
ed1869f14e Avoid negative radius for radial gradients 2021-04-15 17:52:18 +02:00
Guillaume Ayoub
31cb0d76f3 Fix pattern drawing 2021-04-14 21:31:08 +02:00
Guillaume Ayoub
66d2b4da3c First SVG text test 2021-04-14 16:56:30 +02:00
Guillaume Ayoub
744ad9dff4 Call begin_text and end_text when drawing text in SVG 2021-04-14 16:56:30 +02:00
Guillaume Ayoub
eb245c6e82 Replace directionality characters with zero-width space
As these characters were removed to avoid crashes when breaking lines, indices
returned were wrong and could cause crashes.

Replacing them with zero-width spaces adds a hack to the hack, but it keeps the
same indicies and should be harmless for rendering.

Of course, the real fix is to have real bidi support.

Fix #1336.
2021-04-14 14:35:38 +02:00
Guillaume Ayoub
2502e0430b Replace directionality characters with zero-width space
As these characters were removed to avoid crashes when breaking lines, indices
returned were wrong and could cause crashes.

Replacing them with zero-width spaces adds a hack to the hack, but it keeps the
same indicies and should be harmless for rendering.

Of course, the real fix is to have real bidi support.

Fix #1336.
2021-04-14 14:34:21 +02:00
Guillaume Ayoub
36c076091a Document and clean svg.utils 2021-04-12 17:19:46 +02:00
Guillaume Ayoub
087eae6ee0 Fix @import rules 2021-04-12 17:15:10 +02:00
Guillaume Ayoub
d29d22795a Document and clean svg.text 2021-04-12 16:56:37 +02:00
Guillaume Ayoub
4fdde2188d Comment and fix svg.shapes 2021-04-12 16:38:36 +02:00
Guillaume Ayoub
0756a0f424 Document and fix svg.path 2021-04-12 16:35:52 +02:00
Guillaume Ayoub
a425d1aa88 Document svg.image 2021-04-12 16:29:26 +02:00
Guillaume Ayoub
da2625f5a6 Document and comment svg.defs 2021-04-12 16:27:55 +02:00
Guillaume Ayoub
3aa34e2e0b Document and comment svg.css 2021-04-12 15:49:06 +02:00
Guillaume Ayoub
ef9668ebf9 Use tinycss2.colors3 when possible 2021-04-12 15:21:43 +02:00
Guillaume Ayoub
75a422a70d Clean and comment bounding box 2021-04-12 15:12:02 +02:00
Guillaume Ayoub
847ccc0a94 Comment draw_node 2021-04-12 14:32:57 +02:00
Guillaume Ayoub
bd2bc5cc7d Fix text position 2021-04-12 14:30:30 +02:00
Guillaume Ayoub
a9144e582e Clean and document svg.__init__ 2021-04-12 14:25:55 +02:00
Guillaume Ayoub
c775ca6f46 Add bounding boxes for texts 2021-04-12 13:32:40 +02:00
Guillaume Ayoub
dd901bd8f6 Remove unused file 2021-04-11 16:15:36 +02:00
Guillaume Ayoub
0d8fb23145 Clean SVG support 2021-04-11 16:13:59 +02:00
Guillaume Ayoub
3a41d4e8a1 Initial support of text 2021-04-10 22:15:43 +02:00
Guillaume Ayoub
f52156ab0a Fix x/y offsets with objectBoundingBox gradients 2021-04-05 15:45:20 +02:00
Guillaume Ayoub
8cbd0b0639 Handle masks, multiple fixes for gradients 2021-04-05 12:11:36 +02:00
Guillaume Ayoub
889e310bc1 Handle filters 2021-04-04 12:40:04 +02:00
Lucie Anglade
81f106b941 Use braces for PAGE_SIZES dict 2021-04-04 11:37:09 +02:00
Christoph Päper
488829658b
add ISO and JIS paper sizes
- some were missing from the ones already required by [css-page](https://drafts.csswg.org/css-page-3/#typedef-page-size-page-size)
- the rest has been proposed for addition in https://github.com/w3c/csswg-drafts/issues/4722
- complete ISO 216 A, B and C series
- JIS P 0202 B series
2021-04-02 20:18:44 +02:00
Guillaume Ayoub
22b1a5ea1f Fix ratio preservation 2021-04-02 18:34:40 +02:00
Guillaume Ayoub
0eeb52160e Follow PEP 621
The future is now.
2021-04-02 16:24:01 +02:00
Guillaume Ayoub
a5f5fe6fb8 Remove documentation strings about PNG export. 2021-04-02 16:23:28 +02:00
Guillaume Ayoub
d572de33b9 Handle opacity attribute 2021-03-31 15:28:17 +02:00
Guillaume Ayoub
5fb675e362 Fix svg tag size 2021-03-31 15:20:57 +02:00
Guillaume Ayoub
e6bd2b3084 Handle inline SVG
Related to #75.
2021-03-25 16:50:01 +01:00
Guillaume Ayoub
8fb5f86087 Draw patterns 2021-03-24 14:10:50 +01:00
Guillaume Ayoub
ed5a5f9a93 Render images 2021-03-23 16:22:41 +01:00
Guillaume Ayoub
2474f99ca9 Handle CSS for SVG 2021-03-23 15:06:33 +01:00
Guillaume Ayoub
abd69a6503 Fix preserved ratio when no viewbox is specified 2021-03-23 14:54:21 +01:00
Guillaume Ayoub
882681a99c Preserve ratio for svg tags 2021-03-23 13:58:31 +01:00
Guillaume Ayoub
00e2557ee9 Handle radial gradients 2021-03-20 09:41:37 +01:00
Guillaume Ayoub
b7392374e2 Handle linear gradients 2021-03-19 15:58:22 +01:00
Guillaume Ayoub
5a66e68639 Use svg methods instead of size helper function 2021-03-17 21:30:35 +01:00
Guillaume Ayoub
58a6fce142 Don’t specifically set leader box width
The leader box width is already increased later, with all the children boxes of
the line.

Fix #1313.
2021-03-16 21:40:53 +01:00
Guillaume Ayoub
97ace0dd8c Initial broken support of use 2021-03-15 14:21:36 +01:00
Guillaume Ayoub
324f935e33 Handle markers 2021-03-14 09:29:33 +01:00
Guillaume Ayoub
8ed42be904 Merge branch 'master' into pydyfsvg 2021-03-13 14:00:23 +01:00
Guillaume Ayoub
212ccbab19 Update changelog and version 2021-03-13 13:55:09 +01:00
Guillaume Ayoub
1f5f19ee4c Merge branch 'master' into pydyfsvg 2021-03-13 13:43:31 +01:00
Guillaume Ayoub
d9eb1b0b91 Merge branch 'master' of github.com:Kozea/WeasyPrint 2021-03-13 13:43:12 +01:00