Subject: Re: bug#31315: wrong font encoding for fallback font

From: Eli Zaretskii <[email-masked]>
Date: Fri, 04 May 2018 16:05:36 +0300

> Date: Fri, 04 May 2018 07:11:37 +0200 (CEST)
> Cc: [email-masked], [email-masked]
> From: Werner LEMBERG <[email-masked]>
> 
> > Emacs handles charsets and scripts separately.  A script is matched
> > against OTF/TTF features of fonts to make sure the necessary shaping
> > features required by a script are supported.
> 
> Interesting.  Access to OpenType features is exactly what's needed to
> improve font display for selected charsets.  Where can I find the
> related code in Emacs?

Emacs delegates that to the font back-end.  E.g., in font_match_p you
will see that if certain 'otf' capabilities are required, Emacs calls
the otf_capability method of the font driver.  The ftfont.c driver
implements that as ftfont_otf_capability.  And which OTF capabilities
are required for what scripts is set up in the fontsets by fontest.el.

> Additionally, I suggest that the Emacs maintainers set up a GSoC
> project, namely to improve font rendering.  This is a broad topic,
> which could be further split into smaller subprojects.

Good idea.

> Emacs uses Handa-san's libotf library (are there any other projects
> that use this library?), but AFAICS it doesn't receive a lot of
> testing.  On the other hand, there is Behdad Esfahbod's `HarfBuzz'
> shaping engine that comes with a large suite of tests.  One of such
> subprojects could be to take these tests and use them to improve
> libotf, especially for Indic scripts.
> 
>   https://www.freedesktop.org/wiki/Software/HarfBuzz/

I think a better development would be to teach Emacs to use HarfBuzz
as its shaping engine.  HarfBuzz is available on many platforms, and
is AFAIK actively developed, so we will gain better shaper and
advanced features if we do that.  Once again, such a project needs a
motivated volunteer to carry it out.