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

1185 Commits

Author SHA1 Message Date
Guillaume Ayoub
5c9a07bf1a Create first-letter box after white space handling
As ::first-letter depends on white space handling, we must create the
box after collapsing spaces, not during the build of the box tree.

This commit makes WeasyPrint pass most of the W3C tests related to
first-letter (and never crash). Known problems left include:

- list markers are considered as the first letter,
- lines may break between the first letter and the rest of the text
  (see #163 and #301),
- the CSS attributes are all kept, some should probably be removed (the
  spec doesn't give a whole list).

Even if W3C tests makes me quite confident (some of them are crazy),
tests must be added in WeasyPrint too.
2017-01-02 13:23:42 +01:00
Guillaume Ayoub
e222779f0a Merge branch 'master' into first 2017-01-02 12:14:49 +01:00
Guillaume Ayoub
f53e8d05ed Version 0.34 2016-12-21 01:11:23 +01:00
Guillaume Ayoub
18b1931374 Clean and test columns
Fix #403.
2016-12-17 00:43:55 +01:00
Guillaume Ayoub
5a07ec0891 Fix the multi-page columns algorithm
Related to #403.
2016-12-16 17:37:39 +01:00
Guillaume Ayoub
cf0efe64cc Cast the number of columns into int
Should fix #403.
2016-12-15 09:02:14 +01:00
Guillaume Ayoub
bf6911d36f Correctly close files open by mkstemp
Python's tempfile.mkstemp already opens files, we don't have to open
them twice. The documentation is not really clear about that but
there's a good post on Logilab's blog: https://www.logilab.org/17873

Fix #396.
2016-12-07 18:25:58 +01:00
Guillaume Ayoub
12c297d7e7 Honor the presentational_hints option for PDFs
Related to #398.
2016-12-06 08:07:58 +01:00
Guillaume Ayoub
b9699688f6 Don't pass skip_stack to insert_first_letter 2016-12-04 16:55:29 +01:00
Guillaume Ayoub
4e8379cb90 Always use two colons for pseudo-elements
Tests now mix one and two colons in CSS, but the user agent stylesheet
and internal representation of the pseudo-elements now awlays use two
colons.
2016-12-04 16:43:49 +01:00
Guillaume Ayoub
5fa966bb42 Carefully check first-letter's char category
Use only the punctuation categories listed in the spec.
2016-12-04 16:33:03 +01:00
Guillaume Ayoub
c2cc15fd6a Initial support of ::first-letter
The pseudo-element is currently added at the end of the build, but it
should be done during the layout as the whitespaces at the beginning of
the tags may be skipped.
2016-12-04 16:12:22 +01:00
Guillaume Ayoub
2614c48afc Version 0.33 2016-11-28 21:20:38 +01:00
Guillaume Ayoub
7ee1a746d8 Don't call add_top_padding when it's not needed 2016-11-25 01:21:26 +01:00
Guillaume Ayoub
92b3dbd00f Fix logic when finishing block formatting context
Related to #388.
2016-11-24 23:53:06 +01:00
Guillaume Ayoub
eb08c46489 Use second line's index instead of first line length 2016-11-22 02:37:04 +01:00
Guillaume Ayoub
8cb093c021 Always update resume_at when splitting lines
As Pango keeps the extra trailing spaces when it splits lines, we try to
add the next word of the second line to the first line without its
trailing spaces and see if it fits. If it doesn't, we have to update
resume_at as we have split the first line at a position that may be
different from what Pango did earlier.

Fix #389.
2016-11-22 01:11:02 +01:00
Guillaume Ayoub
292dc436d6 Merge pull request #393 from Kozea/osx-travis
Enable @font-face and add tests on MacOS
2016-11-21 20:16:43 +01:00
Guillaume Ayoub
521173b771 Try to render images as SVG first when sniffing 2016-11-21 09:29:55 +01:00
Guillaume Ayoub
68eb428919 Don't catch logs in mimetype sniffing test 2016-11-20 23:52:19 +01:00
Guillaume Ayoub
f89ef7b64a Fix data url in tests 2016-11-20 23:30:45 +01:00
Guillaume Ayoub
167e4513a8 Set a 1x1 size to sniffed SVG in tests 2016-11-20 22:59:48 +01:00
Guillaume Ayoub
7b965a1f69 Add missing comma 2016-11-20 22:45:33 +01:00
Guillaume Ayoub
e14bd345b7 Remove unused import 2016-11-20 22:16:50 +01:00
Guillaume Ayoub
c272b8b908 Install DejaVu for MacOS tests 2016-11-20 22:11:35 +01:00
Guillaume Ayoub
b3bf68c2d8 Try with Futura 2016-11-20 21:45:47 +01:00
Guillaume Ayoub
71de28c7fe Try another font for MacOS 2016-11-20 21:20:21 +01:00
Guillaume Ayoub
566c0d6ad0 Use different fonts for different OSes for tests 2016-11-20 14:45:37 +01:00
Guillaume Ayoub
706b8b8adf Try other values for the condensed font test 2016-11-20 13:55:47 +01:00
Guillaume Ayoub
c015d8dbc1 Fix again FcFontMatch's signature
Related to #391.
2016-11-20 12:59:02 +01:00
Guillaume Ayoub
44d6d892aa Use the real signature for FcFontMatch
Fix #391.
2016-11-20 02:39:26 +01:00
Guillaume Ayoub
063572c5a6 Set the font used for the condensed font test 2016-11-19 17:44:26 +01:00
Guillaume Ayoub
4eea3bba23 Remove double import 2016-11-19 16:51:40 +01:00
Guillaume Ayoub
180e297e04 Try to fix unicode test on MacOS 2016-11-19 16:48:56 +01:00
Guillaume Ayoub
9977c9dad6 Let's try fontconfig on MacOS 2016-11-19 16:25:30 +01:00
Keith Callenberg
0463f0d919 check for font_config
check for font_config before attempting to add_font_face
2016-11-17 15:29:39 -05:00
Guillaume Ayoub
8bdb827e38 Version 0.32 2016-11-17 17:03:43 +01:00
Guillaume Ayoub
61fdde1732 Flake 8 2016-11-17 16:40:11 +01:00
Guillaume Ayoub
ac0fdf962f Support simple table[cellpadding] 2016-11-17 01:06:10 +01:00
Guillaume Ayoub
6048545413 Support ol[start] and ul[value] 2016-11-17 00:37:03 +01:00
Guillaume Ayoub
d37b3a01cc Apply presentational hints before stylesheets 2016-11-10 19:15:35 +01:00
Guillaume Ayoub
1e96f4d09f Use line metrics for struts
That's how it used to work before 412aeb4, but it was replaced by font
metrics for performance issues. Font metrics seems to work well in most
cases, but it fails at least with Ahem for unknown reasons, as the
metrics defined in the font seem pretty good everywhere.

The new code introduced in this commit creates the line (as it was done
before), but doesn't go through the whole line-breaking layout as
there's no text. There's no visible performance loss.
2016-11-10 14:37:45 +01:00
Guillaume Ayoub
2a23bf99a3 Fix more and more memory leaks 2016-11-05 22:21:07 +01:00
Guillaume Ayoub
f401eb7f62 Don't unref attribute lists for text features
Tried many times at many places of the code, it always segfaults. Keep
them for now.
2016-11-05 19:02:54 +01:00
Guillaume Ayoub
72022e421d Merge remote-tracking branch 'origin/master' into perf 2016-11-03 12:55:14 +01:00
Guillaume Ayoub
cca09dbe1d Merge pull request #374 from Kozea/font-face
Support @font-face
2016-11-03 12:28:23 +01:00
Guillaume Ayoub
be66789730 Don't split again the text box with justified text
Instead of using split_text_box, we can only call the faster
split_first_line instead.

This commit also copies the style before updating the word spacing,
avoiding a bug introduced in this branch now that the style is shared
across the lines.
2016-11-03 01:10:35 +01:00
Guillaume Ayoub
cb65500cb5 Cache struts 2016-11-02 19:17:25 +01:00
Guillaume Ayoub
412aeb48fa Optimize font metrics 2016-11-02 12:55:01 +01:00
Guillaume Ayoub
cff44522fc Don't recreate new text layouts when not needed 2016-11-02 01:48:58 +01:00