Closed u-fischer closed 5 years ago
Fontspec does not set mode
when checking for supported font scripts/languges/features which is IMO incorrect; if the font is going to be used with, say, mode=base
then it should be checked with the same mode.
Right now, if no mode is set then harfload assumes mode=harf
as IMO is a reasonable to assume if one is loading the package that fonts should by default be loaded with it.
I think fontspec should:
That being said, this check shouldn't fail.
I don't think that it is a fontspec problem. The following prints "true" without harfload, but "false" with harfload/harftex:
\documentclass{article}
%\usepackage{harfload}
\begin{document}
\makeatletter
\font\test={Latin Modern Math}\test abc
\directlua{print(luaotfload.aux.provides_feature(\fontid\test,"math","dflt","ssty"))}
\end{document}
Yes, the provides_feature
is giving the wrong result here and needs to be fixed. I'm overriding luaotfload.aux.provides_feature()
to use HarfBuzz functions for fonts loaded with it, the fontspec issue is that it does not set mode when loading the font for checking, so it ends up checked with HarfBuzz even though it will be loaded later with base
mode.
I just realized that I added the issue to the wrong repo, it should have gone to harf, not harftex. Sorry.
Yes, forcing mode=node makes the test working again. But assuming that the harf-test variant works ok, would it be faster than the orginal? If yes wouldn't it be better if fontspec would test features in harf-mode when available?
It is actually an engine bug (bug in luaharfbuzz module to be exact), so this is the right repo.
harf
mode might faster in loading fonts, but since the font will be loaded with luaotfload eventually then it might not make much of a difference in practice. Also the harf
checks will return false for features that don't actually exist in the font (like tlig
or anum
or any user supplied feature) which is probably undesired.
leads to lots of warnings with
Without harfload there are no warnings. In case that there is something wrong in fontspec or the luaotfload-code: it is imho better if such issues are corrected at the source than trying to patch around. I will then move the issue to the right place.