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

195 Commits

Author SHA1 Message Date
Guillaume Ayoub
f66df067a1 Don't crash when using ex units in word-spacing in letter-spacing 2019-09-10 14:52:46 +02:00
Guillaume Ayoub
b06a3a9a6f Always set tabulation width
Not setting it makes Pango use a slightly different value of tabulation width,
breaking a test.
2019-09-05 13:46:01 +02:00
Guillaume Ayoub
97a5aaea07 Remove work done twice when splitting lines between characters
There used to be a problem with WRAP_CHAR method of Pango, but it's fixed. As
nothing is said in Pango's Changelog, the probem may have been in our heads,
and that wouldn't be surprising at all.
2019-07-18 11:39:35 +02:00
Guillaume Ayoub
9831a1ba40 Remove and fix some TODOs 2019-07-11 16:48:53 +02:00
Guillaume Ayoub
a5671524ef Fix text set on layout
This partially reverts a27146c.
2019-07-09 17:25:43 +02:00
Guillaume Ayoub
a27146c9a7 Don't reset layout text when there's no soft hyphens in text
Setting text is slow and should be avoided when possible. We should probably
avoid get_first_line too and keep the original one here.
2019-07-09 16:57:40 +02:00
Guillaume Ayoub
7d5347f081 Merge branch 'master' into perf 2019-07-09 16:13:28 +02:00
Guillaume Ayoub
66958573e5 Use only one del statement when possible 2019-07-09 16:09:23 +02:00
Guillaume Ayoub
7bda29b95b Clean Layout code 2019-07-08 16:34:58 +02:00
Guillaume Ayoub
6dcc17f151 Take care of text-overflow to set ellipsis
Fix #874.
2019-07-04 12:00:03 +02:00
Guillaume Ayoub
e88190fc14 Use Pango's set_ellipsize 2019-07-03 16:20:58 +02:00
Guillaume Ayoub
c813d45d61 First naive version of text-overflow support 2019-07-03 15:37:29 +02:00
Guillaume Ayoub
039b0a680d Don't rely on iter_get_index to get current line break index
pango_layout_iter_get_index gives the visual order, not the logical order, so
we can't rely on this to fix the line break index.

Fix #828.
2019-04-12 16:04:25 +02:00
Guillaume Ayoub
b7a9fe7dcc Update copyright 2019-03-04 11:04:06 +01:00
Guillaume Ayoub
a5ce96e8d7 Don't always set resume_at to None when the whole text fits
We want to keep resume_at for example when the text ends with a forced end of
line.

Fix #813.
2019-03-01 11:09:17 +01:00
Guillaume Ayoub
4729eac0f7 Don't crash when layout is created with font fatures but no context 2019-02-27 10:25:51 +01:00
Guillaume Ayoub
bdd45475b6 Clean a lot of things in API documentation 2019-02-22 11:34:46 +01:00
Guillaume Ayoub
723fb4e20e Couple of fixes with automatic and manual hyphenation
Fix #109, fix #748.
2019-01-02 17:45:56 +01:00
Guillaume Ayoub
316075cd52 Remove useless u'' 2019-01-02 17:45:45 +01:00
Guillaume Ayoub
f8a6bb545b Fix justification, word spacing and letter spacing 2018-12-03 10:28:57 +01:00
Guillaume Ayoub
2e600dc666 Deactivate Pango layout again as soon as possible 2018-11-21 22:29:04 +01:00
Guillaume Ayoub
4e6d449c5c Don't store Pango layout between page layout and drawing steps
Creating Pango layouts during page layout and recreating them when drawing
pages is a little bit slower but frees A LOT of memory.
2018-11-21 22:16:52 +01:00
Guillaume Ayoub
3cbb2e6143 Don't set hinting twice when drawing lines 2018-11-20 00:55:34 +01:00
Guillaume Ayoub
763fe7318e Use ffi's garbage collector helper for line iter 2018-11-20 00:55:00 +01:00
Guillaume Ayoub
12de567d1c Don't create an iter to get baseline value 2018-11-17 01:37:22 +01:00
Guillaume Ayoub
0a3db7d984 Replace iter_lines by get_first_line
get_first_line only gets the first line and returns the start index of the
second line.
2018-11-17 00:42:16 +01:00
Guillaume Ayoub
32d2359adc Make iter_lines return the first two lines
There's no need to get more.
2018-11-17 00:19:01 +01:00
Guillaume Ayoub
5f0723a727 Only keep two lines when creating text layouts
Layouts are used to render only one line and know if there's a second one. We
can thus ignore the text after the two first lines.
2018-11-16 23:47:32 +01:00
Guillaume Ayoub
07d3da6533 Optimize minimum size calculation of long inline elements
Fix #720.
2018-10-29 11:32:10 +01:00
Guillaume Ayoub
56904baa79 Use the same copyright line everywhere 2018-09-20 18:46:27 +02:00
Guillaume Ayoub
ab62ae1d3c Clean some comments and some code 2018-04-30 22:57:47 +02:00
Guillaume Ayoub
58f1f40904
Merge pull request #599 from Tontyna/test-api
Fix some pytest failures on Windows
2018-04-30 22:19:46 +02:00
Guillaume Ayoub
d37060399b Lint 2018-04-13 11:00:13 +02:00
Guillaume Ayoub
f6bd84e4ab Warn users with cairo < 1.15.4
Related to #339, #565, #616.
2018-04-13 10:44:19 +02:00
Tontyna
2c2092d27b Prevent Cairo crashing with font-size 0 2018-03-31 18:10:51 +02:00
Guillaume Ayoub
c167d7cad0 Don't use global variable for dictionaries 2018-03-25 16:26:39 +02:00
Guillaume Ayoub
4bdfae4eb6 Don't use a global cache to store font features 2018-03-25 16:20:24 +02:00
Guillaume Ayoub
db401ac0cb Don't create dummy cairo contexts each time a Layout is created
Saves a loooooot of time when a lot of text is drawn.

Related to #578.
2018-03-18 22:37:56 +01:00
Guillaume Ayoub
3b52fb058e Don't optimize resume_at when splitting lines with trailing spaces
Fix #586.

For some reason I don't really understand, stripping trailing spaces that would
make the line too long can't be optimized when the space is at the end of the
block. Returning None instead of the index of the last letter should be
possible, but it breaks the rendering when the first letter of the next line
box starts with a character that doesn't allow line breaks after spaces (many
punctuation characters for example) and that doesn't allow line wrap.

This change shouldn't be harmful, as the removed code lines were just cleaning
the resume_at value without changing the logic of line breaking. I suppose that
there's a bug somewhere else.
2018-03-10 00:26:11 +01:00
Guillaume Ayoub
63db508efb Ignore overflow_wrap: break-word when calculating min-content width
See https://drafts.csswg.org/css-text-3/#overflow-wrap-property

Fix #582.
2018-03-05 01:23:32 +01:00
Guillaume Ayoub
ee6b506002 Remove useless empty line 2018-01-29 23:30:57 +01:00
Guillaume Ayoub
7e03734ba4 Remove useless comment 2018-01-29 22:22:54 +01:00
Guillaume Ayoub
16e8186568 Drop Python 2 support 2018-01-14 01:48:17 +01:00
Guillaume Ayoub
ad11edfff2 Remove StyleDict objects 2018-01-13 17:41:08 +01:00
Guillaume Ayoub
724565f27a Don't allow attribute access to StyleDict objects 2018-01-13 17:05:23 +01:00
Guillaume Ayoub
31520990ac Don't compare Nones and ints 2018-01-09 23:42:56 +01:00
Guillaume Ayoub
995a9a324d Always set resume_at to None when reaching end of text
Fix #557.
2018-01-09 18:12:32 +01:00
Guillaume Ayoub
7be183f234 Remove broken optimization 2017-12-11 01:38:57 +01:00
Guillaume Ayoub
a7b192c1d3 Small fixes for line breaking 2017-12-11 00:20:49 +01:00
Guillaume Ayoub
71917af2fb Linebox breaks fixes and related tests 2017-12-10 01:01:55 +01:00