diff options
author | Alan Third <alan@idiocy.org> | 2020-08-23 16:28:17 +0100 |
---|---|---|
committer | Alan Third <alan@idiocy.org> | 2020-08-23 16:28:17 +0100 |
commit | 8f42b94fe43911c6b0c7e519ba439d61459dc744 (patch) | |
tree | 4786e52acf27cf3a5262d8b283f1ed8ac1b073e6 /lisp | |
parent | 4aff89ece6d9ceee882375879518b71ca6a89a70 (diff) | |
download | emacs-8f42b94fe43911c6b0c7e519ba439d61459dc744.tar.gz |
Set basic SVG attributes (bug#40845)
* test/manual/image-transforms-tests.el: Replace hard-coded colors
with defaults.
* src/dispextern.h (struct image):
* src/image.c (search_image_cache):
(xbm_load_image):
(xbm_load):
(pbm_load): Rename from frame to face where relevant.
(svg_load_image): Parse the image to find out the size, then wrap it
in another SVG to set a new size and colors, etc.
(lookup_image): Use the face colors instead of the frame colors.
(search_image_cache): Add ability to ignore the face colors.
(uncache_image): Uncache all copies of the image that share the spec,
even if the face colors don't match.
* etc/NEWS: Describe the changes.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/net/shr.el | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index ddd81127213..24595301b79 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1209,25 +1209,8 @@ Return a string with image data." ;; that are non-ASCII. (shr-dom-to-xml (libxml-parse-xml-region (point) (point-max)) 'utf-8))) - ;; SVG images often do not have a specified foreground/background - ;; color, so wrap them in styles. - (when (and (display-images-p) - (eq content-type 'image/svg+xml)) - (setq data (svg--wrap-svg data))) (list data content-type))) -(defun svg--wrap-svg (data) - "Add a default foreground colour to SVG images." - (let ((size (image-size (create-image data nil t :scaling 1) t))) - (with-temp-buffer - (insert - (format - "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xi=\"http://www.w3.org/2001/XInclude\" style=\"color: %s;\" viewBox=\"0 0 %d %d\"> <xi:include href=\"data:image/svg+xml;base64,%s\"></xi:include></svg>" - (face-foreground 'default) - (car size) (cdr size) - (base64-encode-string data t))) - (buffer-string)))) - (defun shr-image-displayer (content-function) "Return a function to display an image. CONTENT-FUNCTION is a function to retrieve an image for a cid url that |