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

1264 Commits

Author SHA1 Message Date
Guillaume Ayoub
0dc1bf6f8c Remove useless margin for inline markers 2017-07-31 11:28:23 +02:00
Guillaume Ayoub
7abfcb9e75 Update StyleDict.copy's description 2017-07-30 14:00:33 +02:00
Guillaume Ayoub
b3865c811c Re-add a copy method for StyleDict 2017-07-28 22:28:29 +02:00
Guillaume Ayoub
56f27885f4 Remove StyleDict mutations and copies 2017-07-28 19:56:14 +02:00
Guillaume Ayoub
a2a29d7b6f Clean the way the anonymous attribute is set to tables and wrappers 2017-07-28 18:59:43 +02:00
Guillaume Ayoub
a3e2c474f0 Transform StyleDict into a kind of frozen dict
This forces to use a copy when changes are needed. Internal mutable structures
have also been changed into immutable ones (i.e. lists have been turned into
tuples).

This change is a really useful first step to greatly optimize memory and time
needed to render large documents, as allows us to cache style dicts more
safely. It's been already done in StyleDict.inherit_from, with a ~5-10% memory
benefice.
2017-07-28 13:35:06 +02:00
Guillaume Ayoub
437a079542 Add a verbose option
Related to #488.
2017-07-25 14:00:35 +02:00
Guillaume Ayoub
c818934b4c Fix import order 2017-07-25 14:00:24 +02:00
Guillaume Ayoub
fcd6bf7070 Clean and document the logging levels
Related to #488.
2017-07-25 13:59:56 +02:00
Guillaume Ayoub
f856edb3b4 Log the document generation steps
Related to #488.
2017-07-25 13:58:18 +02:00
Guillaume Ayoub
381678eec4 Don't draw all the lines when calculating the first line width
Just as it's done in inline_min_content_width, the first_line attribute is now
used in inline_line_widths. It greatly improves performance for really long
texts.
2017-07-23 23:11:55 +02:00
Guillaume Ayoub
279e50790d Don't crash when max_width is infinite 2017-07-23 23:10:36 +02:00
Guillaume Ayoub
91b58db81f Cut long lines before splitting them
This optimization had been added and removed before, but it's really useful for
very long lines.
2017-07-23 22:05:48 +02:00
Guillaume Ayoub
344cb08f60 Don't copy styles when copying boxes, improve memory management
Style is not copied anymore when boxes are duplicated. Style dicts are not
modified anymore during the layout, as it was before for some properties:

- margins, borders and paddings when the box was split between two
  pages (useless as these computed values are stored directly in the box),
- top borders were changed in tables (useless for the same reason),
- bookmark labels and string sets are now stored in the box.

This commit can introduce very subtle bugs that are hard to debug. In the
future, we should try to freeze the style dicts before the layout.

