emacs-devel
[Top][All Lists]
Advanced

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

Re: Supporting stylistic sets


From: Eli Zaretskii
Subject: Re: Supporting stylistic sets
Date: Fri, 23 Sep 2022 21:09:27 +0300

> From: Nicolas Ouellet-payeur <nicolaso@google.com>
> Date: Fri, 23 Sep 2022 13:31:30 -0400
> Cc: Eli Zaretskii <eliz@gnu.org>, 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.



reply via email to

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