unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52542: 29.0.50; Emoji makes lines taller
@ 2021-12-16  8:28 Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-16  8:34 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-16  8:28 UTC (permalink / raw)
  To: 52542

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]


On macOS 11/12, in Emacs 28/29, any emoji (e.g. alien) makes the line with it taller than the lines with no emojis, which breaks various things across Emacs, such as avatars in telega.el (see the attachment).

To reproduce:

1. start 'emacs -Q'

2. type

> foo
> 👽 bar
> baz

3. delete the alien

Actual: the line with "bar" becomes less tall

Expected: all lines always have constant height


[-- Attachment #2: Broken avatars in Telega --]
[-- Type: image/png, Size: 31201 bytes --]

[-- Attachment #3: Type: text/plain, Size: 5822 bytes --]



In GNU Emacs 29.0.50 (build 10, x86_64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build 21A559))
 of 2021-12-15 built on Workstation.local
Repository revision: 5a057f6716e6991a60968e48f849da57a0339735
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.1

Configured using:
 'configure --with-json --with-xwidgets --with-native-compilation'

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

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

Major mode: ◁Chat

Minor modes in effect:
  flymake-mode: t
  telega-root-auto-fill-mode: t
  telega-active-locations-mode: t
  telega-patrons-mode: t
  telega-mode-line-mode: t
  cursor-sensor-mode: t
  cursor-intangible-mode: t
  corfu-global-mode: t
  corfu-mode: t
  vertico-mode: t
  marginalia-mode: t
  global-diff-hl-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-hl-todo-mode: t
  global-subword-mode: t
  subword-mode: t
  save-place-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: (only . t)

Load-path shadows:
/Users/salutis/.emacs.d/elpa/transient-20211208.1819/transient hides /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/transient
/Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/emacs-lisp/eieio-compat hides /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/obsolete/eieio-compat

Features:
(shadow sort bbdb-message fortune mail-extr flymake-proc flymake project
compile thingatpt telega-obsolete telega telega-tdlib-events
telega-webpage visual-fill-column telega-root telega-info telega-chat
telega-modes image-mode exif telega-company telega-user
telega-notifications notifications dbus telega-voip telega-msg
telega-tme telega-sticker telega-i18n telega-vvnote bindat telega-ffplay
telega-media telega-sort telega-filter telega-ins telega-folders
telega-inline telega-tdlib telega-util rainbow-identifiers org-element
avl-tree generator dired-aux color telega-server telega-core
telega-customize svg dom xml cus-edit pp cus-start cus-load wid-edit
emacsbug message yank-media rmc puny ls-lisp dired dired-loaddefs rfc822
mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs 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 char-fold orderless
cursor-sensor paredit edmacro kmacro display-fill-column-indicator bbdb
bbdb-site timezone modus-vivendi-theme modus-operandi-theme modus-themes
corfu vertico marginalia pdf-loader diff-hl log-view pcvs-util vc-dir
ewoc vc vc-dispatcher diff-mode diminish yasnippet hl-todo finder-inf
org-clock cl cap-words superword subword saveplace autorevert filenotify
comp comp-cstr warnings delsel savehist cl-extra help-mode org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601
time-date ol rx org-keys oc org-compat advice org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs tex-site info
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip 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 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 kqueue cocoa ns lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 2495091 82347)
 (symbols 48 34673 7)
 (strings 32 209053 7327)
 (string-bytes 1 6227643)
 (vectors 16 76932)
 (vector-slots 8 2967146 166567)
 (floats 8 11146 508)
 (intervals 56 14894 2318)
 (buffers 992 14))

-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic.'" -- Lewis Carroll, Through the Looking Glass

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#52542: 29.0.50; Emoji makes lines taller
  2021-12-16  8:28 bug#52542: 29.0.50; Emoji makes lines taller Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-16  8:34 ` Eli Zaretskii
  2021-12-17 21:57   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-12-16  8:34 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: 52542

> Date: Thu, 16 Dec 2021 09:28:14 +0100
> From:  Rudolf Adamkovič via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> On macOS 11/12, in Emacs 28/29, any emoji (e.g. alien) makes the line with it taller than the lines with no emojis, which breaks various things across Emacs, such as avatars in telega.el (see the attachment).
> 
> To reproduce:
> 
> 1. start 'emacs -Q'
> 
> 2. type
> 
> > foo
> > 👽 bar
> > baz

Emacs displays the line as tall as needed for the tallest character
shown on that line.  This is normal, and not a bug.

> 3. delete the alien
> 
> Actual: the line with "bar" becomes less tall
> 
> Expected: all lines always have constant height

Your expectations are unfounded, IMO.  Emacs cannot possibly change
the fonts you have on your system, and cannot truncate glyphs of the
Emoji characters if they are taller than the font used for the default
face.  So it has no alternative but to make the line's height larger.

The only solution to that could be if you configure the fonts
installed on your system to have a font which supports Emoji and whose
height is not larger than that of the font used for the default face.

Bottom line is: I don't see how this is an Emacs bug nor how to solve
this in Emacs.

Thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#52542: 29.0.50; Emoji makes lines taller
  2021-12-16  8:34 ` Eli Zaretskii
@ 2021-12-17 21:57   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-18  6:38     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-17 21:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52542

Eli Zaretskii <eliz@gnu.org> writes:

> Emacs displays the line as tall as needed for the tallest character
> shown on that line.  This is normal, and not a bug.
>
>> 3. delete the alien
>> 
>> Actual: the line with "bar" becomes less tall
>> 
>> Expected: all lines always have constant height
>
> Your expectations are unfounded, IMO.  Emacs cannot possibly change
> the fonts you have on your system, and cannot truncate glyphs of the
> Emoji characters if they are taller than the font used for the default
> face.  So it has no alternative but to make the line's height larger.

Interesting.  I based my expectation on the built-in Terminal
application on macOS.  It uses the same default font as Emacs, yet
emojis do not change the height of its lines.

> The only solution to that could be if you configure the fonts
> installed on your system to have a font which supports Emoji and whose
> height is not larger than that of the font used for the default face.

Cannot Emacs, when defaulting to "Apple Color Emoji", make the emojis a
bit smaller?  Terminal seems to do that.

> Bottom line is: I don't see how this is an Emacs bug nor how to solve
> this in Emacs.

As Apple often says in their keynotes, "Only Apple can do that." :)

Rudy

-- 
"Logic is a science of the necessary laws of thought, without which no
employment of the understanding and the reason takes place." -- Immanuel
Kant, 1785

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#52542: 29.0.50; Emoji makes lines taller
  2021-12-17 21:57   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-18  6:38     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-12-18  6:38 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: 52542

> From: Rudolf Adamkovič <salutis@me.com>
> Cc: 52542@debbugs.gnu.org
> Date: Fri, 17 Dec 2021 22:57:54 +0100
> 
> > Your expectations are unfounded, IMO.  Emacs cannot possibly change
> > the fonts you have on your system, and cannot truncate glyphs of the
> > Emoji characters if they are taller than the font used for the default
> > face.  So it has no alternative but to make the line's height larger.
> 
> Interesting.  I based my expectation on the built-in Terminal
> application on macOS.  It uses the same default font as Emacs, yet
> emojis do not change the height of its lines.

If you can look into its sources and tell what is it doing, we could
perhaps use some of those ideas, if they fit how Emacs works with
fonts.  The main issue here is not the default font, it's the font
used for Emoji; I believe it's a different font in both cases.

> Cannot Emacs, when defaulting to "Apple Color Emoji", make the emojis a
> bit smaller?  Terminal seems to do that.

The Emoji come out as small or as large as the font tells us: the
metrics of each glyph are dictated by the font.  Emacs selects an
Emoji (and any other) font's size to match as well as possible the
size of the default face's font, so Emacs attempts to make the size
the same up front.  It is possible that we somehow miscalculate the
size, or fail to find the right match, or something like that.  But
once the font matching the default face's size is selected, Emacs
never changes the metrics of the font glyphs as provided by the font.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-18  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-16  8:28 bug#52542: 29.0.50; Emoji makes lines taller Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-16  8:34 ` Eli Zaretskii
2021-12-17 21:57   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-18  6:38     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).