GNU bug report logs - #52599
29.0.50; Unproportional Unicode character scale in SVG overlay

Previous Next

Package: emacs;

Reported by: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>

Date: Sat, 18 Dec 2021 11:51:02 UTC

Severity: normal

Tags: moreinfo

Found in version 29.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 52599 in the body.
You can then email your comments to 52599 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sat, 18 Dec 2021 11:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 18 Dec 2021 11:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Unproportional Unicode character scale in SVG overlay
Date: Sat, 18 Dec 2021 14:50:41 +0300
[Message part 1 (text/plain, inline)]
When buffer contains SVG overlay with Unicode characters, changing font
size via `text-scale-increase` and `text-scale-decrease` causes these
Unicode characters to change size unproportionally to the Latin
characters. Their size changes faster: they shrink faster then Latin
characters and they grow faster then Latin characters.
Example of the math equation containing Unicode characters with
different scale is showin in picture https://imgur.com/3Ul8i74.

Way to reproduce:
1. In a new buffer insert some text
  ```
  1234567890
  ```
2. Add SVG overlay by evaluating command (Alt+Shift+:)
  ```elisp
  (let ((o (make-overlay 0 11)))
  (overlay-put o 'display
               (list (cons 'image
                           (list :type 'svg
                                 :data "<svg
xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"15.639ex\"
height=\"5.343ex\" style=\"vertical-align: -2.171ex;\" viewBox=\"0 -
1365.4 6733.3 2300.3\" role=\"img\" focusable=\"false\"
xmlns=\"http://www.w3.org/2000/svg\" aria-labelledby=\"MathJax-SVG-1-
Title\">
<title id=\"MathJax-SVG-1-
Title\">\\newcommand{textup}[1]{#1}x^a_b\\quad
x^б_ю\\quad\\frac{a}{а}\\quad\\frac{a}{Ì}</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-MJMATHI-61\" d=\"M33 157Q33 258 109
349T280 441Q331 441 370 392Q386 422 416 422Q429 422 439 414T449 394Q449
381 412 234T374 68Q374 43 381 35T402 26Q411 27 422 35Q443 55 463
131Q469 151 473 152Q475 153 483 153H487Q506 153 506 144Q506 138 501
117T481 63T449 13Q436 0 417 -8Q409 -10 393 -10Q359 -10 336 5T306 36L300
51Q299 52 296 50Q294 48 292 46Q233 -10 172 -10Q117 -10 75 30T33
157ZM351 328Q351 334 346 350T323 385T277 405Q242 405 210 374T160
293Q131 214 119 129Q119 126 119 118T118 106Q118 61 136 44T179 26Q217 26
254 59T298 110Q300 114 325 217T351 328Z\"></path>
<path stroke-width=\"1\" id=\"E1-MJMATHI-62\" d=\"M73 647Q73 657 77
670T89 683Q90 683 161 688T234 694Q246 694 246 685T212 542Q204 508 195
472T180 418L176 399Q176 396 182 402Q231 442 283 442Q345 442 383 396T422
280Q422 169 343 79T173 -11Q123 -11 82 27T40 150V159Q40 180 48 217T97
414Q147 611 147 623T109 637Q104 637 101 637H96Q86 637 83 637T76 640T73
647ZM336 325V331Q336 405 275 405Q258 405 240 397T207 376T181 352T163
330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 26 178 26Q211 26
245 58Q270 81 285 114T318 219Q336 291 336 325Z\"></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-MJMATHI-61\"
x=\"809\" y=\"498\"></use>
 <use transform=\"scale(0.707)\" xlink:href=\"#E1-MJMATHI-62\"
x=\"809\" y=\"-463\"></use>
<g transform=\"translate(2046,0)\">
 <use xlink:href=\"#E1-MJMATHI-78\" x=\"0\" y=\"0\"></use>
<g transform=\"translate(572,648)\">
<text font-family=\"monospace\" stroke=\"none\"
transform=\"scale(50.74127551116547) matrix(1 0 0 -1 0 0)\">б</text>
</g>
<g transform=\"translate(572,-445)\">
<text font-family=\"monospace\" stroke=\"none\"
transform=\"scale(50.74127551116547) matrix(1 0 0 -1 0 0)\">ю</text>
</g>
</g>
<g transform=\"translate(4150,0)\">
<g transform=\"translate(120,0)\">
<rect stroke=\"none\" width=\"551\" height=\"60\" x=\"0\"
y=\"220\"></rect>
 <use transform=\"scale(0.707)\" xlink:href=\"#E1-MJMATHI-61\"
x=\"125\" y=\"639\"></use>
<g transform=\"translate(60,-554)\">
<text font-family=\"monospace\" stroke=\"none\"
transform=\"scale(50.74127551116547) matrix(1 0 0 -1 0 0)\">а</text>
</g>
</g>
</g>
<g transform=\"translate(5942,0)\">
<g transform=\"translate(120,0)\">
<rect stroke=\"none\" width=\"551\" height=\"60\" x=\"0\"
y=\"220\"></rect>
 <use transform=\"scale(0.707)\" xlink:href=\"#E1-MJMATHI-61\"
x=\"125\" y=\"639\"></use>
<g transform=\"translate(60,-554)\">
<text font-family=\"monospace\" stroke=\"none\"
transform=\"scale(50.74127551116547) matrix(1 0 0 -1 0 0)\">Ì</text>
</g>
</g>
</g>
</g>
</svg>")))))
  ```
