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

2653 Commits

Author SHA1 Message Date
Guillaume Ayoub
c35a629032 Don’t try to get an earlier page break between columns.
Fix #1191.
2020-12-22 16:51:27 +01:00
Guillaume Ayoub
9647b19516
Merge pull request #1268 from naveen521kk/new-names
Add new dll names
2020-12-22 15:45:42 +01:00
Guillaume Ayoub
a83824d6e1 Set font dictionary before use_references recursion 2020-12-21 14:38:18 +01:00
Guillaume Ayoub
c7b00e82e4 Add pattern type 2020-12-21 14:37:59 +01:00
Guillaume Ayoub
5f1710b74c Use references for smasks in images 2020-12-20 13:57:36 +01:00
Guillaume Ayoub
e166a672f5 Use a font dictionary shareda across the whole document 2020-12-20 12:37:17 +01:00
Guillaume Ayoub
5e932d3fca Revert "Use the same Resources dictionary across the whole document"
This reverts commit af92f3eba6.
2020-12-19 20:06:16 +01:00
Guillaume Ayoub
e4bcb07d55 Use the font descriptor as a reference 2020-12-19 19:02:24 +01:00
Guillaume Ayoub
af92f3eba6 Use the same Resources dictionary across the whole document 2020-12-19 19:01:29 +01:00
Guillaume Ayoub
626177bd20 Include padding, border, padding when calculating inline-block width
Fix #1235.
2020-12-14 07:12:41 +01:00
Syrus Dark
8635f538d7
fix line length 2020-12-14 09:30:35 +05:30
Syrus Dark
44d78f208c
Add new dll names
When building Pango with meson I get the following dll files as output.
So adding it.
2020-12-14 09:13:25 +05:30
Guillaume Ayoub
a8e900110d Don’t render layouts with no size 2020-12-13 15:07:35 +01:00
Guillaume Ayoub
b2f7afd29d Revert "Don’t compress streams"
This reverts commit d0ca0da6bb.
2020-12-12 22:44:41 +01:00
Guillaume Ayoub
d0ca0da6bb Don’t compress streams 2020-12-12 22:34:43 +01:00
Guillaume Ayoub
30c21d92e9 Fully remove Cairo from documentation and code 2020-12-10 22:47:27 +01:00
Guillaume Ayoub
f10b3b56c8 Fix error raised when SVG images are rendered 2020-12-08 15:51:35 +01:00
Guillaume Ayoub
7fe4e74b2e Don’t round glyph positions to PDF points
Fix #1199.
2020-12-08 00:03:50 +01:00
Guillaume Ayoub
cfb9017e84 Remove CairoSVG
Fix #1263.
2020-12-07 12:27:18 +01:00
Guillaume Ayoub
4f82a4a34e Packaging!
Related to #1247, #1232.
2020-12-06 20:19:59 +01:00
Guillaume Ayoub
d6cbf25880 Merge branch '52.x' 2020-12-06 19:40:51 +01:00
Guillaume Ayoub
bf45c2eb9f Merge 52.2 2020-12-06 19:35:24 +01:00
Guillaume Ayoub
5ec1881c51 Version 52.2 2020-12-06 19:14:14 +01:00
Guillaume Ayoub
5c91212624 Really print a lot of things when tests fail 2020-12-06 14:09:22 +01:00
Guillaume Ayoub
b4e0619158 Print a lot of things when tests fail 2020-12-06 13:49:58 +01:00
Guillaume Ayoub
a677b3d3ae Print command result when test fails 2020-12-06 13:27:33 +01:00
Guillaume Ayoub
a2e02086d7 Assert at least one magic number in Ghostscript output 2020-12-06 13:12:13 +01:00
Guillaume Ayoub
a849f9e88b Try to clean tests 2020-12-06 12:47:20 +01:00
Guillaume Ayoub
b65c3649cb Fix Ghostscript’s stdout for Windows 2020-12-02 01:33:22 +01:00
Guillaume Ayoub
e5542c9539 Use better names for harfbuzz library discovery 2020-12-02 01:05:56 +01:00
Guillaume Ayoub
578a191f52 Don’t use capture_output, unsupported by Python 3.6 2020-12-01 12:49:19 +01:00
Guillaume Ayoub
5ed5b54d59 Handle transparent colors in gradients correctly
Gradients must be drawn using a pre-multiplied color space. It means that stop
colors are "weighted" by their alpha channel when we define how transition is
done between two colors.

To explain why this is needed, the best example is "transparent". The
"trasparent" color is set to rgba(0, 0, 0, 0), also known as transparent
black. When there’s a transition from red to transparent, we don’t want to have
a transition to black, as it would be if RGBA values were extrapolated. We want
to have a transition to transparent red.

