Subject: 27.0.50; harfbuzz: Noto Sans Mandaic not rendered correctly

From: Benjamin Riefenstahl <[email-masked]>
Date: Tue, 01 Jan 2019 15:36:40 +0100

This may be a more general problem, but Noto Sans Mandaic reproduces it
for me:

I am running Emacs from the Harfbuzz branch.

I have the font "Noto Sans Mandaic" installed (from
https://noto-website-2.storage.googleapis.com/pkgs/NotoSansMandaic-hinted.zip).

I save this code in a file "reproduce.el" and execute it with "emacs -Q
-l reproduce.el":

    (set-fontset-font t '(?\u0840 . ?\u085B) "Noto Sans Mandaic 20")

    (set-char-table-range
     composition-function-table '(?\u0840 . ?\u085B)
     (list ["[\u0840-\u085B]+" 0 arabic-shape-gstring]))

    (setq bidi-paragraph-direction t)
    (insert "\u0856\u0844\u0845")

The problem is that the second and third character from the right are
not combined as they should.  This works in hb-view and it also works,
if I remove the setting of bidi-paragraph-direction.

The commit that breaks this is the last one, 48776b7011 "Provide text
directionality and language to HarfBuzz shaper".  Before that commit it
works for me.

----

In GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2018-12-30 built on arrian
Repository revision: 48776b70115edf3775df19d80f734048dadff198
Repository branch: harfbuzz
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)

Configured using:
 'configure --with-harfbuzz --without-m17n-flt'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Buffer Menu

Minor modes in effect:
  shell-dirtrack-mode: t
  desktop-save-mode: t
  display-time-mode: t
  diff-auto-refine-mode: t
  delete-selection-mode: t
  cua-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail pcmpl-unix tramp trampver tramp-compat
tramp-loaddefs ucs-normalize parse-time format-spec nnheader gnus-util
rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums time-date mail-utils
dirtrack shell pcomplete eieio-opt speedbar sb-image ezimage dframe
find-func thingatpt help-fns tabify imenu elec-pair desktop frameset
highline benny-calendar-cfg ange-ftp comint ansi-color ring
benny-unicode generic-x cl autoinsert cc-mode cc-fonts cc-guess cc-menus
cc-styles cc-align cc-cmds cc-engine cc-vars cc-defs ps-print
ps-print-loaddefs ps-def lpr advice dired dired-loaddefs
benny-x-clipboard disp-table mm-util mail-prsvr time server protbuf
cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays
hol-loaddefs vc-git diff-mode easy-mmode diary-lib diary-loaddefs
cal-menu calendar cal-loaddefs delsel cua-base .loaddefs benny-tools
browse-url autoload radix-tree lisp-mnt mule-util cus-edit cus-start
cus-load wid-edit info finder-inf package let-alist derived pcase
cl-extra help-mode easymenu url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
seq byte-opt gv bytecomp byte-compile cconv epg epg-config subr-x
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)