texlive[71391] Master/texmf-dist: luamplib (30may24)

commits+karl at tug.org commits+karl at tug.org
Thu May 30 21:57:39 CEST 2024


Revision: 71391
          https://tug.org/svn/texlive?view=revision&revision=71391
Author:   karl
Date:     2024-05-30 21:57:39 +0200 (Thu, 30 May 2024)
Log Message:
-----------
luamplib (30may24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
    trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
    trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
    trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
    trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2024-05-30 19:57:31 UTC (rev 71390)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2024-05-30 19:57:39 UTC (rev 71391)
@@ -1,5 +1,14 @@
                        History of the luamplib package
 
+2024/05/30 2.31.2
+   * support vertical writing mode in mpliboutlinetext (presently luatexko
+   package only, and except horizontal mode inside vertical mode)
+
+   * after the process of mpliboutlinetext, mpliboutlinepic[1] ...
+   mpliboutlinepic[mpliboutlinenum] will be preserved as an array of images
+   each of which containing a glyph or a rule.  N.B. Unicode grapheme cluster
+   is not considered here.
+
 2024/05/24 2.31.1
    * fix bugs in outlinetext routine
    * improve rule treatment in graphictext

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex	2024-05-30 19:57:31 UTC (rev 71390)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex	2024-05-30 19:57:39 UTC (rev 71391)
@@ -227,11 +227,23 @@
 \mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig
 \def\mpfiginstancename{mympfig}%
 \mpfig
-draw mpliboutlinetext.b ("$\sqrt{2+\alpha}$")
+draw mpliboutlinetext.b ("$\displaystyle\frac{1}{1-x^2}$")
     (withcolor .6[red,white])
     (withpen pencircle scaled .2 withcolor red)
     scaled 4 ;
 \endmpfig
+\par
+\mpfig
+  draw mpliboutlinetext.r
+    ("Question")
+    ( withpen pencircle scaled .3 )
+    (
+      withshademethod "linear"
+      withshadedirection (2.5, 0.5)
+      withshadecolors(red, blue)
+    )
+    scaled 4;
+\endmpfig
 \tracingcommands0
 
 \vskip 2\baselineskip

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex	2024-05-30 19:57:31 UTC (rev 71390)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex	2024-05-30 19:57:39 UTC (rev 71391)
@@ -220,11 +220,23 @@
 \mpfig circleit.a(btex\tracingcommands0 Box 1 etex); drawboxed(a); \endmpfig
 \def\mpfiginstancename{mympfig}%
 \mpfig
-draw mpliboutlinetext.b ("$\sqrt{2+\alpha}$")
+draw mpliboutlinetext.b ("$\overbrace{x+\cdots+x}^k$")
     (withcolor .6[red,white])
     (withpen pencircle scaled .2 withcolor red)
-    scaled 4 ;
+    scaled 3 ;
 \endmpfig
+\par
+\mpfig
+  draw mpliboutlinetext.r
+    ("Question")
+    ( withpen pencircle scaled .3 )
+    (
+      withshademethod "linear"
+      withshadedirection (2.5, 0.5)
+      withshadecolors(red, blue)
+    )
+    scaled 4;
+\endmpfig
 \tracingcommands0
 
 \vskip 2\baselineskip

Modified: trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2024-05-30 19:57:31 UTC (rev 71390)
+++ trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2024-05-30 19:57:39 UTC (rev 71391)
@@ -85,7 +85,7 @@
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luamplib.drv}%
-  [2024/05/24 v2.31.1 Interface for using the mplib library]%
+  [2024/05/30 v2.31.2 Interface for using the mplib library]%
 \documentclass{ltxdoc}
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
@@ -153,7 +153,7 @@
 % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
 % Maintainer: LuaLaTeX Maintainers ---
 % Support: \email{lualatex-dev at tug.org}}
-% \date{2024/05/24 v2.31.1}
+% \date{2024/05/30 v2.31.2}
 %
 % \maketitle
 %
@@ -524,31 +524,6 @@
 %   Number Rule. As a result, for instance, the area surrounded by inner path of ``O''
 %   will remain transparent.
 %
