unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
@ 2023-02-04 22:48 Jeremy Van Cleve
  2023-02-05  8:58 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Van Cleve @ 2023-02-04 22:48 UTC (permalink / raw)
  To: 61290

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@28/28.2/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus@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@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@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))








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

* bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
  2023-02-04 22:48 bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX Jeremy Van Cleve
@ 2023-02-05  8:58 ` Eli Zaretskii
  2023-02-05  9:28   ` Tassilo Horn
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-02-05  8:58 UTC (permalink / raw)
  To: Jeremy Van Cleve, Tassilo Horn; +Cc: 61290

> From: Jeremy Van Cleve <jeremy.vancleve@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.





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

* bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
  2023-02-05  8:58 ` Eli Zaretskii
@ 2023-02-05  9:28   ` Tassilo Horn
  2023-02-05 11:58     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Tassilo Horn @ 2023-02-05  9:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jeremy Van Cleve, 61290

Eli Zaretskii <eliz@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





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

* bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
  2023-02-05  9:28   ` Tassilo Horn
@ 2023-02-05 11:58     ` Eli Zaretskii
  2023-02-12 12:16       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-02-05 11:58 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: jeremy.vancleve, 61290

> From: Tassilo Horn <tsdh@gnu.org>
> Cc: Jeremy Van Cleve <jeremy.vancleve@gmail.com>, 61290@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.





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

* bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
  2023-02-05 11:58     ` Eli Zaretskii
@ 2023-02-12 12:16       ` Eli Zaretskii
  2023-02-12 16:40         ` Jeremy Van Cleve
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-02-12 12:16 UTC (permalink / raw)
  To: tsdh, jeremy.vancleve; +Cc: 61290-done

> Cc: jeremy.vancleve@gmail.com, 61290@debbugs.gnu.org
> Date: Sun, 05 Feb 2023 13:58:46 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Tassilo Horn <tsdh@gnu.org>
> > Cc: Jeremy Van Cleve <jeremy.vancleve@gmail.com>, 61290@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.





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

* bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX
  2023-02-12 12:16       ` Eli Zaretskii
@ 2023-02-12 16:40         ` Jeremy Van Cleve
  0 siblings, 0 replies; 6+ messages in thread
From: Jeremy Van Cleve @ 2023-02-12 16:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61290-done, tsdh

Yes it is, thanks!

> On Feb 12, 2023, at 7:16 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Cc: jeremy.vancleve@gmail.com, 61290@debbugs.gnu.org
>> Date: Sun, 05 Feb 2023 13:58:46 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> 
>>> From: Tassilo Horn <tsdh@gnu.org>
>>> Cc: Jeremy Van Cleve <jeremy.vancleve@gmail.com>, 61290@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.






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

end of thread, other threads:[~2023-02-12 16:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04 22:48 bug#61290: 28.2; Ligatures messing up fontify subscripts in AUCTeX Jeremy Van Cleve
2023-02-05  8:58 ` Eli Zaretskii
2023-02-05  9:28   ` Tassilo Horn
2023-02-05 11:58     ` Eli Zaretskii
2023-02-12 12:16       ` Eli Zaretskii
2023-02-12 16:40         ` Jeremy Van Cleve

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).