From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Ouellet-payeur Newsgroups: gmane.emacs.devel Subject: Re: Supporting stylistic sets Date: Fri, 23 Sep 2022 13:31:30 -0400 Message-ID: References: <83wn9up0es.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="414"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: =?UTF-8?B?4KS44KSu4KWA4KSwIOCkuOCkv+CkguCkuSBTYW1lZXIgU2luZ2g=?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 23 19:32: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 1obmXZ-000AU1-0u for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Sep 2022 19:32:41 +0200 Original-Received: from localhost ([::1]:56326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obmXX-0000G7-Mh for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Sep 2022 13:32:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obmWg-00080S-Ra for emacs-devel@gnu.org; Fri, 23 Sep 2022 13:31:46 -0400 Original-Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:40747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obmWe-00078Q-Nu for emacs-devel@gnu.org; Fri, 23 Sep 2022 13:31:46 -0400 Original-Received: by mail-lj1-x22f.google.com with SMTP id g20so822636ljg.7 for ; Fri, 23 Sep 2022 10:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=b7lg6b5qQuh9PWtlc5vunlBkEizhTMczmp7TI3t3Uok=; b=E+5PJVzyaE9zu8DUrkommv2G0SN+BANm5dShmqGCcH8mQEt3mQkrjaxiyM39PfkbWp luz2NBTyA6SUg+b1n1EKAulBuAH871GMUpcA+n0fTqnTeSjrMyACPPDt/CSVpcYAqyiy iyI3N0TKLZReHU5Bzwzx/b1fwZ+pFegQGNLVWv9EY3+IMN2u39sPFjlU+fdvfQbQgtEq CMV1KGDX6k0Di5xc/A8wpdnrI89phCgLIMNmqhUHGmefQSsmQLzNRlsxwSh5VWEH16g8 7wyywxJ0Y/3fQnztBpWsxLe4XHR248m0W0FYFKYr4oxEjsKmDgz2f034OBw71O+bEZ/x x0iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=b7lg6b5qQuh9PWtlc5vunlBkEizhTMczmp7TI3t3Uok=; b=IpB3+86QXRgCFpu/DaESjrOkn0hyhCow6FY1AiN8elTXJS8TO1xLYhpmzhjlQSBh6Y 8C0+NcNEhi9/UaP55SRXsjiygUlyNVifDSBFp4rNCMfkpDwzn0YI94+sFEz4rE1gVjgD yQosYes0JMrr3RXrdh7h8PXjBGjJcJvjporwerERmpnkWV7ygaMhiyZytvamBqq+TUVx 9+Km+tXfBjLAIETQFbpzJo+0ury/+SiFALuAOOHcMGeMcBxWLHOAo4aHVVebWQZmIQkN SpklIs1VKXqjZ/w+1kEURC+8NZ4hJeOoYe/eEt8gTHC7sMCW6VbfvJgk7JQu+thSKlTk 4lrg== X-Gm-Message-State: ACrzQf03emcZ2pXglPlI9KUGhSyojy6oETNDSg9S0L+ABaryMXY3uDsQ ood0jXYwARHv+XGW6c/yO78w+8pD09PYa0R4CDcbwA== X-Google-Smtp-Source: AMsMyM6vTSA4qcGU06jzUyyu16UYtpjPZXtBFENPjaqTGrnTMUf68Jdau3rP92BSZ62pu0f9u5TMhjL4auHzB7LZVq0= X-Received: by 2002:a2e:99c8:0:b0:26c:729c:418d with SMTP id l8-20020a2e99c8000000b0026c729c418dmr2949018ljj.524.1663954302076; Fri, 23 Sep 2022 10:31:42 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=nicolaso@google.com; helo=mail-lj1-x22f.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=unavailable 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:296065 Archived-At: > 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 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. With a text property, I'd have to hook into everything that displays text, somehow, and add the text property there. > Thanks. We have a TODO item for that, please see it. 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. This would be nice for fonts like Fira Code [1], which has both ligatures and stylistic sets. My patch is very experimental (i.e. hacky) at this point though, and it crashes all the time. I don't want to derail this discussion, so I'll share my work in another thread once it stops crashing so much. [1] https://github.com/tonsky/FiraCode On Fri, Sep 23, 2022 at 1:29 PM =E0=A4=B8=E0=A4=AE=E0=A5=80=E0=A4=B0 =E0=A4= =B8=E0=A4=BF=E0=A4=82=E0=A4=B9 Sameer Singh wrote: >> >> > I was trying to add stylistic sets in Emacs. >> >> Thanks. We have a TODO item for that, please see it. > > > Yes I had read it and also the mailing list discussion linked there. > >> 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. > > > I imagined that it would be something like this: > > > (set-fontset-font t 'bengali > (font-spec :family "Tiro Bangla" > :stylistic-set '("ss03"))) > > > (set-face-attribute 'default nil > :font "Fira Code" > :weight 'regular > :height 170 > :stylistic-set '("cv01" "ss05" "ss03")) > > Just like how weight, foundry, size etc are set and they seem to be font = properties. > > On Fri, Sep 23, 2022 at 9:07 PM Eli Zaretskii wrote: >> >> > From: =E0=A4=B8=E0=A4=AE=E0=A5=80=E0=A4=B0 =E0=A4=B8=E0=A4=BF=E0=A4=82= =E0=A4=B9 Sameer Singh >> > >> > Date: Fri, 23 Sep 2022 18:24:48 +0530 >> > >> > I was trying to add stylistic sets in Emacs. >> >> Thanks. We have a TODO item for that, please see it. >> >> > I was able to successfully able to switch to a different set of a Beng= ali font by hardcoding it to the hbfont.c >> > file, but that is obviously not a solution. >> > >> > Should I try adding a new font property name "stylistic-set" which wou= ld accept a list of values for a font. If so >> > could I get some pointers on how to add a new font property to emacs. >> >> 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.