Subject: Re: bug#33729: 27.0.50; Partial glyphs not rendered for Gujarati with Harfbuzz enabled (renders fine using m17n)

From: Khaled Hosny <[email-masked]>
Date: Mon, 24 Dec 2018 04:08:47 +0200

On Sun, Dec 23, 2018 at 06:00:58PM +0200, Eli Zaretskii wrote:
> > Date: Sun, 23 Dec 2018 15:51:09 +0200
> > From: Khaled Hosny <[email-masked]>
> > Cc: [email-masked], [email-masked], [email-masked],
> > 	[email-masked], [email-masked]
> > 
> > > Are there any disadvantages in using the built-in support?  I mean,
> > > why did you envision an Emacs-specific implementation in the first
> > > place?
> > 
> > I thought, but I might be mistaken, that Emacs allow changing these
> > character properties at runtime and someone might possibly want to use
> > that to change some character property (e.g. make some PUA character a
> > combining mark) and it would then be nice if HarfBuzz respected that. I
> > admit that is very niche thing if possible at all, and I’m more than
> > happy to let HarfBuzz use it default Unicode functions and simplify the
> > Emacs integration code.
> 
> Right, I agree that we should for now leave that to HarfBuzz.  It
> could be added later as an optional feature.  (I don't expect many
> users to want to modify the Unicode character properties.)

I think we are almost good now. There is only one serious FIXME left:

  /* FIXME: guess_segment_properties is BAD BAD BAD.
   * we need to get these properties with the LGSTRING. */
#if 1
  hb_buffer_guess_segment_properties (hb_buffer);
#else
  hb_buffer_set_direction (hb_buffer, XXX);
  hb_buffer_set_script (hb_buffer, XXX);
  hb_buffer_set_language (hb_buffer, XXX);
#endif

We need to know, for a given lgstring we are shaping:
* Its direction (from applying bidi algorithm). Each lgstring we are
  shaping must be of a single direction.
* Its script, possibly after applying something like:
  http://unicode.org/reports/tr24/#Common
* Its language, is Emacs allows setting text language (my understand is
  that it doesn’t). Some languages really need this for applying
  language-specfic features (Urdu digits, Serbian alternate glyphs, etc.).