[metapost] luamplib fails to process string with "char 0"

Toby Thurston thurston at eml.cc
Thu Jul 29 13:16:37 CEST 2021


consider the following MP program, which is trying to print the Greek alphabet in the default font using the default TeX encoding, which puts Gamma at position zero

prologues := 3;
outputtemplate := "%j%c.eps";

beginfig(1);
string AB;

AB = ("AB" & char 0 & char 1 & "EZH" & char 2 & "IK" 
          & char 3 & "MNO" & char 4 & char 5 & "P"
          & char 6 & "T"   & char 7 & char 8 & "X"
          & char 9 & char 10);

draw AB infont "cmmi10" shifted 10 up;
draw AB infont "eurm10" shifted 10 down;
draw bbox currentpicture;
endfig;
end.


if I run this through `mpost`  (MetaPost 2.00 (TeX Live 2021) (kpathsea version 6.3.3)) I get two lines with the expected 24 Greek characters in each, with a box around them.

But if I change the program to wrap it up with luamplib like this:

\documentclass{standalone}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
beginfig(1);
string AB;
AB = ("AB" & char 0 & char 1 & "EZH" & char 2 & "IK" 
          & char 3 & "MNO" & char 4 & char 5 & "P"
          & char 6 & "T"   & char 7 & char 8 & "X"
          & char 9 & char 10);
draw AB infont "cmmi10" shifted 10 up;
draw AB infont "eurm10" shifted 10 down;
draw bbox currentpicture;
endfig;
\end{mplibcode}
\end{document}

and run it through `lualatex` (This is LuaHBTeX, Version 1.13.0 (TeX Live 2021) then all I get are the first two characters in each string.  In other words it stops at char 0 (Gamma).
Oddly the bbox is still large enough for the whole string…

any thoughts?

Toby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20210729/11235e60/attachment.html>


More information about the metapost mailing list.