The problem is this case
|
elseif id == localpar_t then |
|
currdir = getdirection(n) |
|
end |
local_par nodes can appear in the middle of a paragraph, there their direction shouldn't be used. Even if they are head, in the case of hpack_filter they should be ignored too. The easiest thing will be to test the subtype,
https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/master/source/texk/web2c/luatexdir/lua/luatex-api.h#L473
out of the five subtypes only math_par_code and new_graf_par_code matter, and the check itself can be done before the loop only for head.
The problem is that math_par_code is not used in current LuaTeX: https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/commit/5331d1568978681894d188b628ca236e73bc814d
So either find different solution (for example pass the group code to this function to know if this is pre_line_break_filter), or wait a bit (this is probably not urgent). I've noticed there is a startofpar function, but it includes the hmode_par_par_code case and excludes the math_par_code case for some reason, so I think it is wrong (at least here).
Example:
\input luaotfload.sty
\font\f=[DavidCLM-Medium]:mode=harf;script=hebr;\f
\pardirection=1
Test1 \localrightbox{text} () Test2
\bye
(not the wrong parenthesis)
Or this one which errors
\input luaotfload.sty
\font\f=[DavidCLM-Medium]:mode=harf;script=hebr;\f
\pardirection=1
Test1\textdirection=0 \localrightbox{text} () \textdirection=1 Test2
\bye
The problem is this case
luaotfload/src/luaotfload-harf-plug.lua
Lines 251 to 253 in f0d45e3
local_parnodes can appear in the middle of a paragraph, there their direction shouldn't be used. Even if they arehead, in the case ofhpack_filterthey should be ignored too. The easiest thing will be to test the subtype,https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/master/source/texk/web2c/luatexdir/lua/luatex-api.h#L473
out of the five subtypes only
math_par_codeandnew_graf_par_codematter, and the check itself can be done before the loop only for head.The problem is that
math_par_codeis not used in current LuaTeX: https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/commit/5331d1568978681894d188b628ca236e73bc814dSo either find different solution (for example pass the group code to this function to know if this is pre_line_break_filter), or wait a bit (this is probably not urgent). I've noticed there is a
startofparfunction, but it includes thehmode_par_par_codecase and excludes themath_par_codecase for some reason, so I think it is wrong (at least here).Example:
(not the wrong parenthesis)
Or this one which errors