From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Benjamin Riefenstahl Newsgroups: gmane.emacs.devel Subject: Re: Ligature support Date: Sat, 06 Nov 2021 18:03:26 +0100 Message-ID: <87r1btw71d.fsf@turtle-trading.net> References: <87cznths5j.fsf@gnus.org> <83mtmtru6l.fsf@gnu.org> <8ff3b131c57f741d04e5@heytings.org> <83lf2drqx6.fsf@gnu.org> <87lf2c3k0z.fsf@gnus.org> <83wnlwqocq.fsf@gnu.org> <87wnlwyox9.fsf@gnus.org> <83lf2cq7n5.fsf@gnu.org> <87wnlnkxbo.fsf@gnus.org> <83cznfdohr.fsf@gnu.org> <87zgqik9bk.fsf@gnus.org> <83v916d64z.fsf@gnu.org> <878ry2k6qz.fsf@gnus.org> <83tugqd488.fsf@gnu.org> <87zgqiiq8c.fsf@gnus.org> <83r1bud3or.fsf@gnu.org> <87r1buipf5.fsf@gnus.org> <83o86yd0ig.fsf@gnu.org> <87a6iiimay.fsf@gnus.org> <87r1btwh54.fsf@turtle-trading.net> <834k8pbe7h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7197"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 06 18:04:14 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjP6z-0001ek-TW for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Nov 2021 18:04:13 +0100 Original-Received: from localhost ([::1]:42458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjP6y-0002xu-Gn for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Nov 2021 13:04:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjP6L-0002Hq-1N for emacs-devel@gnu.org; Sat, 06 Nov 2021 13:03:33 -0400 Original-Received: from odoacer.turtle-trading.net ([93.241.193.16]:39905) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1mjP6I-0007rv-Ot; Sat, 06 Nov 2021 13:03:32 -0400 Original-Received: from zenobia.turtle-trading.net ([192.168.2.111]) by odoacer.turtle-trading.net with esmtp (Exim 4.80) (envelope-from ) id 1mjP6E-0002H8-Kg; Sat, 06 Nov 2021 18:03:26 +0100 Original-Received: from benny by zenobia.turtle-trading.net with local (Exim 4.94.2) (envelope-from ) id 1mjP6E-000hDp-CS; Sat, 06 Nov 2021 18:03:26 +0100 In-Reply-To: <834k8pbe7h.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 06 Nov 2021 15:34:10 +0200") Received-SPF: none client-ip=93.241.193.16; envelope-from=benny@turtle-trading.net; helo=odoacer.turtle-trading.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:278879 Archived-At: >> From: Benjamin Riefenstahl >> 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:-().