Cairo rendering broken for "use" elements with scaling or a viewBox

Bug #705345 reported by Alex Valavanis
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
theAdib
inkscape (Debian)
Fix Released
Unknown
inkscape (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Forwarded from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559332

Reported by: Erich Schubert <email address hidden>
Date: Thu, 3 Dec 2009 17:36:02 UTC
Severity: normal
Found in version inkscape/0.47pre4-1

It seems as if Cairo output (e.g. export to PDF, print preview, print probably)
does not honor "width" and "height" attributes of "use" elements, or the viewBox attribute of the symbol definition.

Attached is a test SVG file that shows correctly within inkscape, but is messed up in print preview.
I also attached a screenshot for reference of the result. As you can, see, the scaling information of the filled circles (which are inserted using 'use') is lost.
In addition, the yellow discs are offset by their view box origin. I did not use view box sizing for extra scaling, which would probably introduce a third layer of mess-up.

This is probably upstream.
I believe it was okay in earlier version of inkscape that used less Cairo for output?

--- System information. ---
Architecture: amd64
Kernel: Linux 2.6.31-1-amd64

Debian Release: squeeze/sid
  500 unstable www.debian-multimedia.org
  500 unstable debmirror.lrz.de
  500 stable dl.google.com
    1 experimental debmirror.lrz.de

--- Package information. ---
Depends (Version) | Installed
=====================================-+-===============
libatk1.0-0 (>= 1.20.0) | 1.29.3-1
libc6 (>= 2.4) | 2.10.2-2
libcairo2 (>= 1.7.2) | 1.8.8-2
libcairomm-1.0-1 (>= 1.6.4) | 1.8.0-1
libfontconfig1 (>= 2.4.0) | 2.6.0-4
libfreetype6 (>= 2.2.1) | 2.3.11-1
libgc1c2 (>= 1:6.8-1.1) | 1:6.8-1.2
libgcc1 (>= 1:4.1.1) | 1:4.4.2-3
libgconf2-4 (>= 2.27.0) | 2.28.0-1
libglib2.0-0 (>= 2.16.0) | 2.23.0-1
libglibmm-2.4-1c2a (>= 2.22.0) | 2.22.1-2
libgnomevfs2-0 (>= 1:2.17.90) | 1:2.24.2-1
libgomp1 (>= 4.2.1) | 4.4.2-3
libgsl0ldbl (>= 1.9) | 1.13+dfsg-1
libgtk2.0-0 (>= 2.14.0) | 2.19.1-1
libgtkmm-2.4-1c2a (>= 1:2.18.0) | 1:2.18.2-1
libgtkspell0 (>= 2.0.10) | 2.0.13-2
liblcms1 (>= 1.15-1) | 1.18.dfsg-1
libmagick++2 (>= 7:6.5.7.8) | 7:6.5.7.8-1
libmagickcore2 (>= 7:6.5.7.8) | 7:6.5.7.8-1
libpango1.0-0 (>= 1.14.0) | 1.26.1-1
libpangomm-1.4-1 (>= 2.26.0) | 2.26.0-1
libpng12-0 (>= 1.2.13-4) | 1.2.40-1
libpoppler-glib4 (>= 0.12) | 0.12.2-2
libpoppler5 | 0.12.2-2
libpopt0 (>= 1.15) | 1.15-1
libsigc++-2.0-0c2a (>= 2.0.2) | 2.2.2-1
libstdc++6 (>= 4.2.1) | 4.4.2-3
libwpd8c2a | 0.8.14-1
libwpg-0.1-1 | 0.1.3-1
libx11-6 | 2:1.3.2-1
libxml2 (>= 2.7.4) | 2.7.6.dfsg-1
libxslt1.1 (>= 1.1.18) | 1.1.26-1
zlib1g (>= 1:1.1.4) | 1:1.2.3.3.dfsg-15

Recommends (Version) | Installed
==========================-+-===========
libwmf-bin | 0.2.8.4-6.1
pstoedit | 3.45-8
imagemagick | 7:6.5.7.8-1
perlmagick |

Suggests (Version) | Installed
==================================-+-===========
dia |
 OR dia-gnome | 0.97-2
ruby | 4.2
libgnomevfs2-extra | 1:2.24.2-1
libsvg-perl |
libxml-xql-perl |
python | 2.5.4-3
python-numpy | 1:1.3.0-3
python-lxml | 2.2.2-2
python-uniconvertor |
skencil |
ttf-bitstream-vera |

Related branches

Revision history for this message
Alex Valavanis (valavanisalex) wrote :
Revision history for this message
Alex Valavanis (valavanisalex) wrote :
Changed in inkscape (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Confirmed in Ubuntu in 0.48.0-1ubuntu2 (dodgy PDF export attached)

Similar to bug #320646 "export via cairo -> shifted image" ?

tags: added: cairo exporting pdf
Revision history for this message
su_v (suv-lp) wrote :

From 'test.svg':
<defs>
 <symbol id="s1" viewBox="0 0 .5 .5">
  <circle r="0.25" style="fill:cyan;opacity:.5" cx="0.25" cy="0.25"/>
 </symbol>
 <symbol id="s2" viewBox="-.25 -.25 .5 .5">
  <circle r="0.25" style="fill:yellow;opacity:.5" cx="0" cy="0"/>
 </symbol>
</defs>

More likely a duplicate of
Bug #436962 “<symbol> not rendered correctly in exported PDF”
<https://bugs.launchpad.net/inkscape/+bug/436962>

Revision history for this message
su_v (suv-lp) wrote :

Another possibly related/duplicate report:
Bug #485846 “imported svg not exportable to eps”
<https://bugs.launchpad.net/inkscape/+bug/485846>

su_v (suv-lp)
tags: removed: cairo debian-bugs-needing-review
Changed in inkscape (Debian):
status: Unknown → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

Test file ('test.svg') converted to PDF with librsvg 2.34 looks ok:

$ rsvg-convert 705345-test.svg -f pdf -o 705345-test-2-rsvg.pdf -x 0.8 -y 0.8

tags: added: viewbox
Revision history for this message
theAdib (theadib) wrote :

I took the opportunity to fix it in revision 10197. Now pdf looks good.
The patch is fairly simple and I propose for 0.48.2 if you all confirm that it works.

Adib.

Revision history for this message
ScislaC (scislac) wrote :

If it works, I approve for 0.48.2.

Revision history for this message
su_v (suv-lp) wrote :

Fix in r10197 confirmed with from bug #705345 and bug #485846:
<https://bugs.launchpad.net/inkscape/+bug/705345/+attachment/1800409/+files/test.svg>
<https://bugs.launchpad.net/inkscape/+bug/485846/+attachment/1040436/+files/Addition.svg>

With the sample file from bug #436962:
<https://bugs.launchpad.net/inkscape/+bug/436962/+attachment/745677/+files/inkscape.svg>
The symbol definitions themselves are no longer exported (compared to PDF exported with r10196 with 4 red circles there are only two red circles in r10197). The remaining issue of bug #436962 - both red circles are still rendered filled (instead of showing a white fill in the cut-out area) - seems unrelated to the <symbol> problem because the cairo-based export apparently ignores the fill rule which is set on a parent group instead of the red path itself (which isn't an instantiated symbol (<use> element) btw).

tags: added: backport-proposed
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
status: Triaged → Fix Committed
tags: added: patch
Revision history for this message
mfn (mfn) wrote :

I can confirm it too. In my files the symbols are now exported correctly.

Revision history for this message
jazzynico (jazzynico) wrote :

Backported to the branch, revision 9810.

Changed in inkscape:
milestone: 0.49 → 0.48.2
tags: removed: backport-proposed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package inkscape - 0.48.2-0ubuntu1

---------------
inkscape (0.48.2-0ubuntu1) oneiric; urgency=low

  * New upstream release (LP: #807912). Fixes several Ubuntu bugs:
    - [SVG Font Editor] Crash when kerning an empty pair (LP: #706506)
    - Connector tool crash Inkscake (orthogonal mode) (LP: #771738)
    - Errors printed to console if openclipart search fails (LP: #638844)
    - pdf export with cairo 1.10 defaults to version PDF-1.5 (LP: #664335)
    - Cairo rendering broken for "use" elements when scaling or a viewBox
      (LP: #705345)
    - gimp_xcf.py crashed with TypeError in effect() (LP: #565296)
    - Enable build against libwpg-0.2 (LP: #778951)
    - Please add supported filetypes into MimeType line of inkscape.desktop
      (LP: #278307)
    - Inkscape fails to build with gcc 4.6 (LP: #707205)
  * Drop 01-libwpg0.2.dpatch - Applied upstream
  * Drop 03-add-missing-mimetypes.dpatch - Applied upstream
  * Drop 04-fix-build-with-gcc4.6.dpatch - Applied upstream
  * Drop 05-add-missing-includes.dpatch - Applied upstream
  * Drop fix-fontforge-glyph-template.dpatch - Applied upstream
 -- Alex Valavanis <email address hidden> Sun, 10 Jul 2011 11:35:30 +0100

Changed in inkscape (Ubuntu):
status: Triaged → Fix Released
su_v (suv-lp)
Changed in inkscape:
assignee: nobody → theAdib (theadib)
Ted Gould (ted)
Changed in inkscape:
status: Fix Committed → Fix Released
Changed in inkscape (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.