emacs-devel
[Top][All Lists]
Advanced

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

Re: Supporting stylistic sets


From: Nicolas Ouellet-payeur
Subject: Re: Supporting stylistic sets
Date: Fri, 23 Sep 2022 13:31:30 -0400

> 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 समीर सिंह Sameer Singh
<lumarzeli30@gmail.com> 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 <eliz@gnu.org> wrote:
>>
>> > From: समीर सिंह Sameer Singh
>> >  <lumarzeli30@gmail.com>
>> > 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 Bengali 
>> > 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 would 
>> > 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.



reply via email to

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