3. Change font size calling functions `text-scale-increase` and
`text-scale-decrease` repeatedly and observe unproportional size change

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.16.0)
 of 2021-12-17 built on KILLINGMACHINE
Repository revision: cf33ece31016828ceeeee1154a4fc057957eefbc
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version
11.0.12013000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix=/opt/emacs28 --with-all --with-xaw3d
 --with-xwidgets --with-imagemagick --with-native-compilation'

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

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

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-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
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/opt/emacs28/share/emacs/29.0.50/lisp/emacs-lisp/eieio-compat hides
/opt/emacs28/share/emacs/29.0.50/lisp/obsolete/eieio-compat

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
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 seq gv subr-x byte-opt 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 iso-transl tooltip
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode 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 lisp-mode prog-mode register page tab-bar menu-bar rfn-
eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock
syntax
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 emoji-zwj 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 keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-
toolkit
x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 66356 11011)
 (symbols 48 6846 1)
 (strings 32 21253 3113)
 (string-bytes 1 764511)
 (vectors 16 14490)
 (vector-slots 8 275786 14211)
 (floats 8 26 103)
 (intervals 56 351 0)
 (buffers 992 13))

-- 
С Уважением,
С.В. Мациевский

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sat, 18 Dec 2021 12:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50;
 Unproportional Unicode character scale in SVG overlay
Date: Sat, 18 Dec 2021 14:04:21 +0200
> From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> Date: Sat, 18 Dec 2021 14:50:41 +0300
> 
> When buffer contains SVG overlay with Unicode characters, changing font
> size via `text-scale-increase` and `text-scale-decrease` causes these
> Unicode characters to change size unproportionally to the Latin
> characters. Their size changes faster: they shrink faster then Latin
> characters and they grow faster then Latin characters.
> Example of the math equation containing Unicode characters with
> different scale is showin in picture https://imgur.com/3Ul8i74.
> 
> Way to reproduce:

Could you please post the Lisp code as an attachment, not inline, and
not in Org or Markdown format, but as plain Lisp code?  I tried to
reproduce the problem, but the NBSP characters and probably something
else in your mail made the image unreadable, so I couldn't
investigate.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sat, 18 Dec 2021 12:14:02 GMT) Full text and rfc822 format available.