Related to #70.
2017-07-22 13:51:03 +02:00
Guillaume Ayoub
a9a99f69d7 Don't crash with @font-face{src: local()}
Fix #487.
2017-07-20 17:07:00 +02:00
Guillaume Ayoub
1fd38bdc7b Fix the local(Test Test) syntax in @font-face src
Related to #487.
2017-07-20 17:04:46 +02:00
Guillaume Ayoub
e0acecb4db Reorder imports 2017-07-13 17:39:29 +02:00
Guillaume Ayoub
718e4c3d8a Remove debug print 2017-07-13 17:38:12 +02:00
Guillaume Ayoub
140522c97c Merge pull request #485 from Kozea/cssselect2
Use cssselect2 instead of cssselect + lxml
2017-07-11 18:15:39 +02:00
Guillaume Ayoub
46da8b5107 Drastically improve speed when rendering preformatted text
Fix #483.
2017-07-07 14:26:38 +02:00
Guillaume Ayoub
dc225029a4 Fix wrong variable name 2017-07-07 14:05:12 +02:00
Guillaume Ayoub
dec5148e1b Fix import order 2017-07-07 11:52:40 +02:00
Guillaume Ayoub
a0dba07b67 Don't store base_url in ElementWrappers 2017-07-07 11:14:07 +02:00
Guillaume Ayoub
a11eeba00e Use ElementTree's element to get its tag 2017-07-03 15:31:17 +02:00
Guillaume Ayoub
ba26fa34a9 Use ElementTree's elements as much as possible 2017-07-03 15:19:05 +02:00
Guillaume Ayoub
9468957a23 Flatten stylesheets list 2017-07-01 07:41:13 +02:00
Guillaume Ayoub
42552e2069 Don't go through the tree twice when applying styles 2017-07-01 07:26:36 +02:00
Guillaume Ayoub
5a3a014ef2 Don't rely on network resources for tests 2017-07-01 07:19:12 +02:00
Guillaume Ayoub
df50204f3e Remove unsupported source lines 2017-07-01 00:28:14 +02:00
Guillaume Ayoub
07190e2fd9 Don't test 'tree' as a possible HTML source 2017-06-30 22:58:33 +02:00
Guillaume Ayoub
0f6647194b Get rid of lxml 2017-06-30 22:48:47 +02:00
Guillaume Ayoub
f349f8b276 Make HTML inherit from cssselect2.ElementWrapper 2017-06-30 20:12:53 +02:00
Guillaume Ayoub
4a5fa84f9f Use cssselect2 instead of cssselect 2017-06-30 17:54:02 +02:00
Guillaume Ayoub
baa698f473 Version 0.39 2017-06-24 14:17:13 +02:00
Guillaume Ayoub
c74b206abb Fix the use of WeasyPrint's URL fetcher with CairoSVG 2017-06-23 12:23:22 +02:00
Guillaume Ayoub
5b65283a22 Version 0.38 2017-06-16 11:35:42 +02:00
Guillaume Ayoub
ccf58d73af Fix a bug caused by the port to tinycss2
Fix #477.
2017-06-16 09:29:25 +02:00
Guillaume Ayoub
3151b5518a Version 0.37. 2017-06-15 08:21:40 +02:00
Guillaume Ayoub
86e4c63f4a Try to use WeasyPrint's URL fetcher in CairoSVG
Related to Kozea/Flask-WeasyPrint#11.
2017-06-07 11:37:53 +02:00
Guillaume Ayoub
b4a95c1fbe Why did isort decide to become this intolerant? 2017-06-03 16:05:33 +02:00
Guillaume Ayoub
10ee68d432 Fix imports for this crazy nazisort 2017-06-03 15:46:37 +02:00
Guillaume Ayoub
81094997ee Don't crash when lines start with multiple soft hyphens
Related to #472.
2017-06-03 15:40:13 +02:00
Guillaume Ayoub
975586c24f Set an infinite layout width when the lines have already been split
Fix #449.
2017-06-03 15:14:27 +02:00
Guillaume Ayoub
1a66fa0fa4 Fix test with new freetype 2.8 version 2017-05-14 19:56:03 +02:00
Guillaume Ayoub
78f0d7f8a2 Move the shrink-to-fit hack from text.py to inline.py
The hack had been added to remove extra line breaks caused by floating point
errors when the shrink-to-fit width was coming from Pango and had a slightly
higher value when re-calculated in split_first_line.

The same problem appears when we split a line contaning inline-blocks (instead
of letters in the previous case), as the shrink-to-fit width may also inderctly
come from Pango and hit the same re-calculation floating point errors.

This commit moves the hack at a higher level, increasing the max width before
calling split_first_line when the line contains letters (same result as
before), but also before splitting lines containing inline-blocks.

Fix #467.
2017-05-14 15:07:28 +02:00
Guillaume Ayoub
3677929a5b Add a documentation paragraph about the font_config attribute 2017-05-03 09:22:19 +02:00
Guillaume Ayoub
e44ae6d5e0 Merge branch 'master' of github.com:Kozea/WeasyPrint 2017-05-02 09:06:46 +02:00
Guillaume Ayoub
143fbd6efd Fix ::first-letter box creation
Fix #462
2017-05-02 09:05:04 +02:00
Hugh Secker-Walker
da3b5ae061 Add a minor peephole optimization 2017-05-01 17:54:52 -04:00
Hugh Secker-Walker
9c807b52d2 Start on support for asserting close numerical values 2017-05-01 17:54:17 -04:00