GNU bug report logs - #61290
28.2; Ligatures messing up fontify subscripts in AUCTeX

Previous Next

Package: emacs;

Reported by: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>

Date: Sun, 5 Feb 2023 07:47:02 UTC

Severity: normal

Found in version 28.2

Done: Eli Zaretskii <eliz <at> gnu.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 61290 in the body.
You can then email your comments to 61290 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#61290; Package emacs. (Sun, 05 Feb 2023 07:47:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Feb 2023 07:47:03 GMT) Full text and rfc822 format available.

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

From: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; Ligatures messing up fontify subscripts in AUCTeX
Date: Sat, 4 Feb 2023 17:48:53 -0500
Hello,

After loading emacs 28.2 with `emacs -Q` and installing AUCTeX, I enable
ligatures (using FiraCode) and get the following fontify issues in a latex-mode:

https://preview.redd.it/se7joc3h81ga1.png?width=1268&format=png&auto=webp&v=enabled&s=1322e80f7d7b0799858041dd1c9b4f44ea51fbb2

Specifically, fontify is changing the font size correctly in the
subscripts, but the baseline is not correct in a number of places
include for + and * and when for x_{-}.

Without the ligatures enabled, fontify renders the subscripts correctly:

https://preview.redd.it/8g67r6lp81ga1.png?width=1358&format=png&auto=webp&v=enabled&s=3132a756de6a8266f8300e600b6d0dae94656ee9

Here is the code I used to enable ligatures:

```
(let ((alist `((?! . ,(regexp-opt '("!!" "!=" "!==")))
               (?# . ,(regexp-opt '("##" "###" "####" "#(" "#?" "#[" "#_" "#_(" "#{")))
               (?$ . ,(regexp-opt '("$>")))
               (?% . ,(regexp-opt '("%%")))
               (?& . ,(regexp-opt '("&&")))
               (?* . ,(regexp-opt '("*" "**" "***" "**/" "*/" "*>")))
               (?+ . ,(regexp-opt '("+" "++" "+++" "+>")))
               (?- . ,(regexp-opt '("--" "---" "-->" "-<" "-<<" "->" "->>" "-}" "-~")))
               (?. . ,(regexp-opt '(".-" ".." "..." "..<" ".=")))
               (?/ . ,(regexp-opt '("/*" "/**" "//" "///" "/=" "/==" "/>")))
               (?: . ,(regexp-opt '(":" "::" ":::" ":=")))
               (?\; . ,(regexp-opt '(";;")))
               (?< . ,(regexp-opt '("<!--" "<$" "<$>" "<*" "<*>" "<+" "<+>" "<-" "<--" "<->" "</" "</>" "<<" "<<-" "<<<" "<<=" "<=" "<=" "<=<" "<==" "<=>" "<>" "<|" "<|>" "<~" "<~~")))
               (?= . ,(regexp-opt '("=/=" "=:=" "=<<" "==" "===" "==>" "=>" "=>>")))
               (?> . ,(regexp-opt '(">-" ">=" ">=>" ">>" ">>-" ">>=" ">>>")))
               (?= . ,(regexp-opt '("?=")))
               (?? . ,(regexp-opt '("??")))
               (?\[ . ,(regexp-opt '("[]")))
               (?\\ . ,(regexp-opt '("\\\\" "\\\\\\")))
               (?^ . ,(regexp-opt '("^=")))
               (?w . ,(regexp-opt '("www")))
               (?x . ,(regexp-opt '("x")))
               (?{ . ,(regexp-opt '("{-")))
               (?| . ,(regexp-opt '("|=" "|>" "||" "||=")))
               (?~ . ,(regexp-opt '("~-" "~=" "~>" "~@" "~~" "~~>"))))))
  (dolist (char-regexp alist)
    (set-char-table-range composition-function-table (car char-regexp)
                          `([,(cdr char-regexp) 0
                          font-shape-gstring]))))
```
--
In GNU Emacs 28.2 (build 2, x86_64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.5.1 (Build 21G83))
of 2022-09-12 built on montecarlo.local
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.2

Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-plus <at> 28/28.2/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus <at> 28/28.2 --with-xml2 --with-gnutls
--with-native-compilation --without-dbus --with-imagemagick
--with-modules --with-rsvg --with-ns --disable-ns-self-contained
'CFLAGS=-Os -w -pipe -march=nehalem -mmacosx-version-min=12
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'
'CPPFLAGS=-I/usr/local/opt/zlib/include -I/usr/local/opt/jpeg/include
-I/usr/local/opt/icu4c/include -I/usr/local/opt/openssl <at> 1.1/include
-I/usr/local/opt/readline/include -F/usr/local/Frameworks
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'
'LDFLAGS=-L/usr/local/opt/zlib/lib -L/usr/local/opt/jpeg/lib
-L/usr/local/opt/icu4c/lib -L/usr/local/opt/openssl <at> 1.1/lib
-L/usr/local/opt/readline/lib -L/usr/local/lib -F/usr/local/Frameworks
-Wl,-headerpad_max_install_names
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk''

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

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

Major mode: LaTeX/P

Minor modes in effect:
  TeX-PDF-mode: t
  shell-dirtrack-mode: t
  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
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail comp comp-cstr rx cl-extra
help-mode rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
time-date preview tex-bar toolbar-x noutline outline font-latex latex
easy-mmode edmacro kmacro latex-flymake flymake-proc flymake project
warnings thingatpt tex-ispell tex-style tex crm texmathp tex-mode
compile text-property-search shell pcomplete comint ansi-color ring
latexenc info tex-site 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 subr-x map url-vars seq
byte-opt gv 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
hashtable-print-readable backquote threads kqueue cocoa ns lcms2
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 178015 9474)
(symbols 48 14050 1)
(strings 32 46995 3318)
(string-bytes 1 1475683)
(vectors 16 27230)
(vector-slots 8 486261 16445)
(floats 8 90 129)
(intervals 56 418 0)
(buffers 992 13))







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

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>, Tassilo Horn <tsdh <at> gnu.org>
Cc: 61290 <at> debbugs.gnu.org
Subject: Re: bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
Date: Sun, 05 Feb 2023 10:58:58 +0200
> From: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>
> Date: Sat, 4 Feb 2023 17:48:53 -0500
> 
> After loading emacs 28.2 with `emacs -Q` and installing AUCTeX, I enable
> ligatures (using FiraCode) and get the following fontify issues in a latex-mode:
> 
> https://preview.redd.it/se7joc3h81ga1.png?width=1268&format=png&auto=webp&v=enabled&s=1322e80f7d7b0799858041dd1c9b4f44ea51fbb2
> 
> Specifically, fontify is changing the font size correctly in the
> subscripts, but the baseline is not correct in a number of places
> include for + and * and when for x_{-}.
> 
> Without the ligatures enabled, fontify renders the subscripts correctly:
> 
> https://preview.redd.it/8g67r6lp81ga1.png?width=1358&format=png&auto=webp&v=enabled&s=3132a756de6a8266f8300e600b6d0dae94656ee9

Thanks.

My guess would be that the method used by AUCTeX for displaying
subscripts is somehow incompatible with character compositions.  How
are subscripts displayed by AUCTeX?

OTOH, if this is a problem in the Emacs display engine, I'd appreciate
a simple reproducer that doesn't require AUCTeX to be installed and
used.

CC'ing Tassilo, in case he has some comments and idea.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61290; Package emacs. (Sun, 05 Feb 2023 09:35:01 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>, 61290 <at> debbugs.gnu.org
Subject: Re: bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
Date: Sun, 05 Feb 2023 10:28:42 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Jeremy & Eli,

> My guess would be that the method used by AUCTeX for displaying
> subscripts is somehow incompatible with character compositions.  How
> are subscripts displayed by AUCTeX?

AUCTeX simply adds a 'raise text property with some computed value per
level, e.g., (raise -0.5) for the first subscript level.

> OTOH, if this is a problem in the Emacs display engine, I'd appreciate
> a simple reproducer that doesn't require AUCTeX to be installed and
> used.
>
> CC'ing Tassilo, in case he has some comments and idea.

I'm somewhat relieved to say its the very same with the stock emacs
tex-mode.el which does pretty much the same as AUCTeX, i.e., a simple
reproducer is to open the tex file

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
\begin{equation}
  A_{x+b-c*d/e}
\end{equation}
Here is a ligature -> and another one !=.
\end{document}
--8<---------------cut here---------------end--------------->8---

with emacs -Q.  It looks correct but gets wonky after evaluating
Jeremy's ligature setup.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61290; Package emacs. (Sun, 05 Feb 2023 11:59:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: jeremy.vancleve <at> gmail.com, 61290 <at> debbugs.gnu.org
Subject: Re: bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
Date: Sun, 05 Feb 2023 13:58:46 +0200
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>, 61290 <at> debbugs.gnu.org
> Date: Sun, 05 Feb 2023 10:28:42 +0100
> 
> I'm somewhat relieved to say its the very same with the stock emacs
> tex-mode.el which does pretty much the same as AUCTeX, i.e., a simple
> reproducer is to open the tex file
> 
> --8<---------------cut here---------------start------------->8---
> \documentclass{article}
> \begin{document}
> \begin{equation}
>   A_{x+b-c*d/e}
> \end{equation}
> Here is a ligature -> and another one !=.
> \end{document}
> --8<---------------cut here---------------end--------------->8---
> 
> with emacs -Q.  It looks correct but gets wonky after evaluating
> Jeremy's ligature setup.

Thanks, should be fixed now on the emacs-29 branch.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 12 Feb 2023 12:17:02 GMT) Full text and rfc822 format available.

Notification sent to Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>:
bug acknowledged by developer. (Sun, 12 Feb 2023 12:17:03 GMT) Full text and rfc822 format available.

Message #19 received at 61290-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: tsdh <at> gnu.org, jeremy.vancleve <at> gmail.com
Cc: 61290-done <at> debbugs.gnu.org
Subject: Re: bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
Date: Sun, 12 Feb 2023 14:16:26 +0200
> Cc: jeremy.vancleve <at> gmail.com, 61290 <at> debbugs.gnu.org
> Date: Sun, 05 Feb 2023 13:58:46 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > From: Tassilo Horn <tsdh <at> gnu.org>
> > Cc: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>, 61290 <at> debbugs.gnu.org
> > Date: Sun, 05 Feb 2023 10:28:42 +0100
> > 
> > I'm somewhat relieved to say its the very same with the stock emacs
> > tex-mode.el which does pretty much the same as AUCTeX, i.e., a simple
> > reproducer is to open the tex file
> > 
> > --8<---------------cut here---------------start------------->8---
> > \documentclass{article}
> > \begin{document}
> > \begin{equation}
> >   A_{x+b-c*d/e}
> > \end{equation}
> > Here is a ligature -> and another one !=.
> > \end{document}
> > --8<---------------cut here---------------end--------------->8---
> > 
> > with emacs -Q.  It looks correct but gets wonky after evaluating
> > Jeremy's ligature setup.
> 
> Thanks, should be fixed now on the emacs-29 branch.

No further comments, so I assume the bug is fixed, and I'm closing
this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61290; Package emacs. (Sun, 12 Feb 2023 16:41:02 GMT) Full text and rfc822 format available.

Message #22 received at 61290-done <at> debbugs.gnu.org (full text, mbox):

From: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61290-done <at> debbugs.gnu.org, tsdh <at> gnu.org
Subject: Re: bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
Date: Sun, 12 Feb 2023 11:40:21 -0500
Yes it is, thanks!

> On Feb 12, 2023, at 7:16 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Cc: jeremy.vancleve <at> gmail.com, 61290 <at> debbugs.gnu.org
>> Date: Sun, 05 Feb 2023 13:58:46 +0200
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> 
>>> From: Tassilo Horn <tsdh <at> gnu.org>
>>> Cc: Jeremy Van Cleve <jeremy.vancleve <at> gmail.com>, 61290 <at> debbugs.gnu.org
>>> Date: Sun, 05 Feb 2023 10:28:42 +0100
>>> 
>>> I'm somewhat relieved to say its the very same with the stock emacs
>>> tex-mode.el which does pretty much the same as AUCTeX, i.e., a simple
>>> reproducer is to open the tex file
>>> 
>>> --8<---------------cut here---------------start------------->8---
>>> \documentclass{article}
>>> \begin{document}
>>> \begin{equation}
>>>  A_{x+b-c*d/e}
>>> \end{equation}
>>> Here is a ligature -> and another one !=.
>>> \end{document}
>>> --8<---------------cut here---------------end--------------->8---
>>> 
>>> with emacs -Q.  It looks correct but gets wonky after evaluating
>>> Jeremy's ligature setup.
>> 
>> Thanks, should be fixed now on the emacs-29 branch.
> 
> No further comments, so I assume the bug is fixed, and I'm closing
> this.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Mar 2023 11:24:08 GMT) Full text and rfc822 format available.

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

Previous Next


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