latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
277 stars 34 forks source link

Strange result in ligature with Amiri font #427

Closed seloumi closed 4 years ago

seloumi commented 4 years ago

Description

With Amiri font and Script=Arabic feature I obtain an incorrect result with words like "Scientifique" It appears like this "Scientfiique"

Check/indicate

Minimal example demonstrating the issue

\documentclass{article}

\usepackage{fontspec}
\setmainfont[Script=Arabic]{Amiri}

\begin{document}

Scientifique
\qquad
{\addfontfeatures{Script=Latin} Scientifique}

\end{document}

Result

image

u-fischer commented 4 years ago

Well Script=Arabic is the wrong script to write something in Latin. Beside this I don't think that there is anything fontspec can do here, it is probably a font problem.

seloumi commented 4 years ago

@u-fischer my document is in Arabic and I'm facing the issue when writing some Latin words

seloumi commented 4 years ago

@khaledhosny may be you have an idea ?

khaledhosny commented 4 years ago

That is looks odd but expected, don’t use Script=Arabic for non-Arabic text, it will cause HarfBuzz to do layout from right to left, so it sees if as fi and makes it a ligature.

khaledhosny commented 4 years ago

Nothing here is specific to Amiri, you might not get it with most other fonts because Latin ligature lookups won’t be registered for Arabic script, but Amiri does (not purposefully, but because it simplifies font source).

seloumi commented 4 years ago

@khaledhosny Thanks, so nothing to do here? just change to Script=Latin feature for every Latin words containing if ?

u-fischer commented 4 years ago

Of course, script should be detected automatically, but TeX lives in the previous century and no one gives a damn.

Well luaotfload has a multiscript=auto option:

\documentclass{article}

\usepackage{fontspec}

\begin{document}

\setmainfont[Renderer=HarfBuzz]{Amiri}
Scientifique  یہ ایک جملہ ہے

\setmainfont[Renderer=HarfBuzz,Script=Arabic]{Amiri}
Scientifique  یہ ایک جملہ ہے

\setmainfont[Renderer=HarfBuzz,RawFeature={multiscript=auto}]{Amiri}
Scientifique  یہ ایک جملہ ہے

\end{document}

image

jbezos commented 4 years ago

And with babelluatex: https://github.com/latex3/babel/wiki/What's-new-in-babel-3.38 .