eclipse-capella / capella

Open Source Solution for Model-Based Systems Engineering
https://mbse-capella.org
Eclipse Public License 2.0
231 stars 95 forks source link

Faulty stroke-miterlimit values in exported SVG #2495

Open ewuerger opened 1 year ago

ewuerger commented 1 year ago

Hi,

using the Export representations as images to export diagrams as SVGs can lead to erroneous container elements in this SVG. This is normally not a problem for Document Viewers (for e.g. chrome (I suppose PDF.js) or Evince) except Adobe Acrobat Reader which is pretty popular and exposed this problem in the first place. All content that follows such a faulty SVG won't be rendered anymore while using Adobe Acrobat Reader. I also submitted a thread in the Adobe Support Community.

An _exampleexport.svg:

<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
    stroke-dasharray="none" shape-rendering="auto" font-family="'Open Sans', 'Segoe UI', 'Arial', 'sans-serif'"
    width="1680" text-rendering="auto" fill-opacity="1" contentScriptType="text/ecmascript" color-interpolation="auto"
    color-rendering="auto" preserveAspectRatio="xMidYMid meet" font-size="12"
    xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0"
    diagram:semanticRoot="platform:/resource/RCA/RCA.capella#d8c08091-485d-4f18-968c-e1b51fc07390"
    viewBox="0 0 1680 580" fill="black" stroke="black" image-rendering="auto" stroke-miterlimit="10"
    zoomAndPan="magnify" version="1.0" stroke-linecap="square" stroke-linejoin="miter" contentStyleType="text/css"
    font-style="normal" height="580" stroke-width="1" stroke-dashoffset="0" font-weight="normal" stroke-opacity="1">
    <!--Generated by the Batik Graphics2D SVG Generator-->
    <defs id="genericDefs" />
    <g>
        <g fill="rgb(197,255,166)" stroke-miterlimit="0" stroke-width="0" stroke="rgb(197,255,166)"
            stroke-linejoin="round">
              ...
        </g>
    </g>
</svg>

The problem is the invalid value "0" for stroke-miterlimit. This has no effect in when stroke-linejoin isn't set to miter, which is the case here: stroke-linejoin="round".

We added an additional step in our SVG postprocessing that removes this attribute. I just wanted to inform you about this bug.

Cheers

pcdavid commented 7 months ago

The fix was merged on Sirius Desktop. It will be available in version 7.4.0 and thus for Capella 7.0.

mypsycho commented 7 months ago

This issue is related to https://github.com/eclipse-sirius/sirius-desktop/pull/239 . It will be fixed in Sirius 7.4+.

pcdavid commented 1 month ago

This should be fixed in Capella 7.0 which is based on Sirius Desktop 7.4 with the fix.