Skip to content

Problem with rendering text #427

Open

Description

@vincentfpgarcia

Here is an input SVG image: https://upload.wikimedia.org/wikipedia/commons/7/7d/Roll_pitch_yaw_mnemonic.svg

When rendering it, the text is off:

output_cairosvg

The SVG code contains 2 tspan tags nested within a text tag.
By removing one tspan, the text displays correctly.

As pointed https://stackoverflow.com/questions/78807441/problem-with-text-rendering-using-cairosvg/78807953?noredirect=1#comment138959543_78807953, the problem might come from a bug in the interpretation of the text-anchor: middle style.

Activity

  1. liZe commented on Jul 31, 2024

    @liZe
    Member

    the problem might come from a bug in the interpretation of the text-anchor: middle style.

    Yes, that’s exactly the problem.

    As the bug doesn’t happen in WeasyPrint, that uses a code that’s close to CairoSVG’s code, I think that it’s fixed by Kozea/WeasyPrint@1460522 in WeasyPrint.

    Would you like to try to backport it?

  2. Pandaaaa906 commented on Oct 22, 2026

    @Pandaaaa906

    related issue: #317
    related pr: #408

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions