unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: "Alan Third" <alan@idiocy.org>,
	"Clément Pit-Claudel" <cpitclaudel@gmail.com>,
	"Eli Zaretskii" <eliz@gnu.org>,
	40845@debbugs.gnu.org, pipcet@gmail.com
Subject: bug#40845: SVG rendering issues
Date: Sat, 25 Apr 2020 18:07:45 +0000	[thread overview]
Message-ID: <CAOqdjBegFqX2wTyoMvUrMfvZjxNiuS8hKwQc0ibWQcQc9n9L=g@mail.gmail.com> (raw)
In-Reply-To: <20200425174651.GC82687@breton.holly.idiocy.org>

On Sat, Apr 25, 2020 at 5:46 PM Alan Third <alan@idiocy.org> wrote:
> On Sat, Apr 25, 2020 at 01:24:13PM -0400, Clément Pit-Claudel wrote:
> > Yes, of course: if an image has a foreground color, it should be
> > respected. But it's not uncommon for SVG images to not include a
> > foreground color, as shown in the repro. In that case, the image
> > should use the current foreground color, I think. (of course, a
> > :foreground keyword, if any, should take precedence; that is issue
> > 4).

For reference, the relevant chunk of librsvg source code is this:

// https://www.w3.org/TR/SVG/color.html#ColorProperty
make_property!(
    ComputedValues,
    Color,
    // The SVG spec allows the user agent to choose its own default
for the "color" property.
    // We don't allow passing in an initial CSS in the public API, so
we'll start with black.
    //
    // See https://bugzilla.gnome.org/show_bug.cgi?id=764808 for a
case where this would
    // be useful - rendering equations with currentColor, so they take
on the color of the
    // surrounding text.
    default: cssparser::RGBA::new(0, 0, 0, 0xff),
    inherits_automatically: true,
    newtype_parse: cssparser::RGBA,
);

> Lars fixed the foreground issue for eww by wrapping svg files in
> another svg. See svg--wrap-svg in shr.el (bug#37159).
>
> I think this is the only practical way to handle svg files with no
> foreground colour set. To do this when loading _any_ svg we’d probably
> have to move it into create-image or image.c.

I think it's a neat hack, but it's just one of the more obvious ways
of working around an annoying limitation of librsvg (Ideally, we'd use
a library without such a limitation by default and fall back to
modifying/wrapping SVGs when using a limited library.)

For applications which change glyphs' foreground colors a lot, it
might be preferrable to coax rsvg into providing an alpha-only map for
the foreground plus an RGBA map for the background and blend them
together, and that approach would work for other image types.





  reply	other threads:[~2020-04-25 18:07 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 12:19 bug#40845: SVG rendering issues Clément Pit-Claudel
2020-04-25 14:34 ` Pip Cet
2020-04-25 15:30   ` Eli Zaretskii
2020-04-25 15:48     ` Pip Cet
2020-04-25 16:10       ` Eli Zaretskii
2020-04-25 17:38         ` Pip Cet
2020-04-25 18:07           ` Eli Zaretskii
2020-04-25 19:41             ` Pip Cet
2020-04-25 20:11               ` Eli Zaretskii
2020-04-26 10:15                 ` Pip Cet
2020-04-26 14:38                   ` Eli Zaretskii
2020-04-26 19:00                     ` Pip Cet
2020-04-27 15:47                       ` Eli Zaretskii
2020-04-25 15:46   ` Eli Zaretskii
2020-04-25 16:42     ` Clément Pit-Claudel
2020-04-25 17:02       ` Eli Zaretskii
2020-04-25 17:24         ` Clément Pit-Claudel
2020-04-25 17:46           ` Alan Third
2020-04-25 18:07             ` Pip Cet [this message]
2020-04-26 21:17             ` Alan Third
2020-04-26 22:48               ` Clément Pit-Claudel
2020-04-27 15:22                 ` Alan Third
2020-04-27 16:04                   ` Clément Pit-Claudel
2020-05-03 14:13                 ` Alan Third
2020-05-03 14:18                   ` Lars Ingebrigtsen
2020-05-03 16:07                   ` Eli Zaretskii
2020-05-03 16:24                     ` Alan Third
2020-05-03 16:49                       ` Eli Zaretskii
2020-05-03 18:38                         ` Alan Third
2020-05-03 19:17                           ` Eli Zaretskii
2020-05-09 14:27                       ` Alan Third
2020-05-09 19:54                         ` Alan Third
2020-05-15 11:09                           ` Eli Zaretskii
2020-05-15 21:40                             ` Alan Third
2020-08-22 16:15                               ` Alan Third
2020-08-22 16:28                                 ` Lars Ingebrigtsen
2020-08-22 16:54                                 ` Eli Zaretskii
2020-08-22 18:57                                   ` Alan Third
2020-08-22 19:17                                     ` Eli Zaretskii
2020-08-22 21:35                                       ` Alan Third
2020-08-23  5:47                                         ` Eli Zaretskii
2020-08-23  9:09                                           ` Alan Third
2020-08-23  9:11                                             ` Eli Zaretskii
2020-08-23 11:48                                               ` Alan Third
2020-08-23 12:05                                                 ` Eli Zaretskii
2020-08-23 12:19                                                   ` Alan Third
2020-08-23 12:23                                                     ` Eli Zaretskii
2020-08-23 15:29                                                       ` Alan Third
2020-08-23 15:43                                                         ` Lars Ingebrigtsen
2020-08-23 16:08                                                           ` Alan Third
2020-08-23 16:38                                                             ` Lars Ingebrigtsen
2020-04-27  2:27               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOqdjBegFqX2wTyoMvUrMfvZjxNiuS8hKwQc0ibWQcQc9n9L=g@mail.gmail.com' \
    --to=pipcet@gmail.com \
    --cc=40845@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=cpitclaudel@gmail.com \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).