In pre_shaping_filter you cannot know the final font id.
The practical problem with that is mirroring, as harf and node behaves differently, and you cannot know what the font will be if fallbacks or multiscripts are used, and there is already a code for that in the bidi branch.
Another possibility is to add a callback/hook after multiscript or move pre_shaping_filter to after fonts are resolved, maybe this hook has other use cases.
Example:
\input unibidi-lua
\directlua{
luaotfload.add_multiscript("hebrew",{Hebr = "DavidCLM:mode=harf;script=hebr;"})
}
\font\a={name:Latin Modern Roman:mode=node;script=latn;}
\font\b={name:David CLM:mode=harf;script=hebr;}
\font\c={name:Latin Modern Roman:mode=node;script=latn;multiscript=hebrew;}
\a Test () Test \b נסיון () נסיון \c Test () Test נסיון () נסיון
\bye
In
pre_shaping_filteryou cannot know the final font id.The practical problem with that is mirroring, as
harfandnodebehaves differently, and you cannot know what the font will be if fallbacks or multiscripts are used, and there is already a code for that in the bidi branch.Another possibility is to add a callback/hook after multiscript or move
pre_shaping_filterto after fonts are resolved, maybe this hook has other use cases.Example: