fontspec
fontspec copied to clipboard
script detection faulty with xetex?
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

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

Output of otfinfo
C:\Windows\Fonts>otfinfo -s Sanskrit2003.ttf
deva Devanagari
Perhaps related: issue #317
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?
Regarding dev2 against deva2: It is simply to hot here currently.
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 :))