Skip to content

Wrong direction tracking in luaotfload-harf-plug.lua #327

@Udi-Fogiel

Description

@Udi-Fogiel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions