Subject: 28.0.50; Oversized SVG margin
From: "Matsievskiy S.V." <[email-masked]>
To: [email-masked]
Date: Sun, 15 Nov 2020 11:59:11 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Inserted into overlays SVG images have oversized bottom and right
margins. This bug was
introduced somewhere between 109eb1e7e29455418b40ca00bf5dad3e61e5fc78
and a32fd9f64d06ccd07a9beaf6d6f1283f7a80edac

To reproduce the bug, use the following code:

;; MathJax image
(setq image "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"
width=\"2.384ex\" height=\"2.676ex\" style=\"vertical-align:
-0.338ex;\" viewBox=\"0 -1006.6 1026.4 1152.1\" role=\"img\"
focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" aria-
labelledby=\"MathJax-SVG-1-Title\">
<title id=\"MathJax-SVG-1-Title\">x^2</title>
<defs aria-hidden=\"true\">
<path stroke-width=\"1\" id=\"E1-MJMATHI-78\" d=\"M52 289Q59 331 106
386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522
361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465
391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290
50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504
153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186
-10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142
101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26
194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251
392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52
289Z\"></path>
<path stroke-width=\"1\" id=\"E1-MJMAIN-32\" d=\"M109 429Q82 429 66
447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429
383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99
409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86
81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305
340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154
602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154
447T109 429Z\"></path>
</defs>
<g stroke=\"currentColor\" fill=\"currentColor\" stroke-width=\"0\"
transform=\"matrix(1 0 0 -1 0 0)\" aria-hidden=\"true\">
 <use xlink:href=\"#E1-MJMATHI-78\" x=\"0\" y=\"0\"></use>
 <use transform=\"scale(0.707)\" xlink:href=\"#E1-MJMAIN-32\" x=\"809\"
y=\"583\"></use>
</g>
</svg>")

(setq o (make-overlay 1 3))
(overlay-put o 'display (list (cons 'image (list :type 'svg :data image
:scale 2))))

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.23, cairo version 1.16.0)
 of 2020-11-14 built on KILLINGMACHINE
Repository revision: 61dca6e92ac972b832e889fbeab9b6131fc896fa
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version
11.0.12008000
System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure --with-imagemagick --prefix=/opt/emacs28 --enable-largefile
 --with-jpeg --with-png --with-json --with-threads'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS GSETTINGS
GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ
M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES
THREADS LIBSYSTEMD JSON PDUMPER LCMS2

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml easymenu mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-
loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-
utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset
image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-
mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
emacs)

Memory information:
((conses 16 52735 5932)
 (symbols 48 6743 1)
 (strings 32 18259 1209)
 (string-bytes 1 607244)
 (vectors 16 11426)
 (vector-slots 8 163389 9435)
 (floats 8 21 47)
 (intervals 56 192 0)
 (buffers 992 10))