This problem appears for each transition between colors whose RGB and A
channels are both different.

To fix this, we use the same plain color as the one from the previous stop for
transitions to transparent, and the same plain color as the one from the next
stop for transitions from transparent. For semi-transparent colors, we set a
weight proportional to the color alpha, meaning that opaque colors will take
more place than transparent ones.

This bug appears in Safari: https://bugs.webkit.org/show_bug.cgi?id=150940.
It obviously means that we’re better than Apple. Obviously.
2020-11-30 20:54:26 +01:00
Guillaume Ayoub
29a90fcf2b Merge branch 'pydyf' of github.com:Kozea/WeasyPrint into pydyf 2020-11-30 19:12:59 +01:00
Guillaume Ayoub
5f5f30d3e8 Support transparent gradients 2020-11-30 19:12:41 +01:00
Lucie Anglade
c72539f7ca Remove print 2020-11-29 20:14:37 +01:00
Guillaume Ayoub
f6456f9c0c Remove useless @requires from one test 2020-11-28 14:14:43 +01:00
Guillaume Ayoub
6b1a7970cb Correctly draw borders on the last line of split tables
The previous logic used to find if a row is in the footer was broken. Code is
now cleaner, shorter, with an example in comments and a non-regression test.

Fix #1250.
2020-11-25 14:19:32 +01:00
Guillaume Ayoub
f0231c8b15 Correctly draw borders on the last line of split tables
The previous logic used to find if a row is in the footer was broken. Code is
now cleaner, shorter, with an example in comments and a non-regression test.

Fix #1250.
2020-11-23 20:46:09 +01:00
Guillaume Ayoub
236d1dd309 Don’t render table cells as if they are on empty pages
The page_is_empty was probably set to True to force rendering, but using
max_position=inf should already allow all cells to be rendered.

When cells are rendered with page_is_empty set to True, the top margin of their
first children is removed, because margins are always removed at the top of
blocks split between multiple pages.

Fix #1254.
2020-11-21 19:24:48 +01:00
Guillaume Ayoub
6606927007 Fix URL handling with tinycss2
URLs used to be dedicated tokens in the CSS specification, but it’s now a
common function unless its value isn’t quoted.

tinycss2 1.1.0 includes this change, and WeasyPrint has to take care of these
two different tokens.
2020-11-21 19:24:43 +01:00
Guillaume Ayoub
2af9a49c09 Fix error messages in tests 2020-11-21 19:24:41 +01:00
Lucie Anglade
a6f9c80921 A nice gif to please gdk-pixbuf 2.42.0
See https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/162
2020-11-21 19:15:48 +01:00
Guillaume Ayoub
70229deef7 Don’t render table cells as if they are on empty pages
The page_is_empty was probably set to True to force rendering, but using
max_position=inf should already allow all cells to be rendered.

When cells are rendered with page_is_empty set to True, the top margin of their
first children is removed, because margins are always removed at the top of
blocks split between multiple pages.

Fix #1254.
2020-11-21 18:24:18 +01:00
Guillaume Ayoub
af37f05a95 Version 52.1 2020-11-02 21:40:16 +01:00
Guillaume Ayoub
238e214f9d Fix URL handling with tinycss2
URLs used to be dedicated tokens in the CSS specification, but it’s now a
common function unless its value isn’t quoted.

tinycss2 1.1.0 includes this change, and WeasyPrint has to take care of these
two different tokens.
2020-10-30 11:05:27 +01:00
Guillaume Ayoub
77dbcb79b8 Fix error messages in tests 2020-10-30 10:39:26 +01:00
Guillaume Ayoub
a3c3bb56af Version 52 2020-10-30 00:40:14 +01:00
Guillaume Ayoub
18010a152e Disable WOFF and WOFF2 font formats support
WOFF and WOFF2 formats are supported by FreeType, but for some reason Cairo
doesn’t include the fonts correctly.

WOFF(2) fonts already work on the branch where Cairo is not used anymore.

Fix #1237.
2020-10-27 21:12:56 +01:00
Guillaume Ayoub
0b3105037a Merge branch 'master' into pydyf 2020-10-27 18:36:32 +01:00
Guillaume Ayoub
1e3a0d28c4 Move an import at the top of the module
It was in a function, even if it wasn’t a circular import. As this function was
called a lot of times, it was actually really slow.
2020-10-27 18:23:50 +01:00
Guillaume Ayoub
d45ecd3465 Merge branch 'master' into pydyf 2020-10-26 23:46:27 +01:00
Guillaume Ayoub
92dca05ff7 Don’t create a layout to know if a line break is possible
We now have a faster function to do this, let’s use it!
2020-10-26 23:42:33 +01:00
Guillaume Ayoub
a0031a899c Fix can_break_text
The number of log attrs is the number of characters, not the number of
bytes. Using the number of bytes just returns garbage.
2020-10-26 23:41:24 +01:00
Guillaume Ayoub
5497991fb4 Don’t retry to split a line if it contains spaces
Splitting the line twice takes too much time, and we know (hope?) that we can
always split lines after a space.
2020-10-26 22:11:29 +01:00
Guillaume Ayoub
431c11e7a0 Put write_png in testing suite for license considerations 2020-10-26 17:26:01 +01:00
Guillaume Ayoub
94cf4bf5e0 Fix colors in repeating linear gradients 2020-10-25 20:18:13 +01:00
Guillaume Ayoub
a7c1f3dcbc Fix gradient tests 2020-10-25 20:18:05 +01:00
Guillaume Ayoub
8cd28aee31 Small fixes on linear gradients 2020-10-25 15:52:58 +01:00
Guillaume Ayoub
1ff768c103 Support linear gradients 2020-10-25 14:54:08 +01:00
Guillaume Ayoub
60df2d174e Handle repeating radial gradients 2020-10-25 13:41:23 +01:00
Guillaume Ayoub
02e6beb041 Fix gradient documentation and comments 2020-10-25 07:32:41 +01:00
Guillaume Ayoub
b434b563bf Remove unused imports 2020-10-24 21:43:05 +02:00
Guillaume Ayoub
b37feca543 Fix radial gradients and related tests 2020-10-24 21:35:17 +02:00
Guillaume Ayoub
7f2c64e5a6 Handle degenerate radial gradients 2020-10-24 20:49:42 +02:00
Guillaume Ayoub
18e567c95e Fix radial gradients 2020-10-24 20:46:38 +02:00
Guillaume Ayoub
2ed1f6f59d Allow some pixels to be ignored in tests 2020-10-24 20:46:16 +02:00
Guillaume Ayoub
04f40ae9b2 Fix various tests 2020-10-24 18:00:48 +02:00
Guillaume Ayoub
06b3c954c4 Fix CSS validation tests 2020-10-24 17:48:24 +02:00
Guillaume Ayoub
bd0a6eee45 Fix non-repeating linear gradients 2020-10-24 17:42:13 +02:00
Guillaume Ayoub
01fe5504e4 Fix links 2020-10-23 13:08:29 +02:00
Guillaume Ayoub
12999bded8 Merge branch 'master' into pydyf 2020-10-23 12:36:03 +02:00
Guillaume Ayoub
bf89df5b67 Use axis variable instead of relying on flex-direction property 2020-10-21 21:03:34 +02:00
Guillaume Ayoub
638b70e3e3 Deduplicate flex logic for rtl
Related to #1225.
2020-10-21 21:03:01 +02:00
Mohammed Y. Alnajdi
a81a82dc4c Kozea/WeasyPrint#601: fix indentation 2020-10-11 08:49:57 +03:00
Mohammed Y. Alnajdi
0c2e7b2341 Kozea/WeasyPrint#601: remove TODO:handle RTL 2020-10-10 23:14:21 +03:00
Mohammed Y. Alnajdi
2a01aefeb5 Kozea/WeasyPrint#601: add flex rtl tests row & col 2020-10-10 22:04:49 +03:00
Mohammed Y. Alnajdi
ecb97b1854 Kozea/WeasyPrint#601: handle flex-direction column 2020-10-10 21:45:45 +03:00
Mohammed Y. Alnajdi
1e35ab3c5e flexbox: initial attempt to support flex with rtl 2020-10-03 20:42:36 +03:00
Mohammed Y. Alnajdi
251157944e added rtl flexbox test 2020-10-03 20:41:59 +03:00
Guillaume Ayoub
b545239f1e
Merge pull request #1146 from Tontyna/bookmark-label
Bookmark label
2020-09-23 21:33:18 +02:00
Guillaume Ayoub
c9385a4b0f Use the old square character for list
Fix #1182.
2020-09-23 20:50:21 +02:00
Lucie Anglade
fa92372cdb When adding embedded files, the Catalog dictionary is extended with a Name entry only when there isn’t one.
When there is already a Name entry in the Catalog, it’s the Name which is extended as the Catalog can have only one Names entry according to the PDF’s spec.

Internal links were broken with embedded files because an other Name entry was added and so PDF readers forgot the previous one containing the link’s destination.

Fix #1203.
2020-09-21 15:28:53 +02:00
Lucie Anglade
30bf467ce8 Cairo use hex string when there are parenthesis for TAG_LINK but not for TAG_DEST so an id is not represented by the same string in the pdf and pdf reader can make the link between them. Using urllib.parse.quote replaces special chars and so Cairo stop using hex string and pdf reader are happy. 2020-09-13 18:42:56 +02:00
Lucie Anglade
a9822fbb83 Remove useless import 2020-09-10 12:07:10 +02:00
Lucie Anglade
325c9cb7b4 Fix test 2020-09-10 12:04:13 +02:00
Lucie Anglade
c5a06dbeae Clean code 2020-09-10 11:58:19 +02:00
Lucie Anglade
8612c374bd Add download test for attachment 2020-09-10 11:44:49 +02:00
Lucie Anglade
1519424378 Fix ci’s isort 2020-09-10 00:57:08 +02:00
Lucie Anglade
5de2bda477 Add missing space 2020-09-10 00:53:02 +02:00
Lucie Anglade
b1bb6b78bb isort 2020-09-10 00:52:41 +02:00
Lucie Anglade
a9a24f754f Use download attribute in <a> to define filename for attachment 2020-09-10 00:51:03 +02:00
Guillaume Ayoub
254f8fa935 Remove backslash 2020-09-04 08:40:18 +02:00
Guillaume Ayoub
89ab158868
Merge pull request #1165 from mikevoets/fix/variables-concatenation-in-content
Add support for concatenating var() functions in 'content' declarations
2020-09-04 08:12:40 +02:00
Guillaume Ayoub
c607c01a8c Fix a crash with a flexbox corner case
When the flex box height percentage can’t be solved using its parent heihgt,
its computed height is set to 'auto' even if the specified value is not
'auto'. It’s a problem when the flex box has multiple lines, because in this
case we rely on the computed height to distribute the extra space between the
lines.

Fix #1204.
2020-09-01 21:20:04 +02:00
Guillaume Ayoub
c9b27bdbb4 Simplify image mode management 2020-08-03 18:18:55 +02:00
Guillaume Ayoub
4539a91101 Handle images with transparency color 2020-08-02 15:44:39 +02:00
Guillaume Ayoub
b1baa9ea51 Handle trasparent images 2020-08-02 15:07:32 +02:00
Guillaume Ayoub
69094680ee Remove useless end of line 2020-08-01 17:09:06 +02:00
Guillaume Ayoub
cd02b7b71f Use simple conditions for page overflow test 2020-08-01 17:08:17 +02:00
Guillaume Ayoub
3fd85d86fe Fix page overflow 2020-08-01 17:08:00 +02:00
Guillaume Ayoub
598e747b2c Fix test about overflow
Pages don’t take care of padding and borders, it shouldn’t impact the page box
size and thus the way it overflows.
2020-08-01 16:01:56 +02:00
Guillaume Ayoub
f7f68d9db4 Round reference page heights as it’s done in pydyf 2020-08-01 15:13:41 +02:00
Guillaume Ayoub
a8871af91f Fix links rectangles in tests 2020-08-01 15:13:19 +02:00
Guillaume Ayoub
ed5c4ed5ee Fix links matrices 2020-08-01 15:13:03 +02:00
Guillaume Ayoub
9e28f41641 Fix test 2020-08-01 14:17:02 +02:00
Guillaume Ayoub
e8e5e0a759 Remove unused import 2020-08-01 10:51:10 +02:00
Guillaume Ayoub
9d29716b91 Merge remote-tracking branch 'origin/master' into pydyf 2020-07-31 14:46:36 +02:00
Mike Voets
736e62f222 Fix blank line warning 2020-07-20 13:11:06 +12:00
Mike Voets
e444c95174 Clean up comment 2020-07-20 12:27:24 +12:00
Mike Voets
db3944c1d9 Make changes more generic 2020-07-20 12:25:53 +12:00
Mike Voets
d08c5b4fd6 Fix lint issues 2020-07-17 09:29:03 +12:00
Mike Voets
b234d1b66a Fix variables tests 2020-07-17 09:21:20 +12:00
Mike Voets
3f3b564094 Add support for concatenating var() functions in 'content' declarations 2020-07-17 08:50:20 +12:00
Guillaume Ayoub
2b1490e492 Merge branch 'master' of github.com:Kozea/WeasyPrint 2020-06-23 22:35:35 +02:00
Guillaume Ayoub
d4025bd66e Fix CLI arguments documentation
Fix #1149.
2020-06-23 22:35:00 +02:00
Guillaume Ayoub
f333cefc51
Merge pull request #1141 from Tontyna/clipped-margins
Dont clip page margins on account of body overflow
2020-06-23 00:49:47 +02:00
Guillaume Ayoub
c443b9c9a6 Fix tests 2020-06-22 16:40:06 +02:00
Guillaume Ayoub
3d4cb04904 Add an image cache that can be shared between documents
Fix #969.
2020-06-22 16:32:12 +02:00
Guillaume Ayoub
c0dd955c9e Merge branch 'master' of github.com:Kozea/WeasyPrint 2020-06-22 16:06:54 +02:00
Guillaume Ayoub
c56b96b3c1 Add an option to optimize embedded images size 2020-06-22 16:05:14 +02:00
Tontyna
6454e5ee5b Add test for body overflow not clipping page margins 2020-06-21 14:09:56 +02:00
Tontyna
2d9482b913 Apply viewport_overflow when box.is_for_root_element 2020-06-21 11:45:59 +02:00
Tontyna
5290cd1783 Add test for suppression of repeated bookmarks 2020-06-19 14:40:05 +02:00
Tontyna
4c67371f32 Prevent repetition of bookmarks
Remove duplicate bookmark-labes when pagination is finished.
The box.element helps detecting them.

