From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Supporting stylistic sets Date: Fri, 23 Sep 2022 21:09:27 +0300 Message-ID: <83h70yotd4.fsf@gnu.org> References: <83wn9up0es.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1912"; mail-complaints-to="usenet@ciao.gmane.io" Cc: lumarzeli30@gmail.com, emacs-devel@gnu.org To: Nicolas Ouellet-payeur Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 23 20:13:41 2022 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 1obnBF-0000PP-0T for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Sep 2022 20:13:41 +0200 Original-Received: from localhost ([::1]:56992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obnBC-000418-4g for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Sep 2022 14:13:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obn7H-0007kS-Ar for emacs-devel@gnu.org; Fri, 23 Sep 2022 14:09:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obn7H-0006KM-1Z; Fri, 23 Sep 2022 14:09:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8xhuA3IJISCB/AMTax0aK+2+JQF5Oj8LYuJ8ZLWgKA8=; b=beW9mx4U5a++ tH+XtZlqKowQFRUavY24KByx1MIQbQjtW6pazf6fv3G/3SFnRR2GVTwLW2vihVLRaZUcyV/tt1Gsu giW6e2JuWLrQsQsYJiJz2eT4KadRCwctThd1EFLpRArwOtZ4q22FktlIMYDUVN/MeXVK7nZ4s7a2j KhJPIRR+lLoUmZqp3gC6EoZjL7/zagllm1fN4hYpD2dvMPHTKHef/euyykEo0Ct9m56q065Ajhp8j Enlmd7U4k838aOGla09h2l/uKIjbyuWqCd/5Kkxj6p6HSL9sd6SjA7kP6BMsn+D712aK+2kkk/sJi yKTRrJaOQ8I5bvAXTQcKaQ==; Original-Received: from [87.69.77.57] (port=2014 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obn7G-0004QT-GC; Fri, 23 Sep 2022 14:09:34 -0400 In-Reply-To: (message from Nicolas Ouellet-payeur on Fri, 23 Sep 2022 13:31:30 -0400) 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:296071 Archived-At: > From: Nicolas Ouellet-payeur > Date: Fri, 23 Sep 2022 13:31:30 -0400 > Cc: Eli Zaretskii , emacs-devel@gnu.org > > > How did you envision this font property to be used in Emacs? > > > > The etc/TODO item for that suggests to implement this as a text > > property instead. That is, of course, not carved in stone, but I > > think we should in any case decide on how this will be used from Lisp > > before we talk about how to expose it to Lisp. > > Personally, I think a font property is easier to configure. I can use > customize or set-face-attribute to set how I want a font to look. > Ideally, I would like to do something like this: > > (set-face-attribute > 'default nil > :stylistic-sets '("cv01" "cv02" "cv03")) This is not a font property, this is a face property. It will be in effect for every font used for the default face, including fonts used for non-ASCII characters, like CJK and Emoji. Are you sure this is what you want? I'm not against adding a face property, I just think it isn't enough, even if that's what people will want. Also, AFAIU this feature is meant for special styling of select text segments, not for the entire buffer. > This uses my chosen stylistic sets everywhere with a single line of > Lisp. If I don't like having it *everywhere* (e.g. minibuffer, > mode-line), I can still set it separately for each face. That'd be very tedious, since Emacs uses so many different faces. > With a text property, I'd have to hook into everything that displays > text, somehow, and add the text property there. Yes. Maybe we should talk about higher-level use cases: when and why would one want to use stylistic-sets in Emacs? > Also, while we're on this topic: I'm working on a patch to pass *all* > strings/buffer contents to hbfont_shape() during redisplay, and making > all text a composition. That way we could have stylistic sets for Latin > scripts as well (and most other scripts), not just "composed" scripts > like Bengali and Arabic. It'd also achieve "Support ligatures out of the > box" from etc/TODO, by giving HarfBuzz the means to shape text properly. I think you will find out that this makes Emacs redisplay unbearably slow. IMO, it is impractical to shape everything via a shaping engine without completely redesigning how we handle character compositions in the display engine, because what we have now was not designed to be used for all the text we display. And the main difficulty with such a redesign is to do it in a way that still allows easy customization of composition rules from Lisp. > This would be nice for fonts like Fira Code [1], which has both > ligatures and stylistic sets. You can have ligatures today without passing everything through the shaping engine. The number of character combinations that ligate is not very large, so this is a far cry from shaping everything. The only known problem with using ligatures in current Emacs codebase is that some of the character sequences you'd like to ligate happen in places where you don't want that, such as on the mode line. So we need some way of preventing ligation in certain contexts.