From: Jim Porter <jporterbugs@gmail.com>
To: George Huebner <george@feyor.sh>
Cc: 71913@debbugs.gnu.org
Subject: bug#71913: 29.1; shr: shr-resize-image does not behave as expected
Date: Thu, 11 Jul 2024 16:51:53 -0700 [thread overview]
Message-ID: <a4a59311-ee79-6ee5-f20d-087a23f8f6fb@gmail.com> (raw)
In-Reply-To: <m2y169ul2u.fsf@feyor.sh>
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
On 7/10/2024 12:02 PM, George Huebner wrote:
> As I understand it, this decision was likely made because the dimensions
> of SVGs is weird; they aren't inherently required to have a size, but
> the SVG itself can define a viewbox with accompanying width and height
> (full disclosure: I have no idea what I'm talking about).
I think this was just a mistake. I tried getting rid of the special case
for SVG and everything works just fine in builds with or without SVG
support. (In builds without SVG support, you just get the empty string
where an SVG would be, before and after this patch.)
[-- Attachment #2: 0001-Treat-SVG-images-like-other-image-types-in-shr-put-i.patch --]
[-- Type: text/plain, Size: 2195 bytes --]
From 70ecc19f735e0cea0fda8721d7f2709c39f1bbff Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Thu, 11 Jul 2024 16:29:37 -0700
Subject: [PATCH] Treat SVG images like other image types in 'shr-put-image'
For both SVG and no-SVG builds, this works as expected (in the no-SVG
case, it would raise an error which subsequently gets ignored).
However, compared to the previous implementation, this lets users resize
SVG images just like every other image type.
* lisp/net/shr.el (shr-put-image): Don't special-case SVGs.
---
lisp/net/shr.el | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 39271cc5296..d3c48b34428 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1193,23 +1193,18 @@ shr-put-image
(if (display-graphic-p)
(let* ((zoom (or (plist-get flags :zoom)
(car shr-image-zoom-levels)))
- (zoom-function (nth 2 (assq zoom shr-image-zoom-level-alist)))
+ (zoom-function (or (nth 2 (assq zoom shr-image-zoom-level-alist))
+ (error "Unrecognized zoom level %s" zoom)))
(data (if (consp spec)
(car spec)
spec))
(content-type (and (consp spec)
(cadr spec)))
(start (point))
- (image (cond
- ((eq content-type 'image/svg+xml)
- (when (image-type-available-p 'svg)
- (create-image data 'svg t :ascent shr-image-ascent)))
- (zoom-function
- (ignore-errors
- (funcall zoom-function data content-type
- (plist-get flags :width)
- (plist-get flags :height))))
- (t (error "Unrecognized zoom level %s" zoom)))))
+ (image (ignore-errors
+ (funcall zoom-function data content-type
+ (plist-get flags :width)
+ (plist-get flags :height)))))
(when image
;; The trailing space can confuse shr-insert into not
;; putting any space after inline images.
--
2.25.1
next prev parent reply other threads:[~2024-07-11 23:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 6:37 bug#71913: 29.1; shr: shr-resize-image does not behave as expected George Huebner
2024-07-03 15:48 ` Jim Porter
[not found] ` <m25xtmz0fj.fsf@feyor.sh>
2024-07-05 18:11 ` Jim Porter
2024-07-10 19:02 ` George Huebner
2024-07-11 23:51 ` Jim Porter [this message]
2024-07-12 5:58 ` Eli Zaretskii
2024-07-13 4:11 ` Jim Porter
2024-07-13 6:20 ` Eli Zaretskii
2024-07-13 17:29 ` Jim Porter
2024-07-13 17:39 ` Eli Zaretskii
2024-07-13 18:54 ` Jim Porter
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4a59311-ee79-6ee5-f20d-087a23f8f6fb@gmail.com \
--to=jporterbugs@gmail.com \
--cc=71913@debbugs.gnu.org \
--cc=george@feyor.sh \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.