emacs-devel
[Top][All Lists]
Advanced

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

Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywh


From: Eli Zaretskii
Subject: Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY))
Date: Fri, 22 May 2020 09:12:22 +0300

> From: Pip Cet <address@hidden>
> Date: Thu, 21 May 2020 21:16:44 +0000
> Cc: Eli Zaretskii <address@hidden>, address@hidden, address@hidden
> 
> (set-char-table-range composition-function-table t '([".+" 0
> font-shape-gstring]))
> 
> should work, but it has weird side effects that I'm pretty sure aren't
> intended (paren highlighting is broken, for example).

This is not the right way.  The right way is to do the likes of the
following:

  (set-char-table-range
   composition-function-table '(?f . ?f)
   (list (vector "ffi" 0 'compose-gstring-for-graphic)))

This shows how to do this only for the "ffi" ligature, but I think it
makes the idea clear.  Tassilo posted here some code ho wrote that
supports more (and different) ligatures which are supposed to be used
like prettify-symbols-mode.  The idea is to populate
composition-function-table only for characters that should trigger
ligation.

Whether to use compose-gstring-for-graphic or font-shape-gstring
depends on what you want to happen when the font doesn't have a glyph
for a certain ligature: the latter will then cause the characters be
displayed as usual, as separate characters, the latter will display
them as a single display element, a kind of "fake ligature".



reply via email to

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