-%   We can adapt the method used in |mplibdrawglyph| to multiple pictures as if they were
-%   components of one and the same picture.  An example:
-%   \begin{verbatim}
-%     \mplibsetformat{metafun}
-%     \mpfig
-%     picture Q, u, e;
-%     Q := mplibglyph "Q" of "Times.ttc(2)" scaled .15;
-%     u := mplibglyph "u" of "Times.ttc(2)" scaled .15 shifted lrcorner Q;
-%     e := mplibglyph "e" of "Times.ttc(2)" scaled .15 shifted lrcorner u;
-%
-%     i:=0;
-%     totallen := length Q + length u + length e;
-%     for pic=Q, u, e:
-%       for item within pic:
-%         i:=i+1;
-%         fill pathpart item
-%         if i < totallen: withpostscript "collect"; fi
-%       endfor
-%     endfor
-%       withshademethod "linear"
-%       withshadedirection (0.5,2.5)
-%       withshadecolors (.7red,.7yellow);
-%     \endmpfig
-%   \end{verbatim}
-%
 % \paragraph{\texttt{mpliboutlinetext}}
 %   From v2.31, we provide a new metapost operator |mpliboutlinetext|, which mimicks
 %   metafun's |outlinetext|. So the syntax is the same as metafun's. See the metafun
@@ -559,6 +534,12 @@
 %         (withpen pencircle scaled .2 withcolor red)
 %         scaled 2 ;
 %   \end{verbatim}
+%   After the process of |mpliboutlinetext|, |mpliboutlinepic[]|
+%   and |mpliboutlinenum| will be preserved as global variables;
+%   |mpliboutlinepic[1]| \ldots{} |mpliboutlinepic[mpliboutlinenum]|
+%   will be an array of images each of which containing a glyph or a rule.
+%   \textsc{n.b.} As Unicode grapheme cluster is not considered in the array, a unit that must be
+%   a single cluster might be separated apart.
 %
 % \paragraph{About figure box metrics}
 %   Notice that, after each figure is processed, macro \cs{MPwidth} stores
@@ -592,8 +573,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.31.1",
-  date          = "2024/05/24",
+  version       = "2.31.2",
+  date          = "2024/05/30",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -1596,14 +1577,13 @@
       local f = curr.font
       local i = emboldenfonts[f]
       if not i then
+        local ft = font.getfont(f) or font.getcopy(f)
         if pdfmode then
-          local ft = font.getcopy(f)
           width = ft.size * fakebold / factor * 10
           emboldenfonts.width = width
           ft.mode, ft.width = 2, width
           i = font.define(ft)
         else
-          local ft = font.getfont(f) or font.getcopy(f)
           if ft.format ~= "opentype" and ft.format ~= "truetype" then
             goto skip_type1
           end
@@ -1818,7 +1798,7 @@
 %
 %    mpliboutlinetext : based on mkiv's font-mps.lua
 %    \begin{macrocode}
-local rulefmt = "mplibpic[%i]:=image(addto currentpicture contour \z
+local rulefmt = "mpliboutlinepic[%i]:=image(addto currentpicture contour \z
 unitsquare shifted - center unitsquare;) xscaled %f yscaled %f shifted (%f,%f);"
 local outline_horz, outline_vert
 function outline_vert (res, box, curr, xshift, yshift)
@@ -1937,6 +1917,18 @@
       dx = dx - (r2l and curr.width/factor*expand or 0)
       local xpos = dx + xshift + (curr.xoffset or 0)/factor
       local ypos = yshift + (curr.yoffset or 0)/factor
+      local vertical = ft.shared and ft.shared.features.vertical and "rotated 90" or ""
+      if vertical ~= "" then -- luatexko
+        for _,v in ipairs(ft.characters[curr.char].commands or { }) do
+          if v[1] == "down" then
+            ypos = ypos - v[2] / factor
+          elseif v[1] == "right" then
+            xpos = xpos + v[2] / factor
+          else
+            break
+          end
+        end
+      end
       local image
       if ft.format == "opentype" or ft.format == "truetype" then
         image = luamplib.glyph(curr.font, gid)
@@ -1956,8 +1948,8 @@
         end
         image = format("glyph %s of %q scaled %f", gid, name, scale)
       end
