Commons:Graphics village pump/November 2023
The svg is valid according to Validator.nu and is rendered flawlessly by Chrome, Firefox, and https://svgcheck.toolforge.org/index.php, which states "This image was rendered using rsvg-convert version 2.40.21, almost certainly the same version as in use on Wikimedia wikis."
Still, the text in the automatically generated PNGs is grossly misplaced. I have resized a screenshot to ×ばつ318. How can I use that PNG as a substitute for the rsvg-generated ones? --Rainald62 (talk) 21:30, 13 November 2023 (UTC)
- @Rainald62: WMF renders the image using the 5 year old
librsvg v 2.44.10
. That version has a bug with centered and right aligned text. That bug was fixed in the more recentlibrsvg v2.40
. Glrx (talk) 21:35, 13 November 2023 (UTC)- @Rainald62: I have worked around this problem by avoiding <tspan> elements completely. I now use separate <text> elements, and specify attributes (especially "x=" and "y=" attributes) inside each <text ...> element. RCraig09 (talk) 22:22, 13 November 2023 (UTC)
- You can still use tspan as long as you specify x – the bug arises when there are multiple non-left-justified tspan on a line with x unspecified. It might be better to keep related tspan together as styling their parent text keeps their appearance consistent. cmɢʟee ⋅τaʟκ 23:45, 13 November 2023 (UTC)
- @RCraig09: <tspan> elements nicely fit together and keep doing so on a change of font, while separately positioned <text> elements could overlap or leave gaps.
- @Glrx: Do you really mean that v2.40 is more recent than v2.44? Because svgcheck uses another version as WMF, I had to do experiments by uploading several versions.
- The latest experiment (00:34) was a copy of the original file from User:DeWikiMan. It is also not converted properly to PNG. Obviously, there was a regression in PNG generation since the original version had been uploaded in 2018.
- I reverted to my first version, which (viewed as svg) is the best one. Just ignore the bad thumbnail PNG. WMF has enough money to fix the problem. --Rainald62 (talk) 00:26, 14 November 2023 (UTC)
- @Rainald62:
- Yes, I really mean it. Version 2.44.10 is an early release of the Rust language conversion. It is older than the most recent version of 2.40, the last release of the C++ version. WMF should be running version 2.50 or later. WMF's "update" in April 2023 introduced a few regression errors.
- I would not modify SVG files to work around this problem. WMF should run more recent versions of
librsvg
. - Glrx (talk) 01:39, 14 November 2023 (UTC)
- Thanks for the clarification and the endordsement not to work around. Who can clean up the file's version history (delete all but the first two versions)? --Rainald62 (talk) 08:40, 14 November 2023 (UTC)
- @Rainald62: Inkscape makes the .svg text files too long and complicated. I still think the simplest solution is to simplify <text> specifications as I do in File:1880- Global average sea level rise (SLR) - annually.svg, though it requires manual text editing. Whatever your approach, good luck! (I don't know who to ask, to remove unwanted versions; it usually isn't done. Maybe open a separate section here on the Village Pump if it's important to remove earlier versions.) RCraig09 (talk) 17:27, 14 November 2023 (UTC)
- Nice code. I won't further edit the Inkscape mess. I won't proceed at all without an idea how to get "CO2" with subscript and 90° rotation. Here is what I tried: File:Test workaround.svg (some comment lines contain the test result for the previous version). Feel free to continue. --Rainald62 (talk) 17:41, 14 November 2023 (UTC)
- I removed unnecessary
#text
nodes; a newline after atspan
element exacerbates the issue. Unicode subscripts can be used for carbon dioxide: CO2 → CO2, but it is not needed here because thelibrsvg
bug has little impact on the placement of the text. Glrx (talk) 19:00, 14 November 2023 (UTC)
- I removed unnecessary
- Nice code. I won't further edit the Inkscape mess. I won't proceed at all without an idea how to get "CO2" with subscript and 90° rotation. Here is what I tried: File:Test workaround.svg (some comment lines contain the test result for the previous version). Feel free to continue. --Rainald62 (talk) 17:41, 14 November 2023 (UTC)
- @Rainald62: Inkscape makes the .svg text files too long and complicated. I still think the simplest solution is to simplify <text> specifications as I do in File:1880- Global average sea level rise (SLR) - annually.svg, though it requires manual text editing. Whatever your approach, good luck! (I don't know who to ask, to remove unwanted versions; it usually isn't done. Maybe open a separate section here on the Village Pump if it's important to remove earlier versions.) RCraig09 (talk) 17:27, 14 November 2023 (UTC)
- Thanks for the clarification and the endordsement not to work around. Who can clean up the file's version history (delete all but the first two versions)? --Rainald62 (talk) 08:40, 14 November 2023 (UTC)
What is exactly wrong with these inkscape SVGs? Server won't render SVGs in file description or scaled-down alternatives - reports "Error Our servers are currently under maintenance..." (Request from <redacted-ip> via cp3075 cp3075, Varnish XID 42369810
Upstream caches: cp3075 int Error: 429, Too Many Requests at 2023年11月18日 19:29:00 GMT
). But if I press to proceed directly to file, it shows correctly. Other, similar-sized and similar-loaded, SVGs are fine. Retired electrician (talk) 19:39, 18 November 2023 (UTC)
The text in the original version of this svg file displays correctly:
https://upload.wikimedia.org/wikipedia/commons/6/6c/Leukotriene_B4_hydroxylation.svg
But the none of the thumb nail version display correctly (one of the hydroxyl groups (OH) is not displayed and the OH from the carboxylic acid (-C(=O)-OH)) has been moved next to carbonyl (C=OHOHO). Note that the original was created in ChemDraw, exported as an eps file then imported into Inkscape where is looked OK and then saved as a svg file. Any idea on how to get this to work? This is one of several svg files that I had similar problems. Thanks. Boghog (talk) 11:06, 26 November 2023 (UTC)
- Sigh. IIRC, the WMF rasterizer does not support
x
attributes with multiple values (e.g.,x="12.45 20.23"
). See Commons:Commons SVG Checker and Phab:T35245. <text transform="matrix(1,0,0,-1,151.5,53.35)" style="font-variant:normal;font-weight:normal;font-size:10px;font-family:Helvetica;-inkscape-font-specification:Helvetica;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" id="text328"><tspan x="0" y="0" id="tspan322">O</tspan><tspan x="12.45 20.23" y="21.549999" sodipodi:role="line" id="tspan324">OH</tspan><tspan x="-49.099998 -41.32" y="-0.34999999" sodipodi:role="line" id="tspan326">OH</tspan></text>
- I deleted all the subsequent (and unneeded) coordinates to make it display better.
- In addition, the SVG is poor: the symbols should be separate text elements.
- Glrx (talk) 19:05, 26 November 2023 (UTC)
- Thanks for the corrections and the explanation! I also wasn't aware of the Commons:Commons SVG Checker. Cheers. Boghog (talk) 19:53, 27 November 2023 (UTC)