Subject: bug#28339: 25.2; Emacs shows ZWNJ character (Zero Width non-Joiner) as Space

From: Benjamin Riefenstahl <[email-masked]>
Date: Mon, 18 Sep 2017 17:22:04 +0200

Hi Handa,

NB: Take these remarks with the usual grain of salt, I have not read the
latest version of the standard about this.  I do have some practical
experience implementing my own fonts though, so I have thought about it
before from that perspective.

handa writes:
> I checked the GSUB table of "Courier New" font (cour.ttf) using the
> program ttx (included in fonttools package of Ubuntu).  It surely
> contains many rules with ZWNJ, but none of them are with Arabic
> characters.  So, I suspect that absorbing of ZWNJ for Arabic is done by
> a layout engine (halfbuzz? uniscribe?) or by an application level
> library (pango?).

The font doesn't need a specific rule, because "not shaping" is the
default in any combination that is not covered by rules.  It only needs
rules when it *does* want to do shaping.  ZWNJ can work just by keeping
the characters apart.  After the shaping rules have been applied the
question is, is ZWNJ just represented by an empty glyph, or do you have
a rule that drops the ZWNJ from the glyph list.

This is different from ZWJ, where you need specific rules to do shaping.
That is why I said we need the font for that, while we could get the
effect of ZWNJ by separate rendering.

> Isn't there a case that ZWNJ is prepeneded to a character to change the
> shape of the following character?

ZWNJ is only interesting between characters.  It does not have an effect
at the start or the end of a string.  It prevents changes which would
occur because of ligatures or shaping rules.  It should also prevent
composition with accents, although that is not the usual way to prevent
composition.  At least not in western scripts, I don't know what indic
scripts do or need.

ZWJ OTOH is before or after a character to force the application of
shaping.  It does not make sense with ligatures, because there the
effect depends on the other character, while with shaping there is a
standard effect.

benny