Message #11 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sat, 18 Dec 2021 15:13:15 +0300
[Message part 1 (text/plain, inline)]
Attaching ELisp code

-- 
Best regards,
Sergey Matsievskiy


On Sat, 2021-12-18 at 14:04 +0200, Eli Zaretskii wrote:
> > From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> > Date: Sat, 18 Dec 2021 14:50:41 +0300
> > 
> > When buffer contains SVG overlay with Unicode characters, changing
> > font
> > size via `text-scale-increase` and `text-scale-decrease` causes
> > these
> > Unicode characters to change size unproportionally to the Latin
> > characters. Their size changes faster: they shrink faster then
> > Latin
> > characters and they grow faster then Latin characters.
> > Example of the math equation containing Unicode characters with
> > different scale is showin in picture https://imgur.com/3Ul8i74.
> > 
> > Way to reproduce:
> 
> Could you please post the Lisp code as an attachment, not inline, and
> not in Org or Markdown format, but as plain Lisp code?  I tried to
> reproduce the problem, but the NBSP characters and probably something
> else in your mail made the image unreadable, so I couldn't
> investigate.
> 
> Thanks.
[svgoverlay.el (text/x-emacs-lisp, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sat, 18 Dec 2021 12:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sat, 18 Dec 2021 14:51:30 +0200
> From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> Cc: 52599 <at> debbugs.gnu.org
> Date: Sat, 18 Dec 2021 15:13:15 +0300
> 
> Attaching ELisp code

Thanks.

In my testing, the size of the font in the image doesn't change at all
when I increase or decrease the text scale in the buffer.

I think whether the font changes is up to librsvg and the font backend
it uses, and Emacs does not necessarily have a way of controlling
that.  But I'm not an expert on SVG and the library, so perhaps
someone else could chime in.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sat, 18 Dec 2021 14:10:02 GMT) Full text and rfc822 format available.

Message #17 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sat, 18 Dec 2021 17:09:39 +0300
[Message part 1 (text/plain, inline)]
I've downgraded librsvg from 2.50.7 to 2.50.3 and got the same result.

-- 
Best regards,
Sergey Matsievskiy


On Sat, 2021-12-18 at 14:51 +0200, Eli Zaretskii wrote:
> > From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> > Cc: 52599 <at> debbugs.gnu.org
> > Date: Sat, 18 Dec 2021 15:13:15 +0300
> > 
> > Attaching ELisp code
> 
> Thanks.
> 
> In my testing, the size of the font in the image doesn't change at
> all
> when I increase or decrease the text scale in the buffer.
> 
> I think whether the font changes is up to librsvg and the font
> backend
> it uses, and Emacs does not necessarily have a way of controlling
> that.  But I'm not an expert on SVG and the library, so perhaps
> someone else could chime in.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sun, 19 Dec 2021 11:16:01 GMT) Full text and rfc822 format available.

Message #20 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sun, 19 Dec 2021 12:15:19 +0100
[Message part 1 (text/plain, inline)]
"Matsievskiy S.V." <seregaxvm.main <at> gmail.com> writes:

> When buffer contains SVG overlay with Unicode characters, changing font
> size via `text-scale-increase` and `text-scale-decrease` causes these
> Unicode characters to change size unproportionally to the Latin
> characters. Their size changes faster: they shrink faster then Latin
> characters and they grow faster then Latin characters.
> Example of the math equation containing Unicode characters with
> different scale is showin in picture https://imgur.com/3Ul8i74.

The SVG seems to be very odd without changing the font size.  When I
eval the test case, I get:

[Message part 2 (image/png, inline)]
[Message part 3 (text/plain, inline)]
Is it supposed to look this way?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 19 Dec 2021 11:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sun, 19 Dec 2021 11:56:01 GMT) Full text and rfc822 format available.

Message #25 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sun, 19 Dec 2021 14:55:08 +0300
[Message part 1 (text/plain, inline)]
You've probably set your frame font size. Running with emacs -Q
produces image emacs.png. Firefox produces almost the same image
firefox.png.

-- 
Best regards,
Sergey Matsievskiy


On Sun, 2021-12-19 at 12:15 +0100, Lars Ingebrigtsen wrote:
> "Matsievskiy S.V." <seregaxvm.main <at> gmail.com> writes:
> 
> > When buffer contains SVG overlay with Unicode characters, changing
> > font
> > size via `text-scale-increase` and `text-scale-decrease` causes
> > these
> > Unicode characters to change size unproportionally to the Latin
> > characters. Their size changes faster: they shrink faster then
> > Latin
> > characters and they grow faster then Latin characters.
> > Example of the math equation containing Unicode characters with
> > different scale is showin in picture https://imgur.com/3Ul8i74.
> 
> The SVG seems to be very odd without changing the font size.  When I
> eval the test case, I get:
> 
> 
> Is it supposed to look this way?
> 
[emacs.png (image/png, attachment)]
[firefox.png (image/png, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sun, 19 Dec 2021 12:08:02 GMT) Full text and rfc822 format available.

Message #28 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sun, 19 Dec 2021 13:07:09 +0100
"Matsievskiy S.V." <seregaxvm.main <at> gmail.com> writes:

> You've probably set your frame font size. Running with emacs -Q
> produces image emacs.png. Firefox produces almost the same image
> firefox.png.

I did my test with "emacs -Q" (on Debian/bookworm).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sun, 19 Dec 2021 12:12:02 GMT) Full text and rfc822 format available.

Message #31 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52599 <at> debbugs.gnu.org, "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sun, 19 Dec 2021 13:11:35 +0100
[Message part 1 (text/plain, inline)]
On Sun, 19 Dec 2021 12:15:19 +0100 Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> "Matsievskiy S.V." <seregaxvm.main <at> gmail.com> writes:
>
>> When buffer contains SVG overlay with Unicode characters, changing font
>> size via `text-scale-increase` and `text-scale-decrease` causes these
>> Unicode characters to change size unproportionally to the Latin
>> characters. Their size changes faster: they shrink faster then Latin
>> characters and they grow faster then Latin characters.
>> Example of the math equation containing Unicode characters with
>> different scale is showin in picture https://imgur.com/3Ul8i74.
>
> The SVG seems to be very odd without changing the font size.

I can reproduce the problem:

[svg.png (image/png, attachment)]
[Message part 3 (text/plain, inline)]
This is with Emacs 29.0.50, librsvg-2.50.6, GTK+ 3.24.29, cairo 1.17.4

Steve Berman

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sun, 19 Dec 2021 12:14:01 GMT) Full text and rfc822 format available.

Message #34 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 52599 <at> debbugs.gnu.org, "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sun, 19 Dec 2021 13:13:26 +0100
Stephen Berman <stephen.berman <at> gmx.net> writes:

> I can reproduce the problem:

Perhaps HiDPI settings also have an influence on how the characters are
scaled (I'm using a 4K 14" screen)?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Sun, 19 Dec 2021 14:32:02 GMT) Full text and rfc822 format available.

Message #37 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 52599 <at> debbugs.gnu.org, "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Sun, 19 Dec 2021 15:31:01 +0100
On Sun, 19 Dec 2021 13:13:26 +0100 Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> I can reproduce the problem:
>
> Perhaps HiDPI settings also have an influence on how the characters are
> scaled (I'm using a 4K 14" screen)?

Could be.  I have a 27" screen with (according xdpyinfo) 2560x1440
pixels and 96x96 DPI.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Mon, 20 Dec 2021 16:32:02 GMT) Full text and rfc822 format available.

Message #40 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52599 <at> debbugs.gnu.org, "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Mon, 20 Dec 2021 16:31:14 +0000
On Sat, Dec 18, 2021 at 02:51:30PM +0200, Eli Zaretskii wrote:
> > From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> > Cc: 52599 <at> debbugs.gnu.org
> > Date: Sat, 18 Dec 2021 15:13:15 +0300
> > 
> > Attaching ELisp code
> 
> Thanks.
> 
> In my testing, the size of the font in the image doesn't change at all
> when I increase or decrease the text scale in the buffer.
> 
> I think whether the font changes is up to librsvg and the font backend
> it uses, and Emacs does not necessarily have a way of controlling
> that.  But I'm not an expert on SVG and the library, so perhaps
> someone else could chime in.

I *think* what's going on here is that the image size is defined in
terms of "ex", but when using librsvg < 2.52 we have no idea what the
ex height should be, so we use a fall-back mechanism to calculate the
image size.

Additionally most of the text is vector paths, not text, so it doesn't
scale with the font size change, but some of it *is* text, so it
*does* scale.

So what we end up with is that the text scales directly according to
the font size and the paths scale according to whatever nonsense
librsvg returns for the image size.

You could work around this by hard-coding the font size in the SVG or
pass in some CSS to over-ride Emacs's default. I'd suggest hard-coding
it in the image if possible as the default CSS contains colour
information too.

(Or we could try and work out the real ex height, but we would
probably have to copy how librsvg calculates ex height, which I have a
suspicion will be some constant fraction of an em instead of the
font's real ex height.)

-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Tue, 21 Dec 2021 12:16:01 GMT) Full text and rfc822 format available.

Message #43 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Tue, 21 Dec 2021 15:15:44 +0300
[Message part 1 (text/plain, inline)]
> So what we end up with is that the text scales directly according to
> the font size and the paths scale according to whatever nonsense
> librsvg returns for the image size. 

Aren't these characters associated with the svg overlay? If so, it
should be possible to apply image scaling rules to them, or is it too
much work?

-- 
Best regards,
Sergey Matsievskiy


On Mon, 2021-12-20 at 16:31 +0000, Alan Third wrote:
> On Sat, Dec 18, 2021 at 02:51:30PM +0200, Eli Zaretskii wrote:
> > > From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
> > > Cc: 52599 <at> debbugs.gnu.org
> > > Date: Sat, 18 Dec 2021 15:13:15 +0300
> > > 
> > > Attaching ELisp code
> > 
> > Thanks.
> > 
> > In my testing, the size of the font in the image doesn't change at
> > all
> > when I increase or decrease the text scale in the buffer.
> > 
> > I think whether the font changes is up to librsvg and the font
> > backend
> > it uses, and Emacs does not necessarily have a way of controlling
> > that.  But I'm not an expert on SVG and the library, so perhaps
> > someone else could chime in.
> 
> I *think* what's going on here is that the image size is defined in
> terms of "ex", but when using librsvg < 2.52 we have no idea what the
> ex height should be, so we use a fall-back mechanism to calculate the
> image size.
> 
> Additionally most of the text is vector paths, not text, so it
> doesn't
> scale with the font size change, but some of it *is* text, so it
> *does* scale.
> 
> So what we end up with is that the text scales directly according to
> the font size and the paths scale according to whatever nonsense
> librsvg returns for the image size.
> 
> You could work around this by hard-coding the font size in the SVG or
> pass in some CSS to over-ride Emacs's default. I'd suggest hard-
> coding
> it in the image if possible as the default CSS contains colour
> information too.
> 
> (Or we could try and work out the real ex height, but we would
> probably have to copy how librsvg calculates ex height, which I have
> a
> suspicion will be some constant fraction of an em instead of the
> font's real ex height.)
> 
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Tue, 21 Dec 2021 20:57:02 GMT) Full text and rfc822 format available.

Message #46 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Tue, 21 Dec 2021 20:55:56 +0000
On Tue, Dec 21, 2021 at 03:15:44PM +0300, Matsievskiy S.V. wrote:
> > So what we end up with is that the text scales directly according to
> > the font size and the paths scale according to whatever nonsense
> > librsvg returns for the image size. 
> 
> Aren't these characters associated with the svg overlay? If so, it
> should be possible to apply image scaling rules to them, or is it too
> much work?

To just use image scaling rules set the css to "". That way increasing
the font size won't change the font size in the image and this problem
won't rear it's ugly head.

I suspect this should be considered a bug in the mathjax output. It's
relying on the default font being a specific size, and when it's not
then the scaling goes all wonky. I guess this means they expect that
all SVG renderers always use the exact same font size?

Or is there some custom mathjax CSS that's supposed to be applied?
I've had a quick look at the mathjax documentation and it doesn't look
like it. They say that SVG output doesn't use text directly so is
unaffected by font problems. 😒

I don't think we want to change our default CSS to not set the font
size as that would make using SVGs in-line with text more complicated.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Wed, 22 Dec 2021 08:50:02 GMT) Full text and rfc822 format available.

