GNU bug report logs - #61974
29.0.60; customize checkbox and radio widgets don't render on macOS

Previous Next

Package: emacs;

Reported by: David Caldwell <david <at> porkrind.org>

Date: Sun, 5 Mar 2023 01:36:02 UTC

Severity: normal

Found in version 29.0.60

To reply to this bug, email your comments to 61974 AT debbugs.gnu.org.

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#61974; Package emacs. (Sun, 05 Mar 2023 01:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Caldwell <david <at> porkrind.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Mar 2023 01:36:02 GMT) Full text and rfc822 format available.

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

From: David Caldwell <david <at> porkrind.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; customize checkbox and radio widgets don't render on macOS
Date: Sat, 4 Mar 2023 17:35:16 -0800
To reproduce:

  M-x customize-face RET bold RET

It can be any face, that's just an example. In the customize buffer
click or select the "Show All Attributes" button/link at the bottom. The
attributes should have checkboxes in checked or unchecked states but
none show up. Here's a screenshot (the cyan square is my cursor over
where a checkbox should be rendered):

https://porkrind.org/tmp/emacs29-customize-bug-macos.png

This happens in radio buttons too, but I don't know which
customize setting use those.

This also happens in Emacs 28. I have not tried the master branch yet.

I tried to track this down and found that even inserting the checkbox
image fails, though I can insert other SVGs:

