EtheaDev / SVGIconImageList

Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
Apache License 2.0
321 stars 93 forks source link

SVG text not parsed correctly in Delphi 10.4 #180

Closed svangogh1 closed 3 years ago

svangogh1 commented 3 years ago

After upgrading a project from Delphi 10.1 to Delphi 10.4.2 we noticed that the svg text of certain icons was not parsed correctly anymore. It looks like css style classes are ignored. For example the following text produces an icon in 10.1 and a black square in 10.4.2:

<?xml version="1.0" `encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve">
<style type="text/css">
    .st0{fill:none;stroke:#324E83;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1;}
    .st1{opacity:0.5;fill:none;stroke:#324E83;stroke-linejoin:round;stroke-miterlimit:1;enable-background:new    ;}
</style>
<path class="st0" d="M16.3,19.5v-18H1.5v18H16.3z"/>
<path class="st1" d="M5.2,12.8H4.1 M3.1,12.8H2 M7.3,12.8H6.2 M9.4,12.8H8.4 M11.5,12.8h-1.1 M13.7,12.8h-1.1 M15.8,12.8h-1.1
     M12.1,6.5v1.1 M12.1,4.3v1.1 M12.1,2v1.1 M12.1,8.8V10 M12.1,11.1v1.1 M12.1,13.4v1.1 M12.1,15.6v1.1 M12.1,17.9V19"/>
</svg>
carloBarazzetta commented 3 years ago

Take care of the engine you are using. Into SVGIconImageList.inc you can switch between native TSVG engine or Prefer Direct2D engine. This icon is rendered only with native TSVG Engine, the blank square is visible using Direct2D. You must remove this directive {$DEFINE PreferNativeSvgSupport} to use TSVG engine.

svangogh1 commented 3 years ago

Ah thank you for the reaction. We will look into switching engines.