fontspec icon indicating copy to clipboard operation
fontspec copied to clipboard

script detection faulty with xetex?

Open u-fischer opened this issue 7 years ago • 2 comments
trafficstars

Description

with xelatex \fontspec_if_script:nTF detects scripts which are not in the font

Check/indicate

  • [ X] Relevant for XeTeX
  • [ ] Relevant for LuaTeX
  • [X ] Issue tracker has been searched for similar issues?

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Sanskrit 2003}
\begin{document}

\ExplSyntaxOn

deva:~\fontspec_if_script:nTF{deva}{yes}{no}\par

deva2:~\fontspec_if_script:nTF{deva2}{yes}{no}

\ExplSyntaxOff

\end{document}

Further details

Output with xelatex

image

Output with lualatex (using an experimental fontloader, but I doubt that it matters):

image

Output of otfinfo

C:\Windows\Fonts>otfinfo -s Sanskrit2003.ttf
deva            Devanagari

Perhaps related: issue #317

u-fischer avatar Jul 31 '18 12:07 u-fischer

Ah, NB dev2 not deva2. This is because XeTeX has to jump through hoops to turn the 4-digit code into an integer to then check against low-level return integers from \XeTeXOTscripttag, whereas LuaTeX can pass through the string directly to luaotfload. So XeTeX truncates the deva2 tag to deva which works.

I could add error checking to ensure the tl length of the script tag is exactly 4, I suppose. WDYT?

wspr avatar Jul 31 '18 12:07 wspr

Regarding dev2 against deva2: It is simply to hot here currently.

u-fischer avatar Jul 31 '18 12:07 u-fischer

I just tried this out again and I think I must have added a check and forgotten to close this issue:

./fstest.tex:23: Package fontspec Error: OpenType tag ‘deva2’ is too long; scri
pt, language,
(fontspec)                and feature tags must be four characters or fewer.

(no idea why the text wrapping is broken... I liked our old LaTeX3 errors :))

wspr avatar Apr 27 '24 08:04 wspr