Resolves #1145
2020-06-19 13:22:40 +02:00
Tontyna
d98e46b511 Add test for :before and :after bookmarks 2020-06-19 08:57:42 +02:00
Tontyna
80b9fefb4e Compute bookmark-label for :before and :after boxes 2020-06-19 08:23:20 +02:00
Tontyna
fc082549a7 Add test for bookmark-label containing page counter 2020-06-18 23:16:44 +02:00
Tontyna
ad564d78c1 Copy bookmark-labels after (re)pagination
box.string_set is a pointer and is updated automatically when
parse_again() is called for page based counters and target-*.

box.bookmark_label is just a string an we must copy it explicitly
from the re-evaluated original boxes to the page's children.
2020-06-18 22:36:26 +02:00
Tontyna
43a37fe4ff make FLAKE happy 2020-06-14 15:27:14 +02:00
Tontyna
58525cc359 Dont clip page margins on account of body overflow
Though the `overflow` on the root element must be propagated to the
viewport we mustn't cut off the page margins in `draw_stacking_context()`

1. never clip when a PageBox is rendered
2. do the proposed clip when drawing the <BlockBox html>

fixes #35
2020-06-14 14:36:36 +02:00
Guillaume Ayoub
8c34ddfce7 Fix some API tests 2020-06-08 21:09:43 +02:00
Guillaume Ayoub
30db42b08a Fix gradients domain 2020-06-08 16:34:36 +02:00
Guillaume Ayoub
7cbaa243c3 Fix shading dictionary 2020-06-08 16:34:28 +02:00
Guillaume Ayoub
6aa16733ec Remove useless import 2020-06-08 16:10:24 +02:00
Guillaume Ayoub
b35a8bfac3 Fix no-repeat 2020-06-08 00:34:40 +02:00
Guillaume Ayoub
8f9e15a57e Handle image-rendering 2020-06-08 00:01:09 +02:00
Guillaume Ayoub
58016053a0 Handle solid gradients 2020-06-07 23:40:01 +02:00
Guillaume Ayoub
4f7522cb08 Fix image names for gradient tests 2020-06-07 23:38:12 +02:00
Guillaume Ayoub
c9ecb2366c Small fixes for images 2020-06-07 21:17:29 +02:00
Guillaume Ayoub
075bfad788 Fix some gradients tests 2020-06-07 20:54:40 +02:00
Guillaume Ayoub
a673ad113c Handle images less than 32×32 2020-06-07 17:05:36 +02:00
Lucie Anglade
2a1c33d0ba Filter depending image format 2020-06-07 16:12:47 +02:00
Lucie Anglade
2a4020f57c Use jpeg2000 to save pillow image when format is not jpeg 2020-06-07 16:04:25 +02:00
Guillaume Ayoub
57994a18b0 Fix document parameter in contexts 2020-06-07 15:38:16 +02:00
Guillaume Ayoub
c50e9aff11 Use dedicated resources for x-objects and patterns 2020-06-07 15:18:00 +02:00
Guillaume Ayoub
39580ec898 Remove useless imports 2020-06-07 11:41:31 +02:00
Guillaume Ayoub
d6cdb690a2 Handle multi-color gradients 2020-06-07 11:40:30 +02:00
Guillaume Ayoub
64e9d4c1c2 Handle gradients positions and repeats 2020-06-07 11:20:38 +02:00
Guillaume Ayoub
29365f3318 Re-enable user_to_device_distance 2020-06-07 11:04:12 +02:00
Guillaume Ayoub
0350a8c055 Handle very simple gradients 2020-06-07 00:32:47 +02:00
Guillaume Ayoub
9b1cd0e870 Merge branch 'pydyf' of gitlab.com:courtbouillon/weasyprint into pydyf 2020-06-06 11:17:11 +02:00
Guillaume Ayoub
b00346924b Don’t release memory allocated by ffi.new
These objects are owned by the Python object and are automatically released
when garbage-collected.
2020-06-04 01:27:38 +02:00
Lucie Anglade
f2a7614138 Rotate image 2020-06-03 19:47:34 +02:00
Lucie Anglade
86b32fa2c2 Different colorspace depending of image format 2020-06-03 19:46:58 +02:00
Lucie Anglade
7eff99018e Use unique image name 2020-06-03 18:01:25 +02:00
Lucie Anglade
f530502e05 Handle jpg images 2020-06-03 17:58:53 +02:00
Guillaume Ayoub
baa341ad28 Small optimizations in text rendering 2020-06-02 22:29:32 +02:00
Guillaume Ayoub
2aee94b411 Don’t set the whole text of the second line 2020-06-02 22:04:57 +02:00
Guillaume Ayoub
adceabb29d Fix index when splitting long texts 2020-06-02 21:56:03 +02:00
Guillaume Ayoub
d70e556c39 Improve memory allocation and fix or document memory leaks 2020-06-02 18:17:33 +02:00
Guillaume Ayoub
f1bf364c4e Don’t use iters to get layout lines
This commit removes code and improves speed 😎.
2020-06-02 17:59:17 +02:00
Guillaume Ayoub
e3f1a4ad0a Don’t use garbage collector in heavily used functions 2020-06-01 16:51:33 +02:00
Guillaume Ayoub
5b0c57dcb4 Merge lines between runs 2020-06-01 15:38:27 +02:00
Guillaume Ayoub
8e8aba0afa Compress streams 2020-06-01 11:48:17 +02:00
Guillaume Ayoub
603ee2659a Improve text rendering speed 2020-06-01 01:12:32 +02:00
Guillaume Ayoub
47815d1b01 Handle font subsets 2020-05-31 01:20:38 +02:00
Guillaume Ayoub
eaeef5128d Fix some tests 2020-05-30 16:59:58 +02:00
Guillaume Ayoub
370f87dce1 Don’t include zero-width characters in subsets 2020-05-30 16:24:38 +02:00
Guillaume Ayoub
9a9751f529 Fix border tests 2020-05-30 15:58:34 +02:00
Guillaume Ayoub
9372b94e8d Clean formatted strings 2020-05-30 15:55:44 +02:00
Guillaume Ayoub
89651e2f04 Clean css/__init__ 2020-05-30 01:41:16 +02:00
Guillaume Ayoub
259d686aec Clean __init__ and __main__ 2020-05-30 01:27:13 +02:00
Guillaume Ayoub
11901bb9ea Clean document.py 2020-05-30 01:11:30 +02:00
Guillaume Ayoub
e61dd3a761 Don’t crash when font can’t be optimized 2020-05-30 00:30:13 +02:00
Guillaume Ayoub
6593f48430 Ignore but include unknown font tables 2020-05-29 23:41:16 +02:00
Guillaume Ayoub
30cc2c1105 Optimize fonts 2020-05-29 19:43:56 +02:00
Guillaume Ayoub
5fea96e5ca Remove useless imports 2020-05-29 19:01:58 +02:00
Guillaume Ayoub
d7ab2e3bbd Handle woff and woff2 fonts with fonttools 2020-05-24 15:02:28 +02:00
Guillaume Ayoub
8e9e6b6bfe Merge remote-tracking branch 'origin/master' into pydyf 2020-05-23 21:45:45 +02:00
Guillaume Ayoub
7bda70629f
Merge pull request #1120 from Tontyna/target-revisited
create a TargetLookupItem for each anchor
2020-05-23 21:44:34 +02:00
Guillaume Ayoub
3f35459393 Merge remote-tracking branch 'origin/master' into pydyf 2020-05-23 17:39:58 +02:00
Guillaume Ayoub
bea6cef5a6 Fix the terribly wrong line width given by Pango
Pango layouts can generate lines whose logical widths are wider than the layout
maximum width, even if the lines can be broken earlier. This "problem" is
caused by Pango returning rounded Harfbuzz values for line extents, while using
real Harfbuzz values internally to split lines.

