pypi svglib 2.2.0
svglib 2.2.0

5 hours ago

Tooling and housekeeping

  • Modernized type annotations across src/svglib/ and tests/ to use PEP
    585 builtin generics (list[...], dict[...], tuple[...], set[...])
    instead of typing.List/Dict/Tuple/Set, and simplified a few
    emptiness/membership checks (not points instead of len(points) == 0,
    a set literal instead of a list for in checks). No behavior change.
  • Silenced a UserWarning from test_convert_pdf_png that came from
    ReportLab's own renderPM.drawImage, not from svglib: it reopens a
    <image> file referenced by path and converts it straight to RGB without
    normalizing palette-with-transparency PNGs first, unlike svglib's own
    handling of base64-embedded images. The referenced PNG (a dedicated
    tRNS-chunk test fixture) still renders correctly; there was nothing to fix
    in svglib's output.

Fixed

  • font-size no longer has PX_TO_PT applied twice. The viewport group
    already carries the conversion, but String.fontSize and the advance widths
    used to position text fragments were converted to points as well. Text
    therefore rendered at 0.75x the size of the geometry in the same document,
    and multi-tspan runs were laid out in the wrong unit (issue #502). Both now
    stay in user units, like every other coordinate below the transform.
    String.fontSize in the shape tree is in user units accordingly; multiply by
    the enclosing group's transform to get the rendered size.

Don't miss a new svglib release

NewReleases is sending notifications on new releases.