Image viewer renders SVG improperly

Bug #2059817 reported by Stephen T Satchell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eog (Ubuntu)
New
Undecided
Unassigned

Bug Description

Image viewer fails to render SVG images with transform matrices that are no equal.
Image fragment that fails:

<svg viewBox="-50 -50 200 200" xmlns="https://www.w3.org/2000/svg">
    <text xml:space="preserve"
          style="font-style:normal;
                 font-variant:normal;
                 font-weight:normal;
                 font-stretch:normal;
                 font-size:4.88821px;
                 line-height:1.25;
                 font-family:Montserrat;
                 -inkscape-font-specification:'Montserrat, Normal';
                 font-variant-ligatures:normal;
                 font-variant-caps:normal;font-variant-numeric:normal;
                 font-variant-east-asian:normal;
                 letter-spacing:0px;
                 word-spacing:0px;
                 writing-mode:lr-tb;
                 stroke-width:0.0941954" x="120.24615" y="50.100014" id="text1" transform="matrix(0.35601438,0.00200485,0,2.8088753,0,0)"
                 >
        <tspan sodipodi:role="line"
               id="tspan2"
               x="120.24615"
               y="50.100014"
               style="stroke-width:0.0941954"
               >
        This text has been highly squashed, and should stay in the inner box.
        </tspan>
    </text>
</svg>

Expected result: text that has been scaled to fit in a box
Actual result: individual glyphs are appropriately squished, but letterspacing is not. The letterspacing used appears to be the full-size glyph width in the font.

In another test, where the text is stretched, the individual glyphs are appropriately stretched, but letterspacing is not. The letterspacing used appears to be the full-sized (unstretched) glpyh width in the font.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: eog 3.36.3-0ubuntu1
ProcVersionSignature: Ubuntu 5.15.0-101.111~20.04.1-generic 5.15.143
Uname: Linux 5.15.0-101-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.27
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Fri Mar 29 17:28:27 2024
InstallationDate: Installed on 2021-06-13 (1020 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: eog
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Stephen T Satchell (satch89521) wrote :
Revision history for this message
Stephen T Satchell (satch89521) wrote :

In further tests, I find that Chrome, Firefox, and LibreOffice Draw renders the image correctly. Of course, the image was created in InkScape, so it's rendering is also as expected.

Dia displays an error when loading the image. Document Viewer: SVG not supported. GIMP screws up exactly the same way. ImageMagick doesn't even try to render the text.

Revision history for this message
Stephen T Satchell (satch89521) wrote :

In discussing this bug with a friend, he reminded me that, in the "flash and escape" phototypesetters, when you wanted to change the aspect ratio of a letterform, you has to set anamorphic magnification. It appears that InkScape has a habit of using complex scaling algorithms to effect this anamorphic magnification. This could well be confusing some of the image renderers. Looking at the XML coding, Inkscape sometimes changes the font height, then changes Y magnification to compensate. Sometimes it doesn't. This may be the root cause of the bug.

Any road, the issue is that each letterform in a variable-width font has an image, and a width value (sometimes called "escapement", harkening back to the days of the spinning-disk optical phototypesetters where the paradigk was "flash and escape".) The width values are not being scaled properly. This is most likely a simple oversight, and if so it's easy to fix.

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.