In Pango < 1.44, the width value was OK.

We could open an issue on Pango to ask if there’s a way to get reliable
information about line widths.

Or we could just shoot Pango and only use Harfbuzz, as other browsers do.

We can do that as soon as we’ve removed Cairo.

I’m not joking. I never am.

Fix #1051.
2020-05-23 17:27:14 +02:00
Guillaume Ayoub
cf7ea6f4de Merge remote-tracking branch 'origin/master' into pydyf 2020-05-23 09:41:49 +02:00
Guillaume Ayoub
f6f9f144c2 Handle most cases for boxes avoiding flots in rtl containers
Fix #1110.
2020-05-22 17:09:17 +02:00
Guillaume Ayoub
ca9f962dcd Remove useless TODO 2020-05-22 02:28:51 +02:00
Guillaume Ayoub
ebe958e2cc Prefer while True to while 1 2020-05-22 00:14:15 +02:00
Guillaume Ayoub
6ccb269945 Merge branch 'master' of github.com:Kozea/WeasyPrint 2020-05-21 18:21:25 +02:00
Guillaume Ayoub
9746b2dc76 Improve rtl text test 2020-05-21 18:20:53 +02:00
Guillaume Ayoub
faf19cbcde
Merge pull request #1106 from kalekseev/fix-dlopen
dlopen shared library symlink using major version name.
2020-05-21 14:55:03 +02:00
Tontyna
2867f21230 create a TargetLookupItem for each anchor 2020-05-20 02:33:10 +02:00
Guillaume Ayoub
35f27b0afa Use subprocess.run
It’s just more simple than Popen.
2020-05-18 23:53:19 +02:00
Guillaume Ayoub
04449a0fa1 Fix comment in PNG generation function
Using GhostScript as a library seems to be awful. Let’s forget this idea.
2020-05-18 22:45:35 +02:00
Guillaume Ayoub
d06f081af6 Fix x position of RTL characters with trailing space
When a line has an unwanted trailing space, the space is removed and the
textbox’ width (and its ancestor’s) is recalculated.

