-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
luatex + harfbuzz and the zero width joiner U+200D #418
Comments
I don't get your output with the development version of luaotfload. With it is looks like this: This is still not correct, but
|
Thank you for the references which I will explore. I suspected that this might be unrelated to fontspec. Do you think it should be worth reporting this---maybe unrelated again---issue to the luaotfload bug tracker? |
FWIW, this seems to be a regression in luaotfload. Trying the following with harflatex and the old harf code: \documentclass[12pt]{minimal}
\usepackage{harfload}
\usepackage{ulem}
\begin{document}
\font\arabicfont="[Amiri-Regular.ttf]:mode=harf"
\textdir TRT\arabicfont
مُب^^^^200d\uline{^^^^200dتَ^^^^200d}^^^^200dسِم
\end{document} |
This was a luaotfload bug which is resolved in the latest |
The behavior of HarfBuzz seems a bit odd here but I don't know enough about the script to say if it is a bug or expected behaviour: The luaotfload bug was that in Now to the odd part: For some reason, HarfBuzz seems to reverse the cluster with the arabic characters and ignore the previous ZWJ. This can be reproduced with
gives
as expected, but replacing
Especially both @khaledhosny Is this supposed to happen? |
Yes, sort of. HarfBuzz wants to shape scripts in their native direction. So when setting a direction other than the native direction for a script, HarfBuzz will reverse the buffer before shaping. It will also avoid breaking grapheme clusters, as one does not want, say, a mark to precede its base. ZWJ is a grapheme extender, so the first ZWJ is consider a grapheme cluster by itself (as it extends nothing) and the base+mark+ZWJ are considered another grapheme cluster.
After reversal:
After shaping the buffer will be reversed again since the native direction is RTL (a simple reversal this time with no grapheme clusters business).
After reversal:
If you set the script to
Shaping a script in a direction other than its native direction is risky and unlikely to always give meaningful result. |
@khaledhosny Thank you. |
In some cases, namely when commands are inserted between characters,
luatex
+harfbuzz
do not seem to handle thezero width joiner
character (U+200D) properly. Consider the following example, to be compiled withlualatex-dev
:The text was updated successfully, but these errors were encountered: