Opened 3 weeks ago
Last modified 4 days ago
#24793 reopened enhancement
Boundaries of SVG support - Consider switching from svgsalamander to JSVG
| Reported by: | Kilkenni | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | 26.07 |
| Component: | Core | Version: | |
| Keywords: | svg | Cc: |
Description (last modified by )
While working on some icons, I've found that certain SVG features do not display properly in JOSM. Specifically, the paint-order directive described in MDN https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/paint-order is ignored.
Afaik, it is a part of the SVG2 standard, but it's quite established at this point and has been supported by modern browsers for 5+ years. Is this a problem with the SVG engine in JOSM?
If it is, it would be useful to mention this in JOSM wiki (for example, here https://josm.openstreetmap.de/wiki/Styles#Icons), pointing out that SVG2 icons are not supported.
Attachments (2)
Change History (20)
by , 3 weeks ago
| Attachment: | 2026-07-07_14-52-09.png added |
|---|
comment:1 by , 3 weeks ago
| Description: | modified (diff) |
|---|
follow-up: 3 comment:2 by , 3 weeks ago
| Resolution: | → othersoftware |
|---|---|
| Status: | new → closed |
JOSM uses SVG-Salamander for SVG support as long as Java does not support SVG directly. See https://github.com/blackears/svgSalamander for the upstream project.
comment:3 by , 3 weeks ago
Replying to stoecker:
JOSM uses SVG-Salamander for SVG support as long as Java does not support SVG directly. See https://github.com/blackears/svgSalamander for the upstream project.
So I take it, the answer is 'yes'. Salamander repo suggests that it has been in maintenance mode for years, and new features (like SVG 2 support) are unlikely.
comment:4 by , 3 weeks ago
| Resolution: | othersoftware |
|---|---|
| Status: | closed → reopened |
| Summary: | Boundaries of SVG support → Boundaries of SVG support - Consider switching from svgsalamander to JSVG |
Probably a switch to https://github.com/weisJ/jsvg would be an option. A few places in ImageProvider and one function in ImageResource would need to be adapted. Seems pretty straightforward.
Patches welcome.
follow-up: 6 comment:5 by , 3 weeks ago
| Milestone: | → 26.07 |
|---|
Hmm, can anyone test? Seems to work as far as I can see.
A bunch of new warnings for some SVGs (LoaderContext needs to be extended with file name information for log).
comment:6 by , 3 weeks ago
Replying to stoecker:
Hmm, can anyone test? Seems to work as far as I can see.
A bunch of new warnings for some SVGs (LoaderContext needs to be extended with file name information for log).
Woah. That was fast.
Kudos to you!
(I don't know how to test a patch yet, can you point me in the right direction?)
follow-up: 8 comment:7 by , 2 weeks ago
Try https://tmp.gnssonline.eu/josm-custom.jar (temporary, will be deleted soon) for a version including that change.
comment:8 by , 11 days ago
Replying to stoecker:
Try https://tmp.gnssonline.eu/josm-custom.jar (temporary, will be deleted soon) for a version including that change.
Thanks. I've checked it with an icon using paint-order, and it is now displayed correctly! Previous icons at a glance also render properly.
Funnily enough, your patched JOSM version has a more up-to-date SVG engine than KDE Plasma (which still has no implementation for SVG2) ;)
comment:9 by , 10 days ago
| Keywords: | svg added |
|---|
comment:13 by , 8 days ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Seems a few tests need to be checked any probably the test images must be renewed.
comment:14 by , 7 days ago
@gaben (or anybody else):
If you can help fixing the tests I'd welcome that.
comment:15 by , 7 days ago
When is the release planned?
(Also I have around 10 patches prepared and multiple not yet published plugins in the works. Also a new module with a pipeline and probably more. My Master's thesis will be one of them.)
comment:16 by , 7 days ago
I try to get it out end of the month. But I tried that last month as well. At least I got some stuff done.
I hope that I fixed the MapPaintSettings based test issues and the current issues are only slight differences due to SVGSalamander→JSVG (or maybe also the improved icons). Probably remaking the reference images will solve them. Probably...
Thought finding and fixing them is time consuming, because I find the JUnit test result presentation really really awful.
Good luck for your thesis. I'm currently a secondary reviewer for a bachelor's thesis. :-)
comment:17 by , 4 days ago
Got a few new SVG images that the API provider wanted me to use in [my plugin https://wiki.openstreetmap.org/wiki/NL:PDOKTerugmelding] instead of the old ones, but they showed a black background with the old SVGSalamander which is not how they were supposed to look like.
Just noticed this switch to JSVG and the images look as expected now.
Don't see any other glitches, so OK for me.
Images I'm using here are from: https://www.verbeterdekaart.nl/ , using the legend in the left bottom corner you can easily find the images like: https://www.verbeterdekaart.nl/assets/icons/terugmelding/nieuw.svg
I'll hold on with releasing a new version of the plugin until the new JOSM is released.
comment:18 by , 4 days ago
In case you can help with the broken unit tests, a fast release gets more likely. At the moment it is very hard for me to find time for JOSM.



Example of an icon using paint-order directive in its SVG. Other icons nearby do not use paint-order.