Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-weasyprint for openSUSE:Factory checked in at 2025-03-12 15:27:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-weasyprint (Old) and /work/SRC/openSUSE:Factory/.python-weasyprint.new.19136 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-weasyprint" Wed Mar 12 15:27:41 2025 rev:18 rq:1252394 version:64.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-weasyprint/python-weasyprint.changes 2025-02-11 21:25:27.692327668 +0100 +++ /work/SRC/openSUSE:Factory/.python-weasyprint.new.19136/python-weasyprint.changes 2025-03-12 15:27:45.591572986 +0100 @@ -1,0 +2,12 @@ +Wed Mar 5 10:07:13 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to 64.1 + * #2368: Fix ascent and descent font values + * #2370: Avoid endless recursion for variables in nested functions + * #2275: Use correct containing block to render waiting children + * #2375: Ensure that we handle text-anchor only on text content elements + * #2090: Only create font temporary folder when adding fonts + * #2383: Fix grid-template-areas validation and allow uppercase + identifiers for grid lines + +------------------------------------------------------------------- Old: ---- weasyprint-64.0.tar.gz New: ---- weasyprint-64.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-weasyprint.spec ++++++ --- /var/tmp/diff_new_pack.m4UwYD/_old 2025-03-12 15:27:46.439608503 +0100 +++ /var/tmp/diff_new_pack.m4UwYD/_new 2025-03-12 15:27:46.439608503 +0100 @@ -29,7 +29,7 @@ %{?sle15_python_module_pythons} Name: python-weasyprint -Version: 64.0 +Version: 64.1 Release: 0 Summary: Python module to convert web documents to PDF License: BSD-3-Clause ++++++ weasyprint-64.0.tar.gz -> weasyprint-64.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/PKG-INFO new/weasyprint-64.1/PKG-INFO --- old/weasyprint-64.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/weasyprint-64.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 2.3 +Metadata-Version: 2.4 Name: weasyprint -Version: 64.0 +Version: 64.1 Summary: The Awesome Document Factory Keywords: html,css,pdf,converter Author-email: Simon Sapin <simon.sa...@exyr.org> @@ -25,6 +25,7 @@ Classifier: Topic :: Text Processing :: Markup :: HTML Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion Classifier: Topic :: Printing +License-File: LICENSE Requires-Dist: pydyf >=0.11.0 Requires-Dist: cffi >=0.6 Requires-Dist: tinyhtml5 >=2.0.0b1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/docs/changelog.rst new/weasyprint-64.1/docs/changelog.rst --- old/weasyprint-64.0/docs/changelog.rst 2025-01-30 17:19:13.432614600 +0100 +++ new/weasyprint-64.1/docs/changelog.rst 2025-02-20 11:02:47.334339100 +0100 @@ -2,6 +2,54 @@ ========= +Version 64.1 +------------ + +Released on 2025-02-20. + +Bug fixes: + +* `#2368 <https://github.com/Kozea/WeasyPrint/issues/2368>`_: + Fix ascent and descent font values +* `#2370 <https://github.com/Kozea/WeasyPrint/issues/2370>`_: + Avoid endless recursion for variables in nested functions +* `#2275 <https://github.com/Kozea/WeasyPrint/issues/2275>`_: + Use correct containing block to render waiting children +* `#2375 <https://github.com/Kozea/WeasyPrint/issues/2375>`_: + Ensure that we handle text-anchor only on text content elements +* `#2090 <https://github.com/Kozea/WeasyPrint/issues/2090>`_: + Only create font temporary folder when adding fonts +* `#2383 <https://github.com/Kozea/WeasyPrint/issues/2383>`_: + Fix grid-template-areas validation and allow uppercase identifiers for grid lines + +Contributors: + +* Guillaume Ayoub + +Backers and sponsors: + +* Spacinov +* Kobalt +* Grip Angebotssoftware +* Syslifters +* Simon Sapin +* Manuel Barkhau +* Simonsoft +* Menutech +* KontextWork +* TrainingSparkle +* Healthchecks.io +* Hammerbacher +* DocRaptor +* Yanal-Yves Fargialla +* Method B +* FieldHub +* Morntag +* Xavid +* Kai DeLorenzo +* Charlie S. + + Version 64.0 ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/tests/css/test_validation.py new/weasyprint-64.1/tests/css/test_validation.py --- old/weasyprint-64.0/tests/css/test_validation.py 2025-01-30 17:19:13.433614500 +0100 +++ new/weasyprint-64.1/tests/css/test_validation.py 2025-02-20 11:02:47.335339300 +0100 @@ -941,6 +941,8 @@ (('title', 'board'), ('stats', 'board'))), ('". a" "b a" ".a"', ((None, 'a'), ('b', 'a'), (None, 'a'))), + ('"a b b" "c b b" "d e f"', + (('a', 'b', 'b'), ('c', 'b', 'b'), ('d', 'e', 'f'))), )) def test_grid_template_areas(rule, value): assert get_value(f'grid-template-areas: {rule}') == value @@ -962,12 +964,12 @@ @pytest.mark.parametrize('rule, value', ( ('auto', 'auto'), ('4', (None, 4, None)), - ('C', (None, None, 'c')), + ('C', (None, None, 'C')), ('4 c', (None, 4, 'c')), ('col -4', (None, -4, 'col')), ('span c 4', ('span', 4, 'c')), ('span 4 c', ('span', 4, 'c')), - ('4 span c', ('span', 4, 'c')), + ('4 span C', ('span', 4, 'C')), ('super 4 span', ('span', 4, 'super')), )) def test_grid_line(rule, value): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/tests/css/test_variables.py new/weasyprint-64.1/tests/css/test_variables.py --- old/weasyprint-64.0/tests/css/test_variables.py 2025-01-30 17:19:13.433614500 +0100 +++ new/weasyprint-64.1/tests/css/test_variables.py 2025-02-20 11:02:47.335339300 +0100 @@ -489,6 +489,21 @@ @assert_no_logs +def test_variable_in_nested_function(): + page, = render_pages(''' + <style> + body { --var: 255 0 0 } + div { background-image: linear-gradient(rgba(var(--var))) } + </style> + <div></div> + ''') + html, = page.children + body, = html.children + div, = body.children + assert div.style['background_image'][0][1].colors[0] == (1, 0, 0, 1) + + +@assert_no_logs def test_variable_in_function_multiple_values(): page, = render_pages(''' <style> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/tests/draw/svg/test_text.py new/weasyprint-64.1/tests/draw/svg/test_text.py --- old/weasyprint-64.0/tests/draw/svg/test_text.py 2025-01-30 17:19:13.434614400 +0100 +++ new/weasyprint-64.1/tests/draw/svg/test_text.py 2025-02-20 11:02:47.336339200 +0100 @@ -365,6 +365,26 @@ @assert_no_logs +def test_text_tspan_anchor_non_text(assert_pixels): + # Regression test for https://github.com/Kozea/WeasyPrint/issues/2375 + assert_pixels(''' + _______BBBBBB_______ + _______BBBBBB_______ + ''', ''' + <style> + @page { size: 20px 2px } + svg { display: block } + </style> + <svg width="20px" height="2px" text-anchor="end" + xmlns="http://www.w3.org/2000/svg"> + <text x="10" y="10" font-family="weasyprint" font-size="2" text-anchor="start"> + <tspan x="10" y="1.5" text-anchor="middle" fill="blue">ABC</tspan> + </text> + </svg> + ''') + + +@assert_no_logs def test_text_rotate(assert_pixels): assert_pixels(''' __RR__RR__RR________ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/tests/layout/test_inline.py new/weasyprint-64.1/tests/layout/test_inline.py --- old/weasyprint-64.0/tests/layout/test_inline.py 2025-01-30 17:19:13.436614500 +0100 +++ new/weasyprint-64.1/tests/layout/test_inline.py 2025-02-20 11:02:47.338339300 +0100 @@ -1102,3 +1102,17 @@ assert block_ltr.position_x == block_rtl.position_x assert line_ltr.position_x == line_rtl.position_x assert text_ltr.position_x == text_rtl.position_x + + +@assert_no_logs +def test_nested_waiting_children_width(): + # Regression test for https://github.com/Kozea/WeasyPrint/issues/2275 + page, = render_pages( + '<body style="width: 3em; font-family: weasyprint">' + '<b><i style="width: 100%">a b</i>c') + html, = page.children + body, = html.children + line1, line2 = body.children + assert line1.children[0].children[0].children[0].text == 'a' + assert line2.children[0].children[0].children[0].text == 'b' + assert line2.children[0].children[1].text == 'c' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/tests/test_pdf.py new/weasyprint-64.1/tests/test_pdf.py --- old/weasyprint-64.0/tests/test_pdf.py 2025-01-30 17:19:13.439614500 +0100 +++ new/weasyprint-64.1/tests/test_pdf.py 2025-02-20 11:02:47.340339400 +0100 @@ -742,3 +742,12 @@ pdf_bytes = pdf_document.write_pdf( pdf_variant='pdf/a-3b', pdf_identifier=b'example-bytes', uncompressed_pdf=True) assert b'TEST_METADATA' in pdf_bytes + + +@assert_no_logs +def test_font_descent_ascent(): + pdf = FakeHTML(string=''' + <html style="font-family: weasyprint">abc + ''').write_pdf() + assert b'/Descent -200' in pdf + assert b'/Ascent 800' in pdf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/__init__.py new/weasyprint-64.1/weasyprint/__init__.py --- old/weasyprint-64.0/weasyprint/__init__.py 2025-01-30 17:19:13.439614500 +0100 +++ new/weasyprint-64.1/weasyprint/__init__.py 2025-02-20 11:02:47.341339300 +0100 @@ -15,7 +15,7 @@ import tinycss2 import tinyhtml5 -VERSION = __version__ = '64.0' +VERSION = __version__ = '64.1' #: Default values for command-line and Python API options. See #: :func:`__main__.main` to learn more about specific options for diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/css/__init__.py new/weasyprint-64.1/weasyprint/css/__init__.py --- old/weasyprint-64.0/weasyprint/css/__init__.py 2025-01-30 17:19:13.440614500 +0100 +++ new/weasyprint-64.1/weasyprint/css/__init__.py 2025-02-20 11:02:47.341339300 +0100 @@ -581,7 +581,7 @@ if token.lower_name != 'var': arguments = [] for i, argument in enumerate(token.arguments): - if argument.type == 'function' and argument.lower_name == 'var': + if argument.type == 'function': arguments.extend(resolve_var(computed, argument, parent_style)) else: arguments.append(argument) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/css/validation/properties.py new/weasyprint-64.1/weasyprint/css/validation/properties.py --- old/weasyprint-64.0/weasyprint/css/validation/properties.py 2025-01-30 17:19:13.441614600 +0100 +++ new/weasyprint-64.1/weasyprint/css/validation/properties.py 2025-02-20 11:02:47.342339500 +0100 @@ -1598,11 +1598,13 @@ return areas.add(area) coordinates.add((x, y)) - nx = x + 1 + nx = x for nx, narea in enumerate(row[x+1:], start=x+1): if narea != area: break coordinates.add((nx, y)) + else: + nx += 1 for ny, nrow in enumerate(grid_areas[y+1:], start=y+1): if set(nrow[x:nx]) == {area}: for nnx in range(x, nx): @@ -1624,7 +1626,7 @@ if keyword == 'auto': return keyword elif keyword != 'span': - return (None, None, keyword) + return (None, None, token.value) elif token.type == 'number' and token.is_integer and token.value: return (None, token.int_value, None) return @@ -1638,7 +1640,7 @@ span = 'span' continue elif keyword and ident is None: - ident = keyword + ident = token.value continue elif token.type == 'number' and token.is_integer and token.value: if number is None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/layout/inline.py new/weasyprint-64.1/weasyprint/layout/inline.py --- old/weasyprint-64.0/weasyprint/layout/inline.py 2025-01-30 17:19:13.443614700 +0100 +++ new/weasyprint-64.1/weasyprint/layout/inline.py 2025-02-20 11:02:47.345339500 +0100 @@ -782,7 +782,7 @@ if new_position_x > max_x and not trailing_whitespace: previous_resume_at = _break_waiting_children( - context, box, max_x, bottom_space, initial_skip_stack, + context, containing_block, max_x, bottom_space, initial_skip_stack, absolute_boxes, fixed_boxes, line_placeholders, waiting_floats, line_children, children, waiting_children) if previous_resume_at: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/pdf/fonts.py new/weasyprint-64.1/weasyprint/pdf/fonts.py --- old/weasyprint-64.0/weasyprint/pdf/fonts.py 2025-01-30 17:19:13.444614600 +0100 +++ new/weasyprint-64.1/weasyprint/pdf/fonts.py 2025-02-20 11:02:47.346339500 +0100 @@ -70,12 +70,12 @@ # Set ascent and descent. if self.font_size: pango_metrics = pango.pango_font_get_metrics(pango_font, ffi.NULL) - self.ascent = int( - pango.pango_font_metrics_get_ascent(pango_metrics) / - self.font_size * 1000) - self.descent = -int( - pango.pango_font_metrics_get_descent(pango_metrics) / - self.font_size * 1000) + self.ascent = int(round( + pango.pango_font_metrics_get_ascent(pango_metrics) * FROM_UNITS / + self.font_size * 1000)) + self.descent = -int(round( + pango.pango_font_metrics_get_descent(pango_metrics) * FROM_UNITS / + self.font_size * 1000)) else: self.ascent = self.descent = 0 @@ -128,7 +128,7 @@ if 'wght' not in self.variations: self.variations['wght'] = self.weight if 'opsz' not in self.variations: - self.variations['opsz'] = self.font_size * FROM_UNITS + self.variations['opsz'] = self.font_size if 'slnt' not in self.variations: slnt = 0 if self.style == 1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/svg/__init__.py new/weasyprint-64.1/weasyprint/svg/__init__.py --- old/weasyprint-64.0/weasyprint/svg/__init__.py 2025-01-30 17:19:13.445614600 +0100 +++ new/weasyprint-64.1/weasyprint/svg/__init__.py 2025-02-20 11:02:47.346339500 +0100 @@ -444,14 +444,14 @@ if new_ctm.determinant: self.stream.transform(*(old_ctm @ new_ctm.invert).values) - # Handle text anchor - if (text_anchor := node.get('text-anchor')) in ('middle', 'end'): - group = self.stream.add_group(0, 0, 0, 0) # BBox set after drawing - original_streams.append(self.stream) - self.stream = group - - # Set text bounding box + # Handle text anchor and set text bounding box + text_anchor_shift = False if node.display and TAGS.get(node.tag) == text: + if (text_anchor := node.get('text-anchor')) in ('middle', 'end'): + text_anchor_shift = True + group = self.stream.add_group(0, 0, 0, 0) # BBox set after drawing + original_streams.append(self.stream) + self.stream = group node.text_bounding_box = EMPTY_BOUNDING_BOX # Save concrete size of root svg tag @@ -467,11 +467,11 @@ # Draw node children if node.display and node.tag not in DEF_TYPES: for child in node: - if text_anchor in ('middle', 'end'): + if text_anchor_shift: new_stream = self.stream self.stream = original_streams[-1] self.draw_node(child, font_size, fill_stroke) - if text_anchor in ('middle', 'end'): + if text_anchor_shift: self.stream = new_stream visible_text_child = ( TAGS.get(node.tag) == text and @@ -491,7 +491,7 @@ self.tree.set_svg_size(svg, concrete_width, concrete_height) # Handle text anchor - if text_anchor in ('middle', 'end'): + if text_anchor_shift: group_id = self.stream.id self.stream = original_streams.pop() self.stream.push_state() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/weasyprint-64.0/weasyprint/text/fonts.py new/weasyprint-64.1/weasyprint/text/fonts.py --- old/weasyprint-64.0/weasyprint/text/fonts.py 2025-01-30 17:19:13.446614700 +0100 +++ new/weasyprint-64.1/weasyprint/text/fonts.py 2025-02-20 11:02:47.347339600 +0100 @@ -103,7 +103,7 @@ fontconfig.FcConfigDestroy(self._config) # Temporary folder storing fonts. - self._folder = Path(mkdtemp(prefix='weasyprint-')) + self._folder = None def add_font_face(self, rule_descriptors, url_fetcher): """Add a font face to the Fontconfig configuration.""" @@ -111,6 +111,8 @@ # Define path where to save font, depending on the rule descriptors. config_key = str(rule_descriptors) config_digest = md5(config_key.encode(), usedforsecurity=False).hexdigest() + if self._folder is None: + self._folder = Path(mkdtemp(prefix='weasyprint-')) font_path = self._folder / config_digest if font_path.exists(): # Font already exists, we have nothing more to do. @@ -233,7 +235,8 @@ def __del__(self): """Clean a font configuration for a document.""" - rmtree(self._folder, ignore_errors=True) + if self._folder: + rmtree(self._folder, ignore_errors=True) def font_features(font_kerning='normal', font_variant_ligatures='normal',