Commons:Requests for comment/Technical needs survey/Fix rsvg text alignment regression
Jump to navigation
Jump to search
Fix rsvg text alignment regression
[edit]Description of the Problem
[edit]- Problem description:
The latest thumbnail-image-maker (named rsvg) unfortunately has a bug which misaligns centre- or right-aligned text
tags containing tspan
tags on the same line. Many existing files have been affected.
- Proposal type: bugfix
/ feature request / process request - Proposed solution:
Fix rsvg or use a version without the bug.
- Phabricator ticket:
http://phabricator.wikimedia.org/T97233
- Further remarks:
@Glrx: described the root cause as follows:
“ | The problem is computing the width of an SVG "text chunk". If the text chunk consists of multiple XML nodes, then librsvg is using the width of the last node as the width of the entire text chunk. (librsvg is correctly tossing out the initial and final whitespace for the text element.) | ” |
Discussion
[edit]- I wonder if this is the bug that affected the text alignment of BABT Green Dot label.svg and BABT Red Triangle label.svg? The old versions (before I had to improvise a fix) worked correctly until mid-2022. --Minoa (talk) 06:40, 22 December 2023 (UTC)
- Yes, User:Minoa, I think that is the same problem. Having
<tspan font-size="18">APPROVED</tspan>
embedded in a<text>
specification falls prey to this bug. RCraig09 (talk) 07:12, 22 December 2023 (UTC)
- Yes, User:Minoa, I think that is the same problem. Having
- Strong support: this has to be fixed, because the problem affected two of my uploads and the made centring of text with different font sizes tedious. --Minoa (talk) 03:18, 24 December 2023 (UTC)
- Thanks, @Minoa: not just tedious but strictly impossible, if the specified font is unavailable and another is substituted. cmɢʟee ⋅τaʟκ 01:36, 25 December 2023 (UTC)
- I personally recommend changing to a fasterer and less buggy renderer, see phab:T40010, in more details can be found at: User:JoKalliauer/SVG_test_suites — Johannes Kalliauer - Talk | Contributions 14:16, 25 December 2023 (UTC)
- Thanks, @Minoa: not just tedious but strictly impossible, if the specified font is unavailable and another is substituted. cmɢʟee ⋅τaʟκ 01:36, 25 December 2023 (UTC)
- Comment This issue is not a problem with
rsvg
but rather WMF's development practices that use out-of-date software. Many years ago, Gnome (the developers ofrsvg
, rewrotersvg
in Rust (a programming language). WMF did not switch to the Rust version but rather continued to use the C++ version. The C++ version was no longer the primary focus of Gnome, but it did receive some important updates. One of those updates fixed the "text chunk" bug about 3 years ago for both the (actively supported) Rust and the (moribund) C++ versions. WMF was often updating the C++ version ofrsvg
, so the "text chunk" problem was fixed. WMF was using an ancient operating system image. In April 2023, WMF updated the operating system image, but it went from an ancient image to a (IIRC) 5-year-old image. The old version of the operating system now supported Rust and had a preloaded (but 5-year-old) Rust version ofrsvg
. Consequently, WMF effectively reverted to a much older Rust version and reintroduced the above "text chunk" issue. Glrx (talk) 17:23, 19 January 2024 (UTC)
Votes
[edit]- Strong support In practical terms: This bug causes
<text>
elements containing<tspan >
sub-elements (for subscripting, italicizing, boldfacing, coloring, font-sizing, etc.) to be rendered in the wrong place in Wikipedia thumbnails and on Commons file description pages—despite rendering properly within browsers during development. Example: text that should be centered on the page, runs off the right margin. Over years, this bug has required me to revise a few dozen .svg images to specify all attributes within each<text>
element, or even to compromise content to work around rendering problems. RCraig09 (talk) 06:32, 21 December 2023 (UTC)
- Strong support I have come across SVGs here on Commons where the author converted the text to paths as a
kludgeworkaround for this problem, increasing the file size 10x. - Wikkiwonkk (talk) 16:17, 29 December 2023 (UTC) - Support as a graphist from COM:GLI --痛Designism (talk) 18:46, 30 December 2023 (UTC)
- Yes, assuming this amounts to installing a known patch. Maybe not if this is a ton of dev work. - Jmabel ! talk 23:49, 21 January 2024 (UTC)
- Support Pi.1415926535 (talk) 23:33, 22 January 2024 (UTC)
- Support -- Schlurcher (talk) 13:45, 23 January 2024 (UTC)
- Confirming strong support for the purposes of the voting stage. --Minoa (talk) 06:21, 28 January 2024 (UTC)
- Support SWinxy (talk) 02:53, 6 February 2024 (UTC)
- Support. --Donald Trung 『徵國單』 (No Fake News 💬) (WikiProject Numismatics 💴) (Articles 📚) 00:45, 14 February 2024 (UTC)
- Support Glrx (talk) 03:06, 14 February 2024 (UTC)
- Strong support, this regression causes misrenderings in thumbnails, including those of chemical structures. Alfa-ketosav (talk) 11:34, 27 March 2024 (UTC)