Issues with 'ex' relative units for <svg> width, height

Bug #1634571 reported by Changhyun Kwon
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Undecided
Unassigned

Bug Description

I have tried to convert this SVG file to PNG:
https://gist.github.com/chkwon/6ac383f4275720402027b3b7d4614ac1

using the command-line tool:

    inkscape -f e2293e769a19cf7cc131560e7d30a493cf399b8a.svg -e e2293e769a19cf7cc131560e7d30a493cf399b8a.png -h 40pt

Although there are some warnings, my Linux version can convert it successfully, while my Mac version cannot: it produces a blank PNG file. It produces the following message:

/Applications/Inkscape.app/Contents/Resources/bin/inkscape -f /Users/chkwon/test/test.svg -e /Users/chkwon/test/test.png

    ** (inkscape-bin:32096): WARNING **: SPIStyle::readIfUnset(): Invalid style property id: 90 value: static
    Background RRGGBBAA: ffffff00
    Area -1:-1:0:0 exported to 40 x 40 pixels (3600 dpi)
    Bitmap saved as: /Users/chkwon/test/test.png

In Linux, it instead says:

    Area 0:0:36634.4:2393.2 exported to 612 x 40 pixels (1.50426 dpi)

Both Mac and Linux has Inkscape 0.91 r13725. When I downgraded to Mac version 0.48.5 r10040, it works good.

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

Not reproduced with Inkscape 0.91 r13725 on Ubuntu 14.04
Reproduced with Inkscape 0.91 r13725 (official package as well as with regular local build installed into fixed prefix), lp:inkscape 0.92.x r15116 (local build) on OS X 10.7.5.

The issue seems to be related to 'ex' units used for for the root <svg> element's width and height attributes:

<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="85.087ex" height="5.558ex" focusable="false" xmlns="http://www.w3.org/2000/svg" style="vertical-align: -2.054ex; margin-bottom: -0.147ex; max-width: 736px; position: static;" viewBox="0 -1445.5 36634.4 2393.2">

“(...) the em and ex unit identifiers are relative to the current font's font-size and x-height, respectively.“

Also affects regular opening (via GUI), and import of the file into a new document - the issue is not specific to command line usage or PNG export.

Import into a new document applies this transformation to the imported group (with 0.91):
    matrix(0,0,0,0,375,532.3622)
which renders 'invisible' since the group is scaled to zero size.

tags: added: osx units
Changed in inkscape:
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

Testing with archived trunk builds (on OS X 10.7.5):
- not reproduced with lp:inkscape rev <= 13001,
- reproduced with lp:inkscape >= 13002;
the changes in r13002 seem to have contributed to the reported issue:

Revision 13002:
* Added new base class to handle viewBox and preserveAspectRatio.
* Updated sp-root, sp-symbol, sp-image, sp-pattern, marker to use new class.
* Fixed some viewport issues when % used.
https://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/13002

Unclear to me at this point why the tested stable Linux build (package from inkscape PPA: 0.91.0+52~ubuntu14.04.1) produces a different result (?).

A more recent (local) trunk build on Ubuntu 14.04 (Inkscape 0.92+devel 15110 (Sep 4 2016)) however does reproduce the same problem as described in comment #1 - the content does not render visibly when opening the file in the GUI, nor when importing the file into a new (empty) document.

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

Also reproduced on Ubuntu 14.04 with latest package from Inkscape Trunk PPA (1:0.91.0+devel+15174+77~ubuntu14.04.1).

su_v (suv-lp)
summary: - Mac version cannot convert some SVG files
+ Issues with 'ex' relative units for <svg> width, height
Revision history for this message
ivanistheone (ivan-savov) wrote :

In case this helps with tracking down the issue, I've noticed that this type of SVG works with 0.91:

```
<svg style="width: 15ex; height: 5ex; vertical-align: -0.692ex; margin: 1px 0px;" viewBox="..."><g stroke="black" fill="black">...</g></svg>
```

But this fails:
```
<svg width="15ex" height="5ex" style="vertical-align: -0.692ex;" viewBox="..." role="img" focusable="false"><g stroke="currentColor" fill="currentColor" stroke-width="0">...</g></svg>
```

It seems Inkskape v0.91 has a problem the SVG that has `height` and `width` as attributes rather than as parts of the `style` attribute.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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