DMaster
DMaster

Reputation: 641

Why does text appear in browsers but not appear in image viewers?

I am trying to render a chart but encounter a problem: The <text> elements appear in browsers (Chrome, Firefox) but not in traditional image viewers (Eyes of GNOME, GIMP, Inkscape).

Code

Image

At first, I thought that it was because image viewers are incapable of rendering fonts, until I came across an asciinema's thumbnail, which is displayed perfectly by Eyes of GNOME:

an asciinema's thumbnail

Question: Why does this happen and how to fix this?

Upvotes: 1

Views: 57

Answers (1)

Michael Rovinsky
Michael Rovinsky

Reputation: 7230

The reason is in nested SVGs:

<?xml version="1.0" encoding="utf-8" ?>
<svg ... >
  <rect ... />
  <svg ... >
    <text ... >pdu --quantity=blksize tmp.sample</text>
  </svg>
  ...
</svg>

Move your text elements to the root svg and you will be able to see them in the image viewers / editors (tested with Inkscape and GNOME image viewer)

Upvotes: 1

Related Questions