Here is the issue labelling why that this is broken pixelDensity(2) with SVG creates incorrect viewport in the file · Issue #693 · processing/processing4 · GitHub I’ve added some more labels to hopefully move this forward.
Current workaround
pixelDensity(1)
in the setup()
function to force Processing to render at low-dpi scaling.