GNU bug report logs -
#72199
31.0.50; `svg-print' add useless and possibly wrong space in XML representation.
Previous Next
Reported by: David Ponce <da_vid <at> orange.fr>
Date: Fri, 19 Jul 2024 18:26:02 UTC
Severity: normal
Found in version 31.0.50
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72199 in the body.
You can then email your comments to 72199 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72199
; Package
emacs
.
(Fri, 19 Jul 2024 18:26:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
David Ponce <da_vid <at> orange.fr>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 19 Jul 2024 18:26:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
While working on generating SVG images from text, I discovered that the
"svg-print" function adds extra space in front of the XML
representation of each child node. This is usually not a problem
because, by default, extra spaces are ignored. But this becomes a
problem, especially for text nodes, when the `xml:space' attribute is
set to "preserve" to indicate that spaces in texts are not
ignored. Because, in this case, the XML representation of the text node
no longer corresponds to the original definition, including unwanted
additional spaces.
Here are two examples which illustrate the problem to be evaluated in
the *scratch* buffer (emacs -Q):
(require 'svg)
;; Simple text with extra spaces between words.
(let* ((text "This buffer is for text that is not saved.")
(w (* (length text) (default-font-width)))
(h (* 1.5 (default-font-height)))
(xmlspace "preserve") ;; Rendering preserves spaces.
(svg (svg-create w h :xml:space xmlspace :stroke-width 0)))
(svg-rectangle svg 0 0 w h :fill "blue")
(svg-text svg text :y "1em" :fill "white")
(insert-image (svg-image svg :scale 1)))
;; Aggregate texts separated by 1 space.
(let* ((texts '("This buffer is "
"for text that "
"is not saved."))
(w (* (apply #'+ (mapcar #'length texts))
(default-font-width)))
(h (* 1.5 (default-font-height)))
(xmlspace "preserve") ;; Rendering preserves spaces.
(svg (svg-create w h :xml:space xmlspace :stroke-width 0)))
(svg-rectangle svg 0 0 w h :fill "blue")
(dom-append-child
svg
(apply #'dom-node
'text
'((y . "1em") (fill . "white"))
texts))
(insert-image (svg-image svg :scale 1)))
Since the extra space in front of the XML representation of each child
node is unnecessary according to the SVG 1.1 specification, the attached
V0 patch resolves this issue by removing the offending statement.
The attached V1 patch is a proposal to go a step further by improving
the documentation and using the DOM API to access parts of dom node.
Thanks.
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.42, cairo version 1.18.0) of 2024-07-17
Repository revision: 3a790abd869ddadc343710deb0c4368227ba6611
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 40 (KDE Plasma)
Configured using:
'configure --with-x-toolkit=gtk3 --with-cairo-xcb
--with-native-compilation=no
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Important settings:
value of $LC_TIME: fr_FR.utf8
value of $LANG: fr_FR.UTF-8
locale-coding-system: utf-8-unix
[svg-print-V1.patch (text/x-patch, attachment)]
[svg-print-V0.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72199
; Package
emacs
.
(Fri, 19 Jul 2024 18:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 72199 <at> debbugs.gnu.org (full text, mbox):
Hello,
Please close this one as duplicate of #72198.
I resent it after a couple of hours because I didn't receive the Acknowledgement for #72198.
Thanks!
Reply sent
to
Stefan Kangas <stefankangas <at> gmail.com>
:
You have taken responsibility.
(Fri, 19 Jul 2024 20:14:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
David Ponce <da_vid <at> orange.fr>
:
bug acknowledged by developer.
(Fri, 19 Jul 2024 20:14:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 72199-done <at> debbugs.gnu.org (full text, mbox):
David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:
> Please close this one as duplicate of #72198.
Done.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 17 Aug 2024 11:24:17 GMT)
Full text and
rfc822 format available.
This bug report was last modified 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.