Fails:

  (insert-image (find-image '((:file "checked.svg"))))

Works:

  (insert-image (find-image '((:file "splash.svg"))))

It appears to be because the checkbox and radio svgs in etc/images all
use height="1em" and the mac native renderer doesn't like that.

It works with rsvg because the emacs code that interfaces with rsvg code
passes some extra styling info to it so that it can render that properly
(image.c:11226 in the emacs-29 branch for me today).

Unfortunately the native renderer in nsimage.m doesn't do this. I spent
some time today trying to figure it out, but it appears that the cocoa
apis just don't have this feature, so it would have to be done some
other way.

I can confirm this is the issue by opening "etc/images/checked.svg",
hitting "C-c C-c" to edit, changing the "1em" to "16" and "C-c C-c"ing
again to re-render it. It will appear with a non-percentage height.

I really wanted to suggest a fix or a patch, but I'm stuck because I
don't want to flat out turn off svgs on macOS, but I also don't want to
get rid of the nice scaling that librsvg supports. Maybe nsimage.m
should load the svg into memory, check for width or height being "1em"
and manually changing it to something concrete before passing it to the
OS?  Yuck, but also it would probably work.

-David

In GNU Emacs 29.0.60 (build 1, aarch64-apple-darwin22.1.0, NS
 appkit-2299.00 Version 13.0.1 (Build 22A400)) of 2023-03-04 built on
 black.local
Repository revision: bd5115e13479b1d81d6aa09efe362ad14d53c3c6
Repository branch: emacs-29
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.0.1

Configured features:
ACL DBUS GIF GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS
PDUMPER PNG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
XIM ZLIB

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

Major mode: Custom

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
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x crm
thingatpt cus-edit pp cus-start cus-load icons wid-edit cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win 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 nadvice seq simple cl-generic
indonesian philippine 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 abbrev obarray oclosure cl-preloaded button loaddefs
theme-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 dbusbind kqueue cocoa ns
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 68647 5810)
 (symbols 48 7188 0)
 (strings 32 18140 1297)
 (string-bytes 1 468742)
 (vectors 16 11324)
 (vector-slots 8 174536 16175)
 (floats 8 38 31)
 (intervals 56 1508 3)
 (buffers 984 13))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61974; Package emacs. (Sun, 05 Mar 2023 06:26:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: David Caldwell <david <at> porkrind.org>
Cc: 61974 <at> debbugs.gnu.org
Subject: Re: bug#61974: 29.0.60;
 customize checkbox and radio widgets don't render on macOS
Date: Sun, 05 Mar 2023 08:25:22 +0200
> Date: Sat, 4 Mar 2023 17:35:16 -0800
> From: David Caldwell <david <at> porkrind.org>
> 
> Fails:
> 
>    (insert-image (find-image '((:file "checked.svg"))))
> 
> Works:
> 
>    (insert-image (find-image '((:file "splash.svg"))))
> 
> It appears to be because the checkbox and radio svgs in etc/images all
> use height="1em" and the mac native renderer doesn't like that.
> 
> It works with rsvg because the emacs code that interfaces with rsvg code
> passes some extra styling info to it so that it can render that properly
> (image.c:11226 in the emacs-29 branch for me today).
> 
> Unfortunately the native renderer in nsimage.m doesn't do this. I spent
> some time today trying to figure it out, but it appears that the cocoa
> apis just don't have this feature, so it would have to be done some
> other way.
> 
> I can confirm this is the issue by opening "etc/images/checked.svg",
> hitting "C-c C-c" to edit, changing the "1em" to "16" and "C-c C-c"ing
> again to re-render it. It will appear with a non-percentage height.

Does it work to use the checked.xpm image instead?  If it does,
perhaps we should switch the macOS build to using the XPM images
(assuming the problem you report is common to all macOS builds, that
is).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61974; Package emacs. (Sun, 05 Mar 2023 08:02:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61974 <at> debbugs.gnu.org, David Caldwell <david <at> porkrind.org>
Subject: Re: bug#61974: 29.0.60; customize checkbox and radio widgets don't
 render on macOS
Date: Sun, 05 Mar 2023 16:01:10 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Sat, 4 Mar 2023 17:35:16 -0800
>> From: David Caldwell <david <at> porkrind.org>
>> 
>> Fails:
>> 
>>    (insert-image (find-image '((:file "checked.svg"))))
>> 
>> Works:
>> 
>>    (insert-image (find-image '((:file "splash.svg"))))
>> 
>> It appears to be because the checkbox and radio svgs in etc/images all
>> use height="1em" and the mac native renderer doesn't like that.
>> 
>> It works with rsvg because the emacs code that interfaces with rsvg code
>> passes some extra styling info to it so that it can render that properly
>> (image.c:11226 in the emacs-29 branch for me today).
>> 
>> Unfortunately the native renderer in nsimage.m doesn't do this. I spent
>> some time today trying to figure it out, but it appears that the cocoa
>> apis just don't have this feature, so it would have to be done some
>> other way.
>> 
>> I can confirm this is the issue by opening "etc/images/checked.svg",
>> hitting "C-c C-c" to edit, changing the "1em" to "16" and "C-c C-c"ing
>> again to re-render it. It will appear with a non-percentage height.
>
> Does it work to use the checked.xpm image instead?  If it does,
> perhaps we should switch the macOS build to using the XPM images
> (assuming the problem you report is common to all macOS builds, that
> is).

Shouldn't we disable SVG display with native image APIs instead?
In general, the native image API code we have at present cannot
display SVG images as well as librsvg, because it cannot know the
scale at which the image will be displayed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61974; Package emacs. (Sun, 05 Mar 2023 08:28:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 61974 <at> debbugs.gnu.org, david <at> porkrind.org
Subject: Re: bug#61974: 29.0.60; customize checkbox and radio widgets don't
 render on macOS
Date: Sun, 05 Mar 2023 10:26:45 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: David Caldwell <david <at> porkrind.org>,  61974 <at> debbugs.gnu.org
> Date: Sun, 05 Mar 2023 16:01:10 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Date: Sat, 4 Mar 2023 17:35:16 -0800
> >> From: David Caldwell <david <at> porkrind.org>
> >> 
> >> Fails:
> >> 
> >>    (insert-image (find-image '((:file "checked.svg"))))
> >> 
> >> Works:
> >> 
> >>    (insert-image (find-image '((:file "splash.svg"))))
> >> 
> >> It appears to be because the checkbox and radio svgs in etc/images all
> >> use height="1em" and the mac native renderer doesn't like that.
> >> 
> >> It works with rsvg because the emacs code that interfaces with rsvg code
> >> passes some extra styling info to it so that it can render that properly
> >> (image.c:11226 in the emacs-29 branch for me today).
> >> 
> >> Unfortunately the native renderer in nsimage.m doesn't do this. I spent
> >> some time today trying to figure it out, but it appears that the cocoa
> >> apis just don't have this feature, so it would have to be done some
> >> other way.
> >> 
> >> I can confirm this is the issue by opening "etc/images/checked.svg",
> >> hitting "C-c C-c" to edit, changing the "1em" to "16" and "C-c C-c"ing
> >> again to re-render it. It will appear with a non-percentage height.
> >
> > Does it work to use the checked.xpm image instead?  If it does,
> > perhaps we should switch the macOS build to using the XPM images
> > (assuming the problem you report is common to all macOS builds, that
> > is).
> 
> Shouldn't we disable SVG display with native image APIs instead?
> In general, the native image API code we have at present cannot
> display SVG images as well as librsvg, because it cannot know the
> scale at which the image will be displayed.

My impression was that such a conclusion would be too drastic, as many
SVG images can undoubtedly be displayed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61974; Package emacs. (Sun, 05 Mar 2023 10:43:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61974 <at> debbugs.gnu.org, david <at> porkrind.org
Subject: Re: bug#61974: 29.0.60; customize checkbox and radio widgets don't
 render on macOS
Date: Sun, 05 Mar 2023 18:42:18 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> My impression was that such a conclusion would be too drastic, as many
> SVG images can undoubtedly be displayed.

I don't know... Emacs code has never been prepared for native SVG
display before, as this is a new feature in Mac OS.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61974; Package emacs. (Sun, 05 Mar 2023 20:27:02 GMT) Full text and rfc822 format available.

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

From: David Caldwell <david <at> porkrind.org>
To: Po Lu <luangruo <at> yahoo.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 61974 <at> debbugs.gnu.org
Subject: Re: bug#61974: 29.0.60; customize checkbox and radio widgets don't
 render on macOS
Date: Sun, 5 Mar 2023 12:26:13 -0800
On 3/5/23 2:42 AM, Po Lu wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
>> My impression was that such a conclusion would be too drastic, as many
>> SVG images can undoubtedly be displayed.
> 
> I don't know... Emacs code has never been prepared for native SVG
> display before, as this is a new feature in Mac OS.

The splash screen renders nicely, at least.

I poked around a little more and found that the OS seems to be just 
ignoring the "em" in "height=1em" and setting its height to 1. I thought 
maybe if I forced the image height to something reasonable that it would 
render but it doesn't change anything--still just a blank image.

One thought I had was that maybe Emacs is approaching this 
backward—currently the widget code says "please draw the checkbox here" 
and the checkbox svg says "I should be one lineheight high please". What 
if it instead the widget code said "Please draw the checkbox image here 
with the height of my line" and the image said nothing.

The complication there is that you probably don't want to scale 
non-vector images.

But that also is kind of a drastic change.




This bug report was last modified 1 year and 45 days ago.

Previous Next


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