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

2297 Commits

Author SHA1 Message Date
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