GNU bug report logs -
#79285
[Patch] support :font-features in face
Previous Next
Full log
View this message in rfc822 format
> From: Binbin YE <phantom2501 <at> gmail.com>
> Date: Wed, 10 Sep 2025 00:51:42 +0900
> Cc: 79285 <at> debbugs.gnu.org
>
> The reason why Emacs tries to avoid using the shaper, unless
> composition-function-table tells us we must, is that the
> implementation of shaping and composition in Emacs is exposed to Lisp
> and uses Lisp code for some of its workings, and thus is slow. Emacs
> is unique in this: no other program allows the user to affect
> character composition and shaping by a simple change of a
> character-indexed table, while the session keeps running. This gives
> Lisp programs and users an unprecedented freedom of affecting how
> stuff is displayed, but it comes at a price.
>
> It is extremely powerful design, maybe there is a chance that the shaping engine can serve as additional
> source of information passing to the composition — so that we can take advantage of both. I’m guessing, I
> probably will realize how unpractical this idea is, later.
It should be possible to bypass the current flow of processing. But
it will not be easy, and will require additional non-trivial effort.
Character composition currently works by passing to the shaper a chunk
of buffer text (one or more characters), receiving a series of font
glyphs for those characters from the shaper, and then laying out these
glyphs one by one. The workhorse of the latter step is
next_element_from_composition; as long as we use that in the display
engine, restructuring the code that fills up 'struct composition_it'
which stores the information about the composed characters will
basically need to duplicate a lot of what we already do anyway.
So I think for starters we should reuse as much code of character
composition as possible, and leave optimizations (if needed) for
later. The minimum that is needed is to replace the code which uses
composition rules stored in composition-function-table to determine
the sequence of characters to be passed to HarfBuzz by something
similar which determines that sequence by looking for stretches of
text that have the face property with this new attribute. I'd suggest
to do this minimum first, and see how well/fast that works.
This bug report was last modified 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.