mrpiggi / svg

Handling SVG pictures in LaTeX documents using Inkscape, ImageMagick and/or Ghostscript
Other
65 stars 11 forks source link

Auto-flow text features in SVG2 not rendering properly in latex #40

Closed lgrosz closed 3 years ago

lgrosz commented 3 years ago

Temporary solution: in text preferences, uncheck the auto-flow svg2 feature. Here is an example svg with working and non working flow-texts

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="143.30655mm"
   height="200.40955mm"
   viewBox="0 0 143.30655 200.40955"
   version="1.1"
   id="svg8"
   inkscape:version="1.0.1 (c497b03c, 2020-09-10)"
   sodipodi:docname="textExample.svg">
  <defs
     id="defs2">
    <rect
       x="67.057052"
       y="144.37375"
       width="84.00729"
       height="53.808591"
       id="rect117" />
    <rect
       x="62.897285"
       y="111.42723"
       width="80.712883"
       height="69.731544"
       id="rect107" />
    <rect
       x="47.053143"
       y="206.93263"
       width="124.46315"
       height="71.844582"
       id="rect48" />
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.48187782"
     inkscape:cx="197.14541"
     inkscape:cy="430.60707"
     inkscape:document-units="mm"
     inkscape:current-layer="layer1"
     inkscape:document-rotation="0"
     showgrid="false"
     inkscape:window-width="1252"
     inkscape:window-height="943"
     inkscape:window-x="1756"
     inkscape:window-y="25"
     inkscape:window-maximized="0"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-36.858353,-24.677086)">
    <text
       xml:space="preserve"
       id="text46"
       style="font-style:normal;font-weight:normal;font-size:10.58329999999999949px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect48);fill:#000000;fill-opacity:1;stroke:none;" />
    <rect
       style="fill:#e6e6e6;fill-rule:evenodd;stroke-width:0.264583"
       id="rect111"
       width="143.85562"
       height="200.40955"
       x="36.542057"
       y="24.674601" />
    <path
       style="fill:#e6e6e6;stroke-width:2.07521"
       d="M 51.000607,438.91732 V 60.190619 H 321.81614 592.63167 V 438.91732 817.64403 H 321.81614 51.000607 Z"
       id="path113"
       transform="matrix(0.26458333,0,0,0.26458333,23.364443,8.7516514)" />
    <text
       xml:space="preserve"
       id="text115"
       style="font-style:normal;font-weight:normal;font-size:10.58329999999999949px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect117);fill:#000000;fill-opacity:1;stroke:none;"><tspan
         x="67.056641"
         y="154.02851"><tspan>auto-flow svg2 </tspan></tspan><tspan
         x="67.056641"
         y="167.25764"><tspan>on - not </tspan></tspan><tspan
         x="67.056641"
         y="180.48676"><tspan>working as </tspan></tspan><tspan
         x="67.056641"
         y="193.71589"><tspan>expected</tspan></tspan></text>
    <flowRoot
       xml:space="preserve"
       id="flowRoot121"
       style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"><flowRegion
         id="flowRegion123"><rect
           id="rect125"
           width="76.320351"
           height="57.102989"
           x="70.351456"
           y="65.857132"
           style="stroke-width:0.264583" /></flowRegion><flowPara
         id="flowPara127">auto-flow svg2 off - works as expected</flowPara></flowRoot>
  </g>
</svg>

Looks like currently only the <flowRoot> tag is taken into consideration but the SVG2 auto-flow uses <text> and <tspan>s for flowing text.

lgrosz commented 3 years ago

Perhaps this is an inkscape issue.. not an issue with this package.

mrpiggi commented 3 years ago

As the auto-flow text is exported within a tabular environment in the *.pdf_tex file, this has nothing to do with package svg. As you already created a ticket for Inkscape (https://gitlab.com/inkscape/inbox/-/issues/5093), this issue is closed.