-      res[#res+1] = format("mplibpic[%i]:=%s xscaled %f yscaled %f slanted %f shifted (%f,%f);",
-                           #res+1, image, xscale, yscale, slant, xpos, ypos)
+      res[#res+1] = format("mpliboutlinepic[%i]:=%s xscaled %f yscaled %f slanted %f %s shifted (%f,%f);",
+                           #res+1, image, xscale, yscale, slant, vertical, xpos, ypos)
       dx = dx + (r2l and 0 or curr.width/factor*expand)
     elseif curr.replace then
       local width = node.dimensions(curr.replace)/factor
@@ -2042,12 +2034,8 @@
   local id  = tonumber(fmt:match"mplibtexboxid=(%d+):")
   local box = texgetbox(id)
   local res = outline_horz({ }, box, box.head, 0, 0)
-  if #res == 0 then res = { "mplibpic[1]:=image(fill fullcircle scaled 0;);" } end
-  local t = { }
-  for i=1, #res do
-    t[#t+1] = format("addto currentpicture also mplibpic[%i];", i)
-  end
-  return tableconcat(res) .. format("mplibpic[0]:=image(%s);", tableconcat(t))
+  if #res == 0 then res = { "mpliboutlinepic[1]:=image(fill fullcircle scaled 0;);" } end
+  return tableconcat(res) .. format("mpliboutlinenum:=%i;", #res)
 end
 
 %    \end{macrocode}
@@ -2155,6 +2143,9 @@
   def mplib_do_outline_options_f = f enddef;
   def mplib_do_outline_options_r = r enddef;
 enddef;
+def mplib_do_outline_text_set_u (text f) text r =
+  def mplib_do_outline_options_f = f enddef;
+enddef;
 def mplib_do_outline_text_set_d (text d) text r =
   def mplib_do_outline_options_d = d enddef;
   def mplib_do_outline_options_r = r enddef;
@@ -2168,27 +2159,40 @@
   def mplib_do_outline_options_r = r enddef;
 enddef;
 def mplib_do_outline_text_set_p = enddef;
-def mplib_fill_outline_text (expr p) =
-  i:=0;
-  for item within p:
-    i:=i+1;
-    addto currentpicture contour pathpart item
-    if i < length p: withpostscript "collect"; fi
+def mplib_fill_outline_text =
+  for n=1 upto mpliboutlinenum:
+    i:=0;
+    for item within mpliboutlinepic[n]:
+      i:=i+1;
+      fill pathpart item mplib_do_outline_options_f withpen pencircle scaled 0
+      if (n<mpliboutlinenum) or (i<length mpliboutlinepic[n]): withpostscript "collect"; fi
+    endfor
   endfor
-  mplib_do_outline_options_f;
 enddef;
-def mplib_draw_outline_text (expr p) =
-  i:=0;
-  for item within p:
-    i:=i+1;
-    addto currentpicture doublepath pathpart item
-    if i < length p: withpostscript "collect"; fi
+def mplib_draw_outline_text =
+  for n=1 upto mpliboutlinenum:
+    for item within mpliboutlinepic[n]:
+      draw pathpart item mplib_do_outline_options_d;
+    endfor
   endfor
-  mplib_do_outline_options_d;
 enddef;
+def mplib_filldraw_outline_text =
+  for n=1 upto mpliboutlinenum:
+    i:=0;
+    for item within mpliboutlinepic[n]:
+      i:=i+1;
+      if (n<mpliboutlinenum) or (i<length mpliboutlinepic[n]):
+        fill pathpart item mplib_do_outline_options_f withpostscript "collect";
+      else:
+        draw pathpart item mplib_do_outline_options_f withpostscript "both";
+      fi
+    endfor
+  endfor
+enddef;
 vardef mpliboutlinetext@# (expr t) text rest =
   save kind; string kind; kind := str @#;
-  save mplibpic, i; picture mplibpic[]; numeric i;
+  save i; numeric i;
+  picture mpliboutlinepic[]; numeric mpliboutlinenum;
   def mplib_do_outline_options_d = enddef;
   def mplib_do_outline_options_f = enddef;
   def mplib_do_outline_options_r = enddef;
@@ -2196,28 +2200,27 @@
   image ( addto currentpicture also image (
     if kind = "f":
       mplib_do_outline_text_set_f rest;
-      def mplib_do_outline_options_d = withpen pencircle scaled 0 enddef;
-      mplib_fill_outline_text (mplibpic0);
+      mplib_fill_outline_text;
     elseif kind = "d":
       mplib_do_outline_text_set_d rest;
-      mplib_draw_outline_text (mplibpic0);
+      mplib_draw_outline_text;
     elseif kind = "b":
       mplib_do_outline_text_set_b rest;
-      mplib_fill_outline_text (mplibpic0);
-      mplib_draw_outline_text (mplibpic0);
+      mplib_fill_outline_text;
+      mplib_draw_outline_text;
     elseif kind = "u":
-      mplib_do_outline_text_set_f rest;
-      mplib_fill_outline_text (mplibpic0);
+      mplib_do_outline_text_set_u rest;
+      mplib_filldraw_outline_text;
     elseif kind = "r":
       mplib_do_outline_text_set_r rest;
-      mplib_draw_outline_text (mplibpic0);
-      mplib_fill_outline_text (mplibpic0);
+      mplib_draw_outline_text;
+      mplib_fill_outline_text;
     elseif kind = "p":
       mplib_do_outline_text_set_p;
-      mplib_draw_outline_text (mplibpic0);
+      mplib_draw_outline_text;
     else:
       mplib_do_outline_text_set_n rest;
-      mplib_fill_outline_text (mplibpic0);
+      mplib_fill_outline_text;
     fi;
   ) mplib_do_outline_options_r; )
 enddef ;
@@ -2539,6 +2542,7 @@
 %    \begin{macrocode}
 local prev_override_color
 local function do_preobj_CR(object,prescript)
+  if object.postscript == "collect" then return end
   local override = prescript and prescript.mpliboverridecolor
   if override then
     if pdfmode then
@@ -2672,7 +2676,8 @@
   return on
 end
 
-local function do_preobj_TR(prescript)
+local function do_preobj_TR(object,prescript)
+  if object.postscript == "collect" then return end
   local opaq = prescript and prescript.tr_transparency
   local tron_no
   if opaq then
@@ -2767,6 +2772,7 @@
 end })
 
 local function do_preobj_SH(object,prescript)
+  if object.postscript == "collect" then return end
   local shade_no
   local sh_type = prescript and prescript.sh_type
   if sh_type then
@@ -2930,7 +2936,7 @@
               local prescript     = object.prescript
               prescript = prescript and script2table(prescript) -- prescript is now a table
               local cr_over = do_preobj_CR(object,prescript) -- color
-              local tr_opaq = do_preobj_TR(prescript) -- opacity
+              local tr_opaq = do_preobj_TR(object,prescript) -- opacity
               if prescript and prescript.mplibtexboxid then
                 put_tex_boxes(object,prescript)
               elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then --skip
@@ -3170,7 +3176,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2024/05/24 v2.31.1 mplib package for LuaTeX]
+    [2024/05/30 v2.31.2 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2024-05-30 19:57:31 UTC (rev 71390)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2024-05-30 19:57:39 UTC (rev 71391)
@@ -11,8 +11,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.31.1",
-  date          = "2024/05/24",
+  version       = "2.31.2",
+  date          = "2024/05/30",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -775,14 +775,13 @@
       local f = curr.font
       local i = emboldenfonts[f]
       if not i then
+        local ft = font.getfont(f) or font.getcopy(f)
         if pdfmode then
-          local ft = font.getcopy(f)
           width = ft.size * fakebold / factor * 10
           emboldenfonts.width = width
           ft.mode, ft.width = 2, width
           i = font.define(ft)
         else
-          local ft = font.getfont(f) or font.getcopy(f)
           if ft.format ~= "opentype" and ft.format ~= "truetype" then
             goto skip_type1
           end
@@ -989,7 +988,7 @@
   return glyphimage(t, kind)
 end
 
-local rulefmt = "mplibpic[%i]:=image(addto currentpicture contour \z
+local rulefmt = "mpliboutlinepic[%i]:=image(addto currentpicture contour \z
 unitsquare shifted - center unitsquare;) xscaled %f yscaled %f shifted (%f,%f);"
 local outline_horz, outline_vert
 function outline_vert (res, box, curr, xshift, yshift)
@@ -1108,6 +1107,18 @@
       dx = dx - (r2l and curr.width/factor*expand or 0)
       local xpos = dx + xshift + (curr.xoffset or 0)/factor
       local ypos = yshift + (curr.yoffset or 0)/factor
+      local vertical = ft.shared and ft.shared.features.vertical and "rotated 90" or ""
+      if vertical ~= "" then -- luatexko
+        for _,v in ipairs(ft.characters[curr.char].commands or { }) do
+          if v[1] == "down" then
+            ypos = ypos - v[2] / factor
+          elseif v[1] == "right" then
+            xpos = xpos + v[2] / factor
+          else
+            break
+          end
+        end
+      end
       local image
       if ft.format == "opentype" or ft.format == "truetype" then
         image = luamplib.glyph(curr.font, gid)
@@ -1127,8 +1138,8 @@
         end
         image = format("glyph %s of %q scaled %f", gid, name, scale)
       end
-      res[#res+1] = format("mplibpic[%i]:=%s xscaled %f yscaled %f slanted %f shifted (%f,%f);",
-                           #res+1, image, xscale, yscale, slant, xpos, ypos)
+      res[#res+1] = format("mpliboutlinepic[%i]:=%s xscaled %f yscaled %f slanted %f %s shifted (%f,%f);",
+                           #res+1, image, xscale, yscale, slant, vertical, xpos, ypos)
       dx = dx + (r2l and 0 or curr.width/factor*expand)
     elseif curr.replace then
       local width = node.dimensions(curr.replace)/factor
@@ -1213,12 +1224,8 @@
   local id  = tonumber(fmt:match"mplibtexboxid=(%d+):")
   local box = texgetbox(id)
   local res = outline_horz({ }, box, box.head, 0, 0)
-  if #res == 0 then res = { "mplibpic[1]:=image(fill fullcircle scaled 0;);" } end
-  local t = { }
-  for i=1, #res do
-    t[#t+1] = format("addto currentpicture also mplibpic[%i];", i)
-  end
-  return tableconcat(res) .. format("mplibpic[0]:=image(%s);", tableconcat(t))
+  if #res == 0 then res = { "mpliboutlinepic[1]:=image(fill fullcircle scaled 0;);" } end
+  return tableconcat(res) .. format("mpliboutlinenum:=%i;", #res)
 end
 
 luamplib.preambles = {
@@ -1322,6 +1329,9 @@
   def mplib_do_outline_options_f = f enddef;
   def mplib_do_outline_options_r = r enddef;
 enddef;
+def mplib_do_outline_text_set_u (text f) text r =
+  def mplib_do_outline_options_f = f enddef;
+enddef;
 def mplib_do_outline_text_set_d (text d) text r =
   def mplib_do_outline_options_d = d enddef;
   def mplib_do_outline_options_r = r enddef;
@@ -1335,27 +1345,40 @@
   def mplib_do_outline_options_r = r enddef;
 enddef;
 def mplib_do_outline_text_set_p = enddef;
-def mplib_fill_outline_text (expr p) =
-  i:=0;
-  for item within p:
-    i:=i+1;
-    addto currentpicture contour pathpart item
-    if i < length p: withpostscript "collect"; fi
+def mplib_fill_outline_text =
+  for n=1 upto mpliboutlinenum:
+    i:=0;
+    for item within mpliboutlinepic[n]:
+      i:=i+1;
+      fill pathpart item mplib_do_outline_options_f withpen pencircle scaled 0
+      if (n<mpliboutlinenum) or (i<length mpliboutlinepic[n]): withpostscript "collect"; fi
+    endfor
   endfor
-  mplib_do_outline_options_f;
 enddef;
-def mplib_draw_outline_text (expr p) =
-  i:=0;
-  for item within p:
-    i:=i+1;
-    addto currentpicture doublepath pathpart item
-    if i < length p: withpostscript "collect"; fi
+def mplib_draw_outline_text =
+  for n=1 upto mpliboutlinenum:
+    for item within mpliboutlinepic[n]:
+      draw pathpart item mplib_do_outline_options_d;
+    endfor
   endfor
-  mplib_do_outline_options_d;
 enddef;
+def mplib_filldraw_outline_text =
+  for n=1 upto mpliboutlinenum:
+    i:=0;
+    for item within mpliboutlinepic[n]:
+      i:=i+1;
+      if (n<mpliboutlinenum) or (i<length mpliboutlinepic[n]):
+        fill pathpart item mplib_do_outline_options_f withpostscript "collect";
+      else:
+        draw pathpart item mplib_do_outline_options_f withpostscript "both";
+      fi
+    endfor
+  endfor
+enddef;
 vardef mpliboutlinetext@# (expr t) text rest =
   save kind; string kind; kind := str @#;
-  save mplibpic, i; picture mplibpic[]; numeric i;
+  save i; numeric i;
+  picture mpliboutlinepic[]; numeric mpliboutlinenum;
   def mplib_do_outline_options_d = enddef;
   def mplib_do_outline_options_f = enddef;
   def mplib_do_outline_options_r = enddef;
@@ -1363,28 +1386,27 @@
   image ( addto currentpicture also image (
     if kind = "f":
       mplib_do_outline_text_set_f rest;
-      def mplib_do_outline_options_d = withpen pencircle scaled 0 enddef;
-      mplib_fill_outline_text (mplibpic0);
+      mplib_fill_outline_text;
     elseif kind = "d":
       mplib_do_outline_text_set_d rest;
-      mplib_draw_outline_text (mplibpic0);
+      mplib_draw_outline_text;
     elseif kind = "b":
       mplib_do_outline_text_set_b rest;
-      mplib_fill_outline_text (mplibpic0);
-      mplib_draw_outline_text (mplibpic0);
+      mplib_fill_outline_text;
+      mplib_draw_outline_text;
     elseif kind = "u":
-      mplib_do_outline_text_set_f rest;
-      mplib_fill_outline_text (mplibpic0);
+      mplib_do_outline_text_set_u rest;
+      mplib_filldraw_outline_text;
     elseif kind = "r":
       mplib_do_outline_text_set_r rest;
-      mplib_draw_outline_text (mplibpic0);
-      mplib_fill_outline_text (mplibpic0);
+      mplib_draw_outline_text;
+      mplib_fill_outline_text;
     elseif kind = "p":
       mplib_do_outline_text_set_p;
-      mplib_draw_outline_text (mplibpic0);
+      mplib_draw_outline_text;
     else:
       mplib_do_outline_text_set_n rest;
-      mplib_fill_outline_text (mplibpic0);
+      mplib_fill_outline_text;
     fi;
   ) mplib_do_outline_options_r; )
 enddef ;
@@ -1660,6 +1682,7 @@
 
 local prev_override_color
 local function do_preobj_CR(object,prescript)
+  if object.postscript == "collect" then return end
   local override = prescript and prescript.mpliboverridecolor
   if override then
     if pdfmode then
@@ -1785,7 +1808,8 @@
   return on
 end
 
-local function do_preobj_TR(prescript)
+local function do_preobj_TR(object,prescript)
+  if object.postscript == "collect" then return end
   local opaq = prescript and prescript.tr_transparency
   local tron_no
   if opaq then
@@ -1876,6 +1900,7 @@
 end })
 
 local function do_preobj_SH(object,prescript)
+  if object.postscript == "collect" then return end
   local shade_no
   local sh_type = prescript and prescript.sh_type
   if sh_type then
@@ -2018,7 +2043,7 @@
               local prescript     = object.prescript
               prescript = prescript and script2table(prescript) -- prescript is now a table
               local cr_over = do_preobj_CR(object,prescript) -- color
-              local tr_opaq = do_preobj_TR(prescript) -- opacity
+              local tr_opaq = do_preobj_TR(object,prescript) -- opacity
               if prescript and prescript.mplibtexboxid then
                 put_tex_boxes(object,prescript)
               elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then --skip

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2024-05-30 19:57:31 UTC (rev 71390)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2024-05-30 19:57:39 UTC (rev 71391)
@@ -14,7 +14,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2024/05/24 v2.31.1 mplib package for LuaTeX]
+    [2024/05/30 v2.31.2 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi



More information about the tex-live-commits mailing list.