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

2608 Commits

Author SHA1 Message Date
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
Guillaume Ayoub
46a1524af6 Fix text size and position 2020-05-09 00:00:07 +02:00
Guillaume Ayoub
d53b86053d Use font codepoints instead of Unicode codepoints 2020-05-08 17:14:45 +02:00
Lucie Anglade
6e3214eea8 Fix widths 2020-05-08 15:14:10 +02:00
Lucie Anglade
a6ff868094 First and last characters, and widths 2020-05-08 15:07:51 +02:00
Guillaume Ayoub
d4b7f242c3 Remove useless variable 2020-05-08 02:13:44 +02:00
Guillaume Ayoub
8f640237e5 Remove useless font name prefix 2020-05-08 01:58:43 +02:00
Guillaume Ayoub
954dcc03b4 Fix font name 2020-05-08 01:55:50 +02:00
Guillaume Ayoub
aa2030d737 Change some font attributes names 2020-05-08 01:50:41 +02:00
Guillaume Ayoub
05bc5eed17 Don’t use the 3/4 ratio, as Pango and PDF both use points 2020-05-08 01:39:42 +02:00
Guillaume Ayoub
3342386a28 Fix font bounding box 2020-05-08 01:30:07 +02:00
Lucie Anglade
36ed176a36 Use computed values 2020-05-08 00:40:01 +02:00
Guillaume Ayoub
c1f95ab8f7 Remove useless parenthesis 2020-05-08 00:31:50 +02:00
Guillaume Ayoub
6f44d18b81 Merge branch 'pydyf' of gitlab.com:courtbouillon/weasyprint into pydyf 2020-05-08 00:31:00 +02:00
Guillaume Ayoub
0dcddc7a4e Display some text 2020-05-08 00:29:46 +02:00
Lucie Anglade
a8eb334f9d Release memory 2020-05-08 00:28:30 +02:00
Lucie Anglade
088e06da0e Use the saved pango_font 2020-05-08 00:24:30 +02:00
Lucie Anglade
0a412542d9 Fix parameters 2020-05-08 00:23:13 +02:00
Lucie Anglade
18e10631f9 Set flags always to 4, symbolic 2020-05-08 00:19:07 +02:00
Lucie Anglade
f306418cfd Get FontBBox and CapHeight 2020-05-08 00:11:19 +02:00
Guillaume Ayoub
590c0c57ce Fully describe PangoGlyphInfo 2020-05-07 23:39:21 +02:00
Lucie Anglade
7dab88c3ad Font name, and save glyphs 2020-05-07 23:27:43 +02:00
Guillaume Ayoub
1129f82cea Don’t import pango twice 2020-05-07 22:37:11 +02:00
Lucie Anglade
e64e98a56a Move getting font informations from text to document 2020-05-07 19:33:54 +02:00
Lucie Anglade
aab07099a9 Start retrieving font descriptor info 2020-05-06 20:10:18 +02:00
Guillaume Ayoub
5ed840fc7d Include font streams 2020-05-06 07:42:45 +02:00
Konstantin Alekseev
1571528da3 dlopen shared library symlink using major version name.
cffi.dlopen should use .so.N symlinks instead of .so to
make sure we load ABI compatible version of the library and
the same library used by the rest of the system.

cffi uses `ctypes.util.find_library` to search for libraries
and the docs for `find_library` states that
"The exact functionality is system dependent."
so different system may expect different names for the same library.

To overcome that problem we try to load several names until success
among these names exact file name with `.so` suffix
eg. `libcairo.so` but .so symlink is not always safe to use.

Shared library usually consist of two of three files:
- libcairo.so.N.M - N.M exact version number
- libcairo.so.N - symlink to library.so.N.M with major ABI version
- libcairo.so - symlink to library.so.N

When -lcairo flag is used linker search for libcairo.so,
but when the programm loaded it loads libcairo.so.N where N
is the version that it was linked with.

Some downsides of .so usage:
- .so may point to the wrong ABI version, e.g. we expect libcairo
  version 2 but libcairo.so points at libcairo.so.1
- usually .so files are shipped with development packages `-dev`
  in debian and `-devel` in centos and they are just symlinks
  to the .so.N files. So it safer to search for .so.N files they
  will exist even if dev package is not installed.
- hard symlink .so -> .so.N not always preserved, eg. if we zip
  them we get two copies of the library and while the rest of the
  system will use .so.N file we will load .so files that may lead
  to crash
2020-05-03 22:01:41 +03:00
Guillaume Ayoub
67b104d8ab Get fonts data 2020-04-26 00:48:38 +02:00
Guillaume Ayoub
bbc1355df6 Force FontConfig use 2020-04-26 00:48:32 +02:00
Guillaume Ayoub
7de2e45f55 Fix crash when there’s no outline 2020-04-21 23:07:35 +02:00
Guillaume Ayoub
44c21b7f31 Go through PDF pages only once during generation 2020-04-21 22:47:55 +02:00
Guillaume Ayoub
d02bc1bde1 Add inline attachments 2020-04-21 22:30:38 +02:00
Guillaume Ayoub
3bee463e83 Remove resolve_links from Document class 2020-04-19 18:26:49 +02:00
Guillaume Ayoub
9752142959 Merge document and pdf modules 2020-04-19 16:49:37 +02:00
Guillaume Ayoub
cbf010952d Fix transformation matrix with bleed box 2020-04-19 14:40:30 +02:00
Guillaume Ayoub
f353a16cf5 Call finisher 2020-04-19 10:01:27 +02:00
Guillaume Ayoub
c94423a700 Handle bleed box 2020-04-19 09:55:39 +02:00
Guillaume Ayoub
a06322d432 Remove some references to Cairo 2020-04-19 08:09:22 +02:00
Guillaume Ayoub
5cd62f4d31 Fix border style 2020-04-19 07:52:32 +02:00
Guillaume Ayoub
98570cc095 Handle hyperlinks and anchors 2020-04-19 00:47:19 +02:00
Guillaume Ayoub
b3baac3694 Handle bookmark state 2020-04-18 22:41:23 +02:00
Guillaume Ayoub
ece3025fd6 Handle transforms and bookmarks 2020-04-18 22:12:25 +02:00
Guillaume Ayoub
bf2b21b6e0 First steps to replace cairo with pydyf 2020-04-18 00:19:35 +02:00
Guillaume Ayoub
29309aa673 Don’t display template tags
Fix #1080.
2020-04-13 11:44:37 +02:00
Guillaume Ayoub
fda14c0ff4 Fix typo 2020-04-10 14:07:12 +02:00
Guillaume Ayoub
b1b5e3ee98 Simplify renderer’s argparse code
Related to #1099.
2020-04-10 13:50:33 +02:00