mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-09-11 20:47:56 +03:00
Use new pydyf API
This commit is contained in:
parent
61852c4098
commit
dd7cee28a0
@ -12,7 +12,7 @@ requires-python = '>=3.9'
|
|||||||
readme = {file = 'README.rst', content-type = 'text/x-rst'}
|
readme = {file = 'README.rst', content-type = 'text/x-rst'}
|
||||||
license = {file = 'LICENSE'}
|
license = {file = 'LICENSE'}
|
||||||
dependencies = [
|
dependencies = [
|
||||||
'pydyf >=0.10.0',
|
'pydyf >=0.11.0',
|
||||||
'cffi >=0.6',
|
'cffi >=0.6',
|
||||||
'html5lib >=1.1',
|
'html5lib >=1.1',
|
||||||
'tinycss2 >=1.3.0',
|
'tinycss2 >=1.3.0',
|
||||||
|
@ -326,7 +326,7 @@ def draw_background_image(stream, layer, image_rendering):
|
|||||||
with stacked(stream):
|
with stacked(stream):
|
||||||
layer.image.draw(group, image_width, image_height, image_rendering)
|
layer.image.draw(group, image_width, image_height, image_rendering)
|
||||||
pattern.draw_x_object(group.id)
|
pattern.draw_x_object(group.id)
|
||||||
stream.color_space('Pattern')
|
stream.set_color_space('Pattern')
|
||||||
stream.set_color_special(pattern.id)
|
stream.set_color_special(pattern.id)
|
||||||
if layer.unbounded:
|
if layer.unbounded:
|
||||||
x1, y1, x2, y2 = stream.page_rectangle
|
x1, y1, x2, y2 = stream.page_rectangle
|
||||||
|
@ -126,7 +126,7 @@ def draw_first_line(stream, textbox, text_overflow, block_ellipsis, matrix):
|
|||||||
|
|
||||||
utf8_text = textbox.pango_layout.text.encode()
|
utf8_text = textbox.pango_layout.text.encode()
|
||||||
previous_utf8_position = 0
|
previous_utf8_position = 0
|
||||||
stream.text_matrix(*matrix.values)
|
stream.set_text_matrix(*matrix.values)
|
||||||
last_font = None
|
last_font = None
|
||||||
string = ''
|
string = ''
|
||||||
x_advance = 0
|
x_advance = 0
|
||||||
|
@ -539,7 +539,7 @@ class Gradient:
|
|||||||
alpha_stream.transform(d=scale_y)
|
alpha_stream.transform(d=scale_y)
|
||||||
alpha_stream.stream = [f'/{alpha_shading.id} sh']
|
alpha_stream.stream = [f'/{alpha_shading.id} sh']
|
||||||
|
|
||||||
stream.shading(shading.id)
|
stream.paint_shading(shading.id)
|
||||||
|
|
||||||
def layout(self, width, height):
|
def layout(self, width, height):
|
||||||
"""Get layout information about the gradient.
|
"""Get layout information about the gradient.
|
||||||
|
@ -53,7 +53,7 @@ class Stream(pydyf.Stream):
|
|||||||
assert self._ctm_stack
|
assert self._ctm_stack
|
||||||
|
|
||||||
def transform(self, a=1, b=0, c=0, d=1, e=0, f=0):
|
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
|
self._ctm_stack[-1] = Matrix(a, b, c, d, e, f) @ self.ctm
|
||||||
|
|
||||||
def begin_text(self):
|
def begin_text(self):
|
||||||
|
@ -227,10 +227,10 @@ def draw_gradient(svg, node, gradient, font_size, opacity, stroke):
|
|||||||
shading_type, 'Gray', domain, coords, extend, function)
|
shading_type, 'Gray', domain, coords, extend, function)
|
||||||
alpha_stream.stream = [f'/{alpha_shading.id} sh']
|
alpha_stream.stream = [f'/{alpha_shading.id} sh']
|
||||||
|
|
||||||
group.shading(shading.id)
|
group.paint_shading(shading.id)
|
||||||
pattern.set_alpha(1)
|
pattern.set_alpha(1)
|
||||||
pattern.draw_x_object(group.id)
|
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)
|
svg.stream.set_color_special(pattern.id, stroke=stroke)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ def draw_pattern(svg, node, pattern, font_size, opacity, stroke):
|
|||||||
group, pattern_width, pattern_height, svg.base_url,
|
group, pattern_width, pattern_height, svg.base_url,
|
||||||
svg.url_fetcher, svg.context)
|
svg.url_fetcher, svg.context)
|
||||||
stream_pattern.draw_x_object(group.id)
|
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)
|
svg.stream.set_color_special(stream_pattern.id, stroke=stroke)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user