If the line characters have a main RTL Unicode direction (not the CSS box
direction, the text direction), the trailing space is at the left of the
box. Recalculating the width is not enough, we also need to fix the x position.

Testing would be better with Arabic characters, but none is included in
Ahem. Forcing the text direction works well too.

Fix #1111.
2020-05-18 21:36:41 +02:00
Guillaume Ayoub
32f0f22ac2 Clean return condition in document.py 2020-05-18 11:54:37 +02:00
Guillaume Ayoub
e019278d9f Don’t make write_png return size 2020-05-18 01:36:48 +02:00
Guillaume Ayoub
58599d325e Don’t crash when trying to display images 2020-05-18 01:29:59 +02:00
Guillaume Ayoub
c422c1b77e Disable antialiasing by default 2020-05-18 01:29:37 +02:00
Guillaume Ayoub
0ecb246501 Use less code to compare PNG files in tests 2020-05-18 00:49:21 +02:00
Guillaume Ayoub
57fd7f3f0c Don’t return useless document in html_to_pixels 2020-05-17 23:54:25 +02:00
Guillaume Ayoub
e2700082fc Don’t write GhostScript renderings on disk 2020-05-17 23:48:41 +02:00
Guillaume Ayoub
15035f8c97 Mark some tests are failing
These tests were failing with Cairo too, but the rendering was OK because Cairo
was lucky
2020-05-17 23:37:35 +02:00
Guillaume Ayoub
7686fbd4ae Always end path when clipping 2020-05-17 23:11:19 +02:00
Guillaume Ayoub
fee0f91c56 Save layout max width to avoid calling unavailable clip_extents 2020-05-17 22:48:38 +02:00
Guillaume Ayoub
23dccecc3a Set some optional arguments as needed as they are always given 2020-05-17 22:47:52 +02:00
Guillaume Ayoub
38dae61b23 Fix box drawing tests 2020-05-17 20:11:22 +02:00
Guillaume Ayoub
c85d58a86e Linting 2020-05-17 20:01:49 +02:00
Guillaume Ayoub
b8749863d1 Fix all PDF tests not relying on images 2020-05-17 18:59:31 +02:00
Guillaume Ayoub
d1dcea7b1c Fix anchors 2020-05-17 17:12:23 +02:00
Guillaume Ayoub
7e9f80e7a2 Add comment for outlines 2020-05-17 17:12:16 +02:00
Guillaume Ayoub
f7ce6a6db0 Don’t use references for states and xobjects dicts 2020-05-17 17:04:45 +02:00
Guillaume Ayoub
e1e3974d00 Fix typo 2020-05-17 16:59:58 +02:00
Guillaume Ayoub
522b240474 Don’t set links on lineboxes 2020-05-17 15:54:02 +02:00
Guillaume Ayoub
b0da0290ba Disable antialiasing for tests 2020-05-17 15:06:45 +02:00
Guillaume Ayoub
e711363490 Add an option to enable antialiasing for PNG generation 2020-05-17 15:06:17 +02:00
Guillaume Ayoub
3de277ce0e Handle opacity 2020-05-17 14:46:41 +02:00
Guillaume Ayoub
bf3c7324cb Fix many tests 2020-05-16 17:06:30 +02:00
Guillaume Ayoub
8d2ea802f0 Add various dictionaries only when needed 2020-05-16 17:05:48 +02:00
Guillaume Ayoub
07ac9e855f Fix attachments name discovery 2020-05-16 17:05:11 +02:00
Guillaume Ayoub
5f2107fde8 Remove embedded files dictionary when empty 2020-05-16 16:25:06 +02:00
Guillaume Ayoub
9e486a345a Fix outlines 2020-05-16 16:19:28 +02:00
Guillaume Ayoub
0c9312167e Don’t remove seconds when timezone is set 2020-05-16 15:23:20 +02:00
Guillaume Ayoub
b2797dafe1 Fix lint 2020-05-16 14:27:03 +02:00
Guillaume Ayoub
ae2f6ed3b8 Remove @requires decorator 2020-05-16 00:25:11 +02:00
Guillaume Ayoub
feb25b479d Remove pango_cairo_* definitions 2020-05-16 00:20:31 +02:00
Guillaume Ayoub
efd231ea15 Remove useless cairo import 2020-05-16 00:19:41 +02:00
Guillaume Ayoub
70e195f464 Use transform instead of scale and translate 2020-05-16 00:19:25 +02:00
Guillaume Ayoub
47b8f80695 Don’t use Cairo for tests 2020-05-16 00:04:18 +02:00
Guillaume Ayoub
1383592243 Fix multi-page PNG generation 2020-05-16 00:04:09 +02:00
Guillaume Ayoub
9733cb1718 Handle WOFF fonts 2020-05-15 16:12:45 +02:00
Guillaume Ayoub
dc443ab30d Remove naughty comma
Fix #1114.
2020-05-15 11:54:00 +02:00
Guillaume Ayoub
5b4bbb22e7 Fix many tests 2020-05-13 01:02:43 +02:00
Guillaume Ayoub
cad749b93e Lint 2020-05-12 23:54:42 +02:00
Guillaume Ayoub
e4aab188f9 Use a reference for ToUnicode 2020-05-12 23:47:22 +02:00
Guillaume Ayoub
b3fb006184 Improve readibility 2020-05-12 23:06:18 +02:00
Guillaume Ayoub
90843ac4a1 Fix cmap letters for multiple runs 2020-05-12 22:37:40 +02:00
Guillaume Ayoub
00110952bb Merge branch 'pydyf' of gitlab.com:courtbouillon/weasyprint into pydyf 2020-05-12 21:54:07 +02:00
Guillaume Ayoub
cd5f178409 Fix outlines 2020-05-12 21:53:54 +02:00
Lucie Anglade
12272f50e4 Cmaps into font 2020-05-12 18:38:12 +02:00
Guillaume Ayoub
c42bbf1fae Fix embedded OpenType fonts 2020-05-12 13:11:52 +02:00
Guillaume Ayoub
21226efbe1 Fix zlib compression 2020-05-12 02:03:39 +02:00
Guillaume Ayoub
099347ce94 Fix arrays in char widths 2020-05-12 02:00:07 +02:00
Lucie Anglade
c4fb5324b5 Use pydyf text methods 2020-05-12 00:24:20 +02:00
Guillaume Ayoub
c7acb05b63 Improve readability 2020-05-10 18:22:13 +02:00
Guillaume Ayoub
53caa99a50 Use a smaller array for characters widths 2020-05-10 18:09:06 +02:00
Guillaume Ayoub
36cc7c6f68 Fix insconsistent kerning and font metrics values 2020-05-10 17:51:37 +02:00
Guillaume Ayoub
e1b458e174 Handle TTF and OTF font files with dedicated PDF syntaxes 2020-05-10 00:14:56 +02:00
Guillaume Ayoub
24c81ad99e Simplify kerning and font size management 2020-05-09 22:23:33 +02:00
Guillaume Ayoub
d25527351b Always store 1pt fonts to get metrics 2020-05-09 18:06:20 +02:00
Guillaume Ayoub
e9122c989e Fix units used for characters widths and kerning 2020-05-09 15:52:43 +02:00
Guillaume Ayoub
aa7c9e3aa8 Add kerning values 2020-05-09 01:35:43 +02:00