From dd7cee28a04b7c1afca16bc679eb20526d30aaa4 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 6 Jul 2024 16:40:27 +0200 Subject: [PATCH] Use new pydyf API --- pyproject.toml | 2 +- weasyprint/draw/__init__.py | 2 +- weasyprint/draw/text.py | 2 +- weasyprint/images.py | 2 +- weasyprint/pdf/stream.py | 2 +- weasyprint/svg/defs.py | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b2305963..7b46e181 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ requires-python = '>=3.9' readme = {file = 'README.rst', content-type = 'text/x-rst'} license = {file = 'LICENSE'} dependencies = [ - 'pydyf >=0.10.0', + 'pydyf >=0.11.0', 'cffi >=0.6', 'html5lib >=1.1', 'tinycss2 >=1.3.0', diff --git a/weasyprint/draw/__init__.py b/weasyprint/draw/__init__.py index 46154f46..a26d74bc 100644 --- a/weasyprint/draw/__init__.py +++ b/weasyprint/draw/__init__.py @@ -326,7 +326,7 @@ def draw_background_image(stream, layer, image_rendering): with stacked(stream): layer.image.draw(group, image_width, image_height, image_rendering) pattern.draw_x_object(group.id) - stream.color_space('Pattern') + stream.set_color_space('Pattern') stream.set_color_special(pattern.id) if layer.unbounded: x1, y1, x2, y2 = stream.page_rectangle diff --git a/weasyprint/draw/text.py b/weasyprint/draw/text.py index 6b12689d..49fabd68 100644 --- a/weasyprint/draw/text.py +++ b/weasyprint/draw/text.py @@ -126,7 +126,7 @@ def draw_first_line(stream, textbox, text_overflow, block_ellipsis, matrix): utf8_text = textbox.pango_layout.text.encode() previous_utf8_position = 0 - stream.text_matrix(*matrix.values) + stream.set_text_matrix(*matrix.values) last_font = None string = '' x_advance = 0 diff --git a/weasyprint/images.py b/weasyprint/images.py index 67e20d8c..0dd1bb24 100644 --- a/weasyprint/images.py +++ b/weasyprint/images.py @@ -539,7 +539,7 @@ class Gradient: alpha_stream.transform(d=scale_y) alpha_stream.stream = [f'/{alpha_shading.id} sh'] - stream.shading(shading.id) + stream.paint_shading(shading.id) def layout(self, width, height): """Get layout information about the gradient. diff --git a/weasyprint/pdf/stream.py b/weasyprint/pdf/stream.py index 0c7ba66d..f1d73254 100644 --- a/weasyprint/pdf/stream.py +++ b/weasyprint/pdf/stream.py @@ -53,7 +53,7 @@ class Stream(pydyf.Stream): assert self._ctm_stack def transform(self, a=1, b=0, c=0, d=1, e=0, f=0): - super().transform(a, b, c, d, e, f) + super().set_matrix(a, b, c, d, e, f) self._ctm_stack[-1] = Matrix(a, b, c, d, e, f) @ self.ctm def begin_text(self): diff --git a/weasyprint/svg/defs.py b/weasyprint/svg/defs.py index d000f314..3925be2e 100644 --- a/weasyprint/svg/defs.py +++ b/weasyprint/svg/defs.py @@ -227,10 +227,10 @@ def draw_gradient(svg, node, gradient, font_size, opacity, stroke): shading_type, 'Gray', domain, coords, extend, function) alpha_stream.stream = [f'/{alpha_shading.id} sh'] - group.shading(shading.id) + group.paint_shading(shading.id) pattern.set_alpha(1) pattern.draw_x_object(group.id) - svg.stream.color_space('Pattern', stroke=stroke) + svg.stream.set_color_space('Pattern', stroke=stroke) svg.stream.set_color_special(pattern.id, stroke=stroke) return True @@ -461,7 +461,7 @@ def draw_pattern(svg, node, pattern, font_size, opacity, stroke): group, pattern_width, pattern_height, svg.base_url, svg.url_fetcher, svg.context) stream_pattern.draw_x_object(group.id) - svg.stream.color_space('Pattern', stroke=stroke) + svg.stream.set_color_space('Pattern', stroke=stroke) svg.stream.set_color_special(stream_pattern.id, stroke=stroke) return True