\square not working with unicode fonts
gromadan opened this issue · 3 comments
While
$\square$
\bye
works,
\fontfam[LMfonts]
$\square$
\bye
does not.
By the way, I find it a bit dangerous that when a character is missing in a font, then optex does not throw an error. Instead, one obtains just a warning message, which is even not labelled as WARNING, so it is easy to overlook it.
This issue was solved by previous commit 857bdab
The warnings about missing characters are directly implemented i TeX. Macro programmer can only say if such warnings are printed to the log only (plain TeX) or to the terminal too (opTeX). The format of these warnings in not in our hand.
I see, sorry, I should have updated my version first.
Actually, there is an undocument callback for intercepting warnings (show_warning_message
), but this particular warning goes through different code path, so it is not useful here. But maybe it would be worth for other cases?
For example the following:
\fontfam[lm]
\directlua{
callback.add_to_callback("show_warning_message", function()
texio.write_nl(string.format("WARNING l.\pcent s: (\pcent s): \pcent s", status.linenumber, status.lastwarningtag, status.lastwarningstring))
end)
}
\pdfrestore
\bye
Produces warning in the OpTeX format:
WARNING l.8: (pdf backend): 'restore' is missing a 'save'
instead of
warning (pdf backend): 'restore' is missing a 'save'
But AFAIK what LuaTeX calls "warnings" are usually checks for consistencies in pdfTeX / LuaTeX additions and often like here with the "backend", the warning is emitted "when the page gets written to PDF", which doesn't really correspond to the printed line number, which might be misleading. Other misleading thing is, that the warning does not come from OpTeX directly, although with the change above, would use the same formatting.
@gromadan There are actually several options for reporting missing characters, contolled by the value of \tracinglostchars
:
0
- no warning1
- warning to log2
- warning to log and terminal3
- error
So if you really want errors you can try \tracinglostchars=3
. (OpTeX by default has \tracinglostchars=2
). For example:
\fontfam[lm]
\tracinglostchars=3
$\square$
\bye
stops with:
Missing character: There is no ^^C (U+0003) in font rsfs10!
.
l.3 $\square$
?
@olsak I just noticed that \loggingall
sets \tracinglostchars=1
, but it should probably also be 2
.