Modify

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 Kilkenni)

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)

2026-07-07_14-52-09.png (7.0 KB ) - added by Kilkenni 3 weeks ago.
Example of an icon using paint-order directive in its SVG. Other icons nearby do not use paint-order.
24793.patch (13.5 KB ) - added by stoecker 3 weeks ago.
Switch to jsvg

Download all attachments as: .zip

Change History (20)

by Kilkenni, 3 weeks ago

Attachment: 2026-07-07_14-52-09.png added

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

comment:1 by Kilkenni, 3 weeks ago

Description: modified (diff)

comment:2 by stoecker, 3 weeks ago

Resolution: othersoftware
Status: newclosed

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.

in reply to:  2 comment:3 by Kilkenni, 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 stoecker, 3 weeks ago

Resolution: othersoftware
Status: closedreopened
Summary: Boundaries of SVG supportBoundaries 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.

comment:5 by stoecker, 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).

by stoecker, 3 weeks ago

Attachment: 24793.patch added

Switch to jsvg

in reply to:  5 comment:6 by Kilkenni, 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?)

Last edited 3 weeks ago by Kilkenni (previous) (diff)

comment:7 by stoecker, 2 weeks ago

Try https://tmp.gnssonline.eu/josm-custom.jar (temporary, will be deleted soon) for a version including that change.

in reply to:  7 comment:8 by Kilkenni, 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 gaben, 10 days ago

Keywords: svg added

comment:10 by stoecker, 8 days ago

Resolution: fixed
Status: reopenedclosed

In 19586/josm:

fix #24793 - drop svgsalamaner and use JSVG instead

comment:11 by stoecker, 8 days ago

In 19587/josm:

fix #24793 - drop old code in test

comment:12 by stoecker, 8 days ago

In 19588/josm:

fix #24793 - checkstyle warnings

comment:13 by stoecker, 8 days ago

Resolution: fixed
Status: closedreopened

Seems a few tests need to be checked any probably the test images must be renewed.

comment:14 by stoecker, 7 days ago

@gaben (or anybody else):

If you can help fixing the tests I'd welcome that.

comment:15 by gaben, 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 stoecker, 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 SanderH, 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 stoecker, 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user. Next status will be 'new'.
Next status will be 'needinfo'. The owner will be changed from team to Kilkenni.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.