Kozea / Kozea/CairoSVG

Problem with rendering text

Open
#427 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
951
Forks
166
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/user-attachments/assets/c798bc2d-f8e9-4f0d-a2eb-195fd1905a4c)

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](here), the problem might come from a bug in the interpretation of the `text-anchor: middle` style.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Roll_pitch_yaw_mnemonic.svg and compare its nested tspan elements with the attached output. Trace how text-anchor: middle is handled during rendering; done means the original SVG displays its text correctly without removing a tspan.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.