emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ligature support


From: Benjamin Riefenstahl
Subject: Re: Ligature support
Date: Sat, 06 Nov 2021 18:03:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

>> From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
>> That is what font "features" are for, as I understand the concept.  I
>> think Emacs supports those already.  Features enable or disable stuff
>> like certain ligatures.  The user can activate or deactivate features in
>> the font specification to choose which ligatures to use.

Eli Zaretskii writes:
> We have no such mechanism in Emacs.  We pass a sequence of characters
> to the shaping engine, and expect it to DTRT vis-a-vis the font and
> return to use the font glyphs to display that sequence.  The only
> control Lisp programs and users have here is via
> composition-function-table, which determines when we use the shaping
> engine for displaying one or more characters.

Right, I did some experiments and I could not make it work in Emacs.

To elaborate, the idea here is to take ideas and concepts from

  https://www.freedesktop.org/software/fontconfig/fontconfig-devel/x19.html
  
https://wiki.archlinux.org/title/Font_configuration/Examples#Disable_ligatures_for_monospaced_fonts
  
The way that this works at the basic level can be demonstrated using the
Nimbus font with the difference in output for

  $ hb-view .../NimbusMonoPS-Regular.otf ffi
  $ hb-view .../NimbusMonoPS-Regular.otf --features=liga=off ffi

(On Debian this font is in the package "fonts-urw-base35")

Maybe in Emacs the user could specifiy the features s/he wants like

  (set-fontset-font nil 'ascii "Nimbus-16:fontfeatures=liga=off" 
(selected-frame))

Although, as discussed, we probably want different configurations for
program code and normal prose, IOW in different buffers.

I have not read the code, but Emacs probably already passes these
parameters to Fontconfig which finds the font and than the feature list
is ignored, given that it does not make a difference for the question
which font file to use.  I'm guessing the features are sitting somewhere
in the data returned by Fontconfig.  They should be present there,
because that they can also be configured in Fontconfig's files, so it
can't be the job of the application itself to parse them.

Or maybe I could just not get it to work, because I had not configured
composition-function-table right (I tried:-().



reply via email to

[Prev in Thread] Current Thread [Next in Thread]