Message #49 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
To: Alan Third <alan <at> idiocy.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 52599 <at> debbugs.gnu.org
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Wed, 22 Dec 2021 11:49:26 +0300
[Message part 1 (text/plain, inline)]
> Or is there some custom mathjax CSS that's supposed to be applied?

I ended up exposing ex size configuration to customize.

I'm fine with leaving things as they are now and just wait for MathJax
to add more fonts in future releases.

-- 
Best regards,
S.V. Matsievskiy

On Tue, 2021-12-21 at 20:55 +0000, Alan Third wrote:
> On Tue, Dec 21, 2021 at 03:15:44PM +0300, Matsievskiy S.V. wrote:
> > > So what we end up with is that the text scales directly according
> > > to
> > > the font size and the paths scale according to whatever nonsense
> > > librsvg returns for the image size. 
> > 
> > Aren't these characters associated with the svg overlay? If so, it
> > should be possible to apply image scaling rules to them, or is it
> > too
> > much work?
> 
> To just use image scaling rules set the css to "". That way
> increasing
> the font size won't change the font size in the image and this
> problem
> won't rear it's ugly head.
> 
> I suspect this should be considered a bug in the mathjax output. It's
> relying on the default font being a specific size, and when it's not
> then the scaling goes all wonky. I guess this means they expect that
> all SVG renderers always use the exact same font size?
> 
> Or is there some custom mathjax CSS that's supposed to be applied?
> I've had a quick look at the mathjax documentation and it doesn't
> look
> like it. They say that SVG output doesn't use text directly so is
> unaffected by font problems. 😒
> 
> I don't think we want to change our default CSS to not set the font
> size as that would make using SVGs in-line with text more
> complicated.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52599; Package emacs. (Fri, 21 Jan 2022 13:37:02 GMT) Full text and rfc822 format available.

Message #52 received at 52599 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alan Third <alan <at> idiocy.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 52599 <at> debbugs.gnu.org,
 "Matsievskiy S.V." <seregaxvm.main <at> gmail.com>
Subject: Re: bug#52599: 29.0.50; Unproportional Unicode character scale in
 SVG overlay
Date: Fri, 21 Jan 2022 14:36:20 +0100
Alan Third <alan <at> idiocy.org> writes:

> I don't think we want to change our default CSS to not set the font
> size as that would make using SVGs in-line with text more complicated.

Re-skimming this thread, if I understand correctly, there's nothing here
that can be fixed on the Emacs side -- we're scaling the characters, but
not the non-characters, which leads to odd effects.  But we don't want
to stop doing that, either, so it should be fixed by the thing that uses
these SVGs.  So I'm closing this bug report; if there's more that can be
done, please respond to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 52599 <at> debbugs.gnu.org and "Matsievskiy S.V." <seregaxvm.main <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 21 Jan 2022 13:37:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 19 Feb 2022 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.