latex3 / luaotfload

OpenType font loader for LuaTeX
Other
59 stars 6 forks source link

bad argument #1 to 'set_scale' for some values of FakeStretch #249

Open sindzicat opened 1 year ago

sindzicat commented 1 year ago

Hello!

When FakeStretch=0.75, all works fine:

\documentclass[a4paper, 14pt]{extreport}

\usepackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}

\usepackage{fontspec}
\setmainfont{Times New Roman}
\setmonofont{Consolas}[Scale=MatchLowercase,FakeStretch=0.75]

\begin{document}
    Hello! Привет!

    \ttfamily Hello! Привет!
\end{document}

But when FakeStretch = 0.85 or 0.9, I got the following error:

(C:/Users/Sindzicat/AppData/Local/Programs/MiKTeX/tex/latex/base/ts1cmr.fd)
warning  (node filter): error: ...ms/MiKTeX/tex/luatex/luaotfload/luaotfload-ha
rf-plug.lua:374: bad argument #1 to 'set_scale' (number has no integer represen
tation)

.
<argument> ...ype:D \tex_hskip:D \c_zero_dim \fi: \tex_par:D
                                                  \hook_use:n {para/after}\@...

l.47 \end{document}

?

Is this a bug? FakeStretch = 0.85 or 0.9 works fine with XeLaTeX.

I also found, that if I comment line \ttfamily Hello Привет, lualatex compiles my document with all values of FakeStretch.

u-fischer commented 1 year ago

hm, looks as if somewhere a float is produced instead of an integer. It works if I floor the numbers in harf-plug.lua

  local hscale = math.floor(hbdata.hscale)
  local vscale = math.floor(hbdata.vscale)  
  hbfont:set_scale(hscale, vscale)
sindzicat commented 1 year ago

@u-fischer, I edited file luaotfload-harf-plug.lua on my local computer, and now all works fine!

Nice workaround! Many thanks!