Special processing rules for xml:space are not observed

Issue #79 on hold
Henrik Tidefelt created an issue

Quoting https://www.w3.org/TR/2003/REC-SVG11-20030114/text.html:

preserve - When xml:space="preserve", the SVG user agent will do the following using a copy of the original character data content. It will convert all newline and tab characters into space characters. Then, it will draw all space characters, including leading, trailing and multiple contiguous space characters. Thus, when drawn with xml:space="preserve", the string "a b" (three spaces between "a" and "b") will produce a larger separation between "a" and "b" than "a b" (one space between "a" and "b").

As far as I can tell, in the presence of xml:space="preserve", Gapplin both removes leading spaces (I suspect trailing too), as well as collapses multiple spaces into one. For reference, I get the behavior I expect when looking at the same SVG in Chrome.

Example:

<?xml version="1.0" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10cm" height="2.5cm" viewBox="0 -20 400 80">
 <g>
  <text xml:space="preserve" font-size="50">
   <tspan x="10" y="50"> A aB  bC   cD    d </tspan>
  </text>
  <path d="M 10 -10 10 60" stroke="currentColor" fill="none" />
 </g>
</svg>

Comments (2)

  1. 1024 repo owner
    • edited description
    • changed status to on hold

    It seems WebKit framework, which Gapplin uses for SVG rendering, doesn't support the xml:space="preserve" option yet. In this case, Gapplin has, unfortunately, nothing to do. Sorry.

  2. Log in to comment