linebender / resvg

An SVG rendering library.
Apache License 2.0
2.84k stars 229 forks source link

Improve fontconfig integration #761

Open igormironchik opened 6 months ago

igormironchik commented 6 months ago

The following SVG files render wrong with resvg.

paragraph_before paragraph_after

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   width="405"
   height="105"
   viewBox="0 0 107.15625 27.781251"
   version="1.1"
   id="svg5"
   inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
   sodipodi:docname="paragraph_before.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <sodipodi:namedview
     id="namedview7"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageshadow="2"
     inkscape:pageopacity="1"
     inkscape:pagecheckerboard="0"
     inkscape:document-units="mm"
     showgrid="true"
     inkscape:snap-grids="true"
     units="px"
     width="200px"
     inkscape:zoom="1.3011622"
     inkscape:cx="156.78291"
     inkscape:cy="-19.982136"
     inkscape:window-width="1920"
     inkscape:window-height="1008"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="layer1">
    <inkscape:grid
       type="xygrid"
       id="grid4028"
       empspacing="5"
       snapvisiblegridlinesonly="true"
       spacingx="0.66145834"
       spacingy="0.66145834" />
  </sodipodi:namedview>
  <defs
     id="defs2">
    <marker
       style="overflow:visible"
       id="Arrow2Lend"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Lend"
       inkscape:isstock="true">
      <path
         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path17119" />
    </marker>
    <linearGradient
       inkscape:collect="always"
       id="linearGradient16676">
      <stop
         style="stop-color:#000000;stop-opacity:1;"
         offset="0"
         id="stop16672" />
      <stop
         style="stop-color:#000000;stop-opacity:0;"
         offset="1"
         id="stop16674" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       id="linearGradient16650">
      <stop
         style="stop-color:#000000;stop-opacity:1;"
         offset="0"
         id="stop16646" />
      <stop
         style="stop-color:#000000;stop-opacity:0;"
         offset="1"
         id="stop16648" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient16650"
       id="linearGradient16652"
       x1="1.2236148"
       y1="2.7078443"
       x2="22.768566"
       y2="2.7078443"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient16676"
       id="linearGradient16678"
       x1="1.3559062"
       y1="2.7078443"
       x2="22.636276"
       y2="2.7078443"
       gradientUnits="userSpaceOnUse" />
  </defs>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1">
    <rect
       style="fill:#ffffff;stroke:#fe0000;stroke-width:0.269063;stroke-opacity:0.00113472"
       id="rect1105"
       width="107.15625"
       height="27.78125"
       x="0"
       y="0" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
       x="2.3812506"
       y="5.9381247"
       id="text15802"><tspan
         sodipodi:role="line"
         id="tspan15800"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
         x="2.3812506"
         y="5.9381247">Raw text data</tspan></text>
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.264583;stroke-opacity:1"
       id="rect16720"
       width="23.8125"
       height="6.614583"
       x="1.3229166"
       y="1.3229166" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 25.135417,4.6302083 h 4.630208"
       id="path16992"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.221366;stroke-opacity:1"
       id="rect17016"
       width="13.890625"
       height="6.614583"
       x="30.294792"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="31.040798"
       y="5.7199101"
       id="text20624"><tspan
         sodipodi:role="line"
         id="tspan20622"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="31.040798"
         y="5.7199101">te@Xt1</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 44.185421,4.6302083 h 4.630208"
       id="path22134"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect22136"
       width="10.18644"
       height="6.614583"
       x="49.34481"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="50.619984"
       y="5.7199101"
       id="text22140"><tspan
         sodipodi:role="line"
         id="tspan22138"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="50.619984"
         y="5.7199101">text2</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 59.531261,4.6302083 h 4.630208"
       id="path23198"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect23200"
       width="10.18644"
       height="6.614583"
       x="64.690659"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="65.965828"
       y="5.7199101"
       id="text23204"><tspan
         sodipodi:role="line"
         id="tspan23202"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="65.965828"
         y="5.7199101">text3</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
       x="2.3812506"
       y="24.458963"
       id="text31386"><tspan
         sodipodi:role="line"
         id="tspan31384"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
         x="2.3812506"
         y="24.458963">Paragraph</tspan></text>
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.264583;stroke-opacity:1"
       id="rect31388"
       width="23.8125"
       height="6.614583"
       x="1.3229166"
       y="19.843748" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 25.135417,23.151048 h 4.630208"
       id="path31390"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.221366;stroke-opacity:1"
       id="rect31392"
       width="13.890625"
       height="6.614583"
       x="30.294792"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="31.040798"
       y="24.240749"
       id="text31396"><tspan
         sodipodi:role="line"
         id="tspan31394"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="31.040798"
         y="24.240749">te@Xt1</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 44.185421,23.151048 h 4.630208"
       id="path31398"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect31400"
       width="10.18644"
       height="6.614583"
       x="49.34481"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="50.619984"
       y="24.240749"
       id="text31404"><tspan
         sodipodi:role="line"
         id="tspan31402"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="50.619984"
         y="24.240749">code</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 59.531261,23.151048 h 4.630208"
       id="path31406"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect31408"
       width="10.18644"
       height="6.614583"
       x="64.690659"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="65.965828"
       y="24.240749"
       id="text31412"><tspan
         sodipodi:role="line"
         id="tspan31410"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="65.965828"
         y="24.240749">text2</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 74.877104,23.151048 h 4.630208"
       id="path44164"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect44166"
       width="10.18644"
       height="6.614583"
       x="80.036507"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="82.37001"
       y="24.240749"
       id="text44170"><tspan
         sodipodi:role="line"
         id="tspan44168"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="82.37001"
         y="24.240749">link</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 90.222939,23.151048 h 4.630208"
       id="path48804"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect48806"
       width="10.18644"
       height="6.614583"
       x="95.382355"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="96.657524"
       y="24.240749"
       id="text48810"><tspan
         sodipodi:role="line"
         id="tspan48808"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="96.657524"
         y="24.240749">text3</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 37.041666,8.5989582 V 19.182292"
       id="path49518"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 54.239583,8.5989582 69.453124,19.182292"
       id="path49520"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 69.453124,8.5989582 100.54167,19.182292"
       id="path49522"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
  </g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   width="530"
   height="105"
   viewBox="0 0 140.22916 27.781251"
   version="1.1"
   id="svg5"
   inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
   sodipodi:docname="paragraph_after.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <sodipodi:namedview
     id="namedview7"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageshadow="2"
     inkscape:pageopacity="1"
     inkscape:pagecheckerboard="0"
     inkscape:document-units="mm"
     showgrid="true"
     inkscape:snap-grids="true"
     units="px"
     width="200px"
     inkscape:zoom="0.94633393"
     inkscape:cx="340.26044"
     inkscape:cy="114.12462"
     inkscape:window-width="1920"
     inkscape:window-height="1008"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="layer1">
    <inkscape:grid
       type="xygrid"
       id="grid4028"
       empspacing="5"
       snapvisiblegridlinesonly="true"
       spacingx="0.66145834"
       spacingy="0.66145834" />
  </sodipodi:namedview>
  <defs
     id="defs2">
    <marker
       style="overflow:visible"
       id="Arrow2Lend"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="Arrow2Lend"
       inkscape:isstock="true">
      <path
         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
         style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round"
         id="path17119" />
    </marker>
    <linearGradient
       inkscape:collect="always"
       id="linearGradient16676">
      <stop
         style="stop-color:#000000;stop-opacity:1;"
         offset="0"
         id="stop16672" />
      <stop
         style="stop-color:#000000;stop-opacity:0;"
         offset="1"
         id="stop16674" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       id="linearGradient16650">
      <stop
         style="stop-color:#000000;stop-opacity:1;"
         offset="0"
         id="stop16646" />
      <stop
         style="stop-color:#000000;stop-opacity:0;"
         offset="1"
         id="stop16648" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient16650"
       id="linearGradient16652"
       x1="1.2236148"
       y1="2.7078443"
       x2="22.768566"
       y2="2.7078443"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient16676"
       id="linearGradient16678"
       x1="1.3559062"
       y1="2.7078443"
       x2="22.636276"
       y2="2.7078443"
       gradientUnits="userSpaceOnUse" />
  </defs>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1">
    <rect
       style="fill:#ffffff;stroke:#fe0000;stroke-width:0.254221;stroke-opacity:0.00113472"
       id="rect914"
       width="140.22917"
       height="27.78125"
       x="0"
       y="0" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
       x="2.3812506"
       y="5.9381247"
       id="text15802"><tspan
         sodipodi:role="line"
         id="tspan15800"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
         x="2.3812506"
         y="5.9381247">Raw text data</tspan></text>
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.264583;stroke-opacity:1"
       id="rect16720"
       width="23.8125"
       height="6.614583"
       x="1.3229166"
       y="1.3229166" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 25.135417,4.6302083 h 4.630208"
       id="path16992"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 55.827084,4.6302083 h 4.630208"
       id="path22134"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect22136"
       width="10.18644"
       height="6.614583"
       x="60.986488"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="62.261658"
       y="5.7199101"
       id="text22140"><tspan
         sodipodi:role="line"
         id="tspan22138"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="62.261658"
         y="5.7199101">text2</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 71.172924,4.6302083 h 4.630208"
       id="path23198"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect23200"
       width="10.18644"
       height="6.614583"
       x="76.332336"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="77.607506"
       y="5.7199101"
       id="text23204"><tspan
         sodipodi:role="line"
         id="tspan23202"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="77.607506"
         y="5.7199101">text3</tspan></text>
    <text
       xml:space="preserve"
       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
       x="2.3812506"
       y="24.458963"
       id="text31386"><tspan
         sodipodi:role="line"
         id="tspan31384"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-opacity:1"
         x="2.3812506"
         y="24.458963">Paragraph</tspan></text>
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.264583;stroke-opacity:1"
       id="rect31388"
       width="23.8125"
       height="6.614583"
       x="1.3229166"
       y="19.843748" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 25.135417,23.151048 h 4.630208"
       id="path31390"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 78.052109,23.151048 h 4.630208"
       id="path31398"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect31400"
       width="10.18644"
       height="6.614583"
       x="83.21151"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="84.486679"
       y="24.240749"
       id="text31404"><tspan
         sodipodi:role="line"
         id="tspan31402"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="84.486679"
         y="24.240749">code</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 93.397949,23.151048 h 4.630208"
       id="path31406"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect31408"
       width="10.18644"
       height="6.614583"
       x="98.557358"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="99.832527"
       y="24.240749"
       id="text31412"><tspan
         sodipodi:role="line"
         id="tspan31410"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="99.832527"
         y="24.240749">text2</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 108.74384,23.151048 h 4.63023"
       id="path44164"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect44166"
       width="10.18644"
       height="6.614583"
       x="113.90317"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="116.23664"
       y="24.240749"
       id="text44170"><tspan
         sodipodi:role="line"
         id="tspan44168"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="116.23664"
         y="24.240749">link</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 124.08976,23.151048 H 128.72"
       id="path48804"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect48806"
       width="10.18644"
       height="6.614583"
       x="129.24896"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="130.52411"
       y="24.240749"
       id="text48810"><tspan
         sodipodi:role="line"
         id="tspan48808"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="130.52411"
         y="24.240749">text3</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 35.454165,8.5989582 V 19.182292"
       id="path49518"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.316924px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 50.932292,8.5989584 72.760417,19.182292"
       id="path49520"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.291374px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 65.484376,8.5989584 103.1875,19.182292"
       id="path49522"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect49892"
       width="10.18644"
       height="6.614583"
       x="30.294792"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="33.686634"
       y="5.7199101"
       id="text49896"><tspan
         sodipodi:role="line"
         id="tspan49894"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="33.686634"
         y="5.7199101">te</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 40.48126,4.6302083 h 4.630208"
       id="path50000"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect50002"
       width="10.18644"
       height="6.614583"
       x="45.64064"
       y="1.3229166" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="49.032482"
       y="5.7199101"
       id="text50006"><tspan
         sodipodi:role="line"
         id="tspan50004"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="49.032482"
         y="5.7199101">t1</tspan></text>
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect50852"
       width="10.18644"
       height="6.614583"
       x="30.294792"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="33.686634"
       y="24.240749"
       id="text50856"><tspan
         sodipodi:role="line"
         id="tspan50854"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="33.686634"
         y="24.240749">te</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 40.481252,23.151048 H 45.11146"
       id="path53570"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#fe0000;stroke-width:0.246313;stroke-opacity:1"
       id="rect53572"
       width="17.197905"
       height="6.614583"
       x="45.64064"
       y="19.843748" />
    <text
       xml:space="preserve"
       style="font-style:normal;font-weight:normal;font-size:10.5833px;line-height:1.25;font-family:sans-serif;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:0.265;stroke-miterlimit:4;stroke-dasharray:none"
       x="46.91581"
       y="24.240749"
       id="text53576"><tspan
         sodipodi:role="line"
         id="tspan53574"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.265;stroke-miterlimit:4;stroke-dasharray:none;fill:#ff0000;fill-opacity:1"
         x="46.91581"
         y="24.240749">your stuff</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="m 62.70626,23.151048 h 4.630208"
       id="path55980"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
    <rect
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.189566;stroke-opacity:1"
       id="rect55982"
       width="10.18644"
       height="6.614583"
       x="67.865662"
       y="19.843748" />
    <text
       xml:space="preserve"
       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;stroke-width:0.264583"
       x="71.2575"
       y="24.240749"
       id="text55986"><tspan
         sodipodi:role="line"
         id="tspan55984"
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
         x="71.2575"
         y="24.240749">t1</tspan></text>
    <path
       style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
       d="M 81.359374,8.5989582 134.27604,19.182292"
       id="path56112"
       inkscape:connector-type="polyline"
       inkscape:connector-curvature="0" />
  </g>
</svg>

With resvg they render like:

Screenshot_20240516_143008

LaurenzV commented 6 months ago

Can't reproduce, I just tried rendering both with resvg and this is what I get:

test

test

igormironchik commented 6 months ago

And how it's possible? Did you try C-API in viewsvg tool?

igormironchik commented 6 months ago

What command did you use to generate PNG?

igormironchik commented 6 months ago

Hm, I tried:

./resvg paragraph_after.svg 1.png
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.
Warning (in usvg::text::layout:1229): No match for 'sans-serif' font-family.

Maybe this issue is because of missing font?

igormironchik commented 6 months ago

Hey, I caught it! On Windows everything is fine! This issue is on Linux only! Check on Linux please.

RazrFalcon commented 6 months ago

What does fc-match sans-serif returns on your Linux machine? Also try running ./resvg paragraph_after.svg 1.png --list-fonts

igormironchik commented 6 months ago
fc-match sans-serif
Arimo-Regular.ttf: "Arimo" "Regular"

./resvg paragraph_after.svg 1.png --list-fonts prints:

fonts.txt

igormironchik commented 6 months ago

And ./resvg paragraph_after.svg 1.png produces PNG without text at all.

RazrFalcon commented 6 months ago

Try calling ./resvg --list-fonts using the latest commit and paste the first 5 lines here. It should look something like:

serif: Times New Roman
sans-serif: Arial
cursive: Comic Sans MS
fantasy: Impact
monospace: Courier New
igormironchik commented 6 months ago

I've got:

serif: Times New Roman
sans-serif: Arial
cursive: Comic Sans MS
fantasy: Impact
monospace: Courier New
RazrFalcon commented 6 months ago

Ok, so your SVG file requests sans-serif, which fontconfig resolves as Arial, but there is no Arial font on your machine.

Can you try calling fc-match --format=%{file} sans-serif or fc-match --format=%{file} Arial?

Sure, resvg could try fallbacking to a random font, but it doesn't do this now.

RazrFalcon commented 6 months ago

Even worse, I guess resvg fails to read fontconfig to begin with. fc-match reports Arimo as sans-serif, no Arial.

I guess your fontconfig config is so complicated that the library we use to parse it fails. No sure if it can be fixed... Try using explicit font names for now.

RazrFalcon commented 6 months ago

I guess this issue is basically this: https://github.com/RazrFalcon/fontdb/issues/24

igormironchik commented 6 months ago

fc-match --format=%{file} sans-serif

fc-match --format=%{file} sans-serif
/usr/share/fonts/truetype/croscore/Arimo-Regular.ttf

fc-match --format=%{file} Arial

fc-match --format=%{file} Arial
/usr/share/fonts/truetype/croscore/Arimo-Regular.ttf

No sure if it can be fixed... Try using explicit font names for now.

Sure, I will workaround this.

I guess this issue is basically this: https://github.com/RazrFalcon/fontdb/issues/24

Don't know. You know better. I said - you know :)