summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/luatex/luamplib
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/luatex/luamplib')
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS118
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin213718 -> 301954 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex168
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex108
4 files changed, 327 insertions, 67 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index 81f07ac38fa..eca51b064fc 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -1,5 +1,123 @@
History of the luamplib package
+2025/02/18 2.37.1
+ * A new operator 'mplibuclength <string>' returns the number of unicode
+ grapheme clusters in the string.
+
+ * A new operator 'mplibucsubstring <pair> of <string>' returns the part of
+ the string indexed by unicode grapheme clusters.
+
+ * These two operators require lua-uni-algos package.
+
+2025/02/06 2.37.0
+ * introduce a new operator 'mpliblength <string>', a unicode-aware version of
+ the 'length' primitive
+
+ * introduce a new operator 'mplibsubstring <pair> of <string>', a unicode-aware
+ version of the 'substring ... of ...' primitive
+
+2024/12/16 2.36.3
+ * change '//' to 'math.floor' for compatibility with luajittex (#158)
+
+ * fix documentation on mplibgraphictext considering the introduction of
+ 'withshadingmethod'
+
+2024/12/11 2.36.2
+ * fix a bug regarding expansion of options
+ (https://tug.org/pipermail/metapost/2024-December/003574.html)
+
+2024/12/09 2.36.1
+ * fix a bug of previous release: missing 'local' in front of 'os'
+
+2024/12/08 2.36.0
+ * <path>|<textual picture> withshadingmethod <string>,
+ where <string> shall be "linear" or "circular", gives shading effect to
+ the <path> or <textual picture> with plain format as well as metafun.
+ See the documentation.
+
+ * withtransparency (<number>|<string>, <number>)
+ gives transparency effect with plain format as well. See the documentation.
+
+ * added 'dir TLT' to usemplibgroup boxes
+
+ * removed 'tag=artifact' option. Use 'artifact' instead.
+
+2024/11/28 2.35.2
+ * fix height/depth of boxes made by \mplibgroup command
+ * enhanced tagging of \usemplibgroup
+
+2024/11/25 2.35.1
+ * cope with 'TEX(char13)': remove everything from char13 to the end of
+ input string (https://tug.org/pipermail/metapost/2024-November/003572.html)
+
+ * (WIP) avoid internal command names of tagpdf/kernel code (#151)
+
+2024/11/12 2.35.0
+ * even under \mplibtextextlabel{true}, the original 'infont' operator will
+ be used when the character slot of the text argument is less than 32, or is
+ equal to 35, 36, 37, 38, 92, 94, 95, 123, 125, 126 or 127.
+
+ * \mplibforcehmode will have effects on \usemplibgroup as well as ordinary
+ metapost figures.
+
+ * support tagged PDF when tagpdf package is activated. The related code is
+ currently in experimental stage. See the documentation for details.
+
+2024/08/03 2.34.5
+ * provide 'withgroupbbox' macro for transparency group to enable users to
+ control the bounding box
+
+ * write down the width/height/depth values of mplibgroup to the log file
+
+2024/07/31 2.34.4
+ * 'withpattern' operator accepts a <textual picture> as well as a <path>
+ for its operand. Thus users can give pattern effect to the result of btex
+ command or infont operator.
+
+ * fix regarding line width in mplibgraphictext
+
+2024/07/27 2.34.3
+ * in DVI mode, use LaTeX's shipout hooks to generate new XObjects
+ or to put resources to pageresources. (in plain, load atbegshi.sty)
+
+ * fix shading to allow the even-odd rule
+
+2024/07/24 2.34.2
+ * With the newly introduced macros, \mplibgroup ... \endmplibgroup, users
+ can define a transparency group or a normal form XObject from TeX side.
+ The LaTeX environment 'mplibgroup' is identical to this pair of macros.
+ See the document for details.
+
+ * document: be more precise about the color effect of a transparency group
+
+ * remove trailing zeros from numeric objects to get smaller PDF
+
+2024/07/19 2.34.1
+ * transparency group is available with plain format as well.
+ * transparency group once used is reusable in the TeX code or
+ in other MetaPost code chunks. see the document for details.
+
+2024/07/17 2.34.0
+ * support transparency group with metafun format
+ * fix regarding default value in circular fading mode
+ * fix regarging the scope of graphics state
+
+2024/07/14 2.33.1
+ * refactor the manual, including some minor items undocumented so far
+ * improve fading routine to get possibly smaller pdf file
+
+2024/07/08 2.33.0
+ * provide a new metapost operator 'withfademethod' and related macros,
+ which make the color of an object gradiently transparent. see luamplib
+ document for details.
+
+ * fix spot-color shading routine to support user-defined colorspace
+
+2024/07/03 2.32.4
+ * make the variable 'patterns' local
+ * 'math.randomseed' on plain TeX
+ * remove redundant code 'fullcircle scaled 0'
+
2024/06/21 2.32.3
* 'coloured' is a synonym of the option 'colored' in pattern definition.
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index e51324ffe40..2033bb205d3 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
+++ b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
index c2d8cb498bf..6156a00f665 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
@@ -6,8 +6,9 @@
\fi
\usepackage{fontspec}
\setmainfont{latin modern roman}
+\newfontfamily\hangulfont{NotoSansCJKKR}[Script=Hangul,Language=Korean]
\usepackage{luamplib}
-\usepackage{xcolor}
+\usepackage{graphicx,xcolor}
\everymplib{ beginfig(0); }
\everyendmplib{ endfig; }
\mpliblegacybehavior{true}%
@@ -185,25 +186,26 @@ draw p scaled 3 shifted (40,0);
endfig;
\end{mplibcode}%
\par
-\mplibsetformat{metafun}%
+%\mplibsetformat{metafun}%
\begin{mplibcode}
beginfig(1)
-fill unitsquare xyscaled (\mpdim\textwidth,1cm)
- withshademethod "linear"
- withshadevector (0,1)
- withshadestep (
- withshadefraction .5
- withshadecolors (red,"blue!50")
+fill unitsquare xscaled \mpdim\textwidth yscaled 1cm
+ withshadingmethod "linear"
+ withshadingvector (0,1)
+ withshadingstep (
+ withshadingfraction .5
+ withshadingcolors (red,"blue!50")
)
- withshadestep (
- withshadefraction 1
- withshadecolors ("blue!50",green)
+ withshadingstep (
+ withshadingfraction 1
+ withshadingcolors ("blue!50",green)
)
;
endfig;
\end{mplibcode}%
\leavevmode
\mpfig
+color yellow; yellow = (1,1,0);
picture Q, u, e;
Q := mplibglyph "Q" of "texgyrepagella-bolditalic.otf" scaled .1;
u := mplibglyph "u" of "texgyrepagella-bolditalic.otf" scaled .1 shifted lrcorner Q;
@@ -217,9 +219,9 @@ for pic=Q, u, e:
if i < totallen: withpostscript "collect"; fi
endfor
endfor
- withshademethod "linear"
- withshadedirection (0.5,2.5)
- withshadecolors (.7red,.7yellow)
+ withshadingmethod "linear"
+ withshadingdirection (0.5,2.5)
+ withshadingcolors (.7red,.7yellow)
;
\endmpfig
\everymplib[@mpfig]{ drawoptions(withcolor mplibrgbtexcolor "olive"); }%
@@ -238,27 +240,27 @@ draw mpliboutlinetext.b ("$\displaystyle\frac{1}{1-x^2}$")
("Question")
( withpen pencircle scaled .3 )
(
- withshademethod "linear"
- withshadedirection (2.5, 0.5)
- withshadecolors(red, blue)
+ withshadingmethod "linear"
+ withshadingdirection (2.5, 0.5)
+ withshadingcolors(red, blue)
)
scaled 4;
\endmpfig
\par\leavevmode
\mppattern{mypatt}
- \mpfig
- picture q;
- q := btex Q etex;
- fill bbox q withcolor .8[red,white];
- draw q withcolor .8red;
- \endmpfig
+[
+ xstep = 5, ystep = 6,
+ matrix = "rotated 90 scaled .75",
+]
+\mpfig
+draw (origin--right+up) scaled 5 withcolor 1/3[blue,white] ;
+draw (up--right) scaled 5 withcolor 1/3[red,white] ;
+\endmpfig
\endmppattern
\mpfig
- fill fullcircle scaled 100 withpostscript "collect";
- draw unitsquare shifted - center unitsquare scaled 45
- withpattern "mypatt"
- withpostscript "evenodd"
- ;
+draw unitsquare shifted -center unitsquare scaled 45 withpostscript "collect" ;
+draw fullcircle scaled 100 withpattern "mypatt" withpen pencircle scaled 1
+ withcolor \mpcolor{red!50!blue!50} withpostscript "evenodd" ;
\endmpfig
\begin{mppattern}{pattuncolored}
[
@@ -268,19 +270,107 @@ draw mpliboutlinetext.b ("$\displaystyle\frac{1}{1-x^2}$")
\tiny\TeX
\end{mppattern}\relax
\mpfig
- picture tex; tex := mpliboutlinetext.p ("\bfseries \TeX");
- i:=0;
- for item within tex:
- i:=i+1;
- if i < length tex:
- fill pathpart item scaled 10 withpostscript "collect";
- else:
- draw pathpart item scaled 10 withpattern "pattuncolored"
- withpen pencircle scaled 1/2
- withcolor 0.7 blue;
- fi
+ picture tex;
+ tex = mpliboutlinetext.p ("\bfseries \TeX");
+ for i=1 upto mpliboutlinenum:
+ draw image(
+ j:=0;
+ for item within mpliboutlinepic[i]:
+ j:=j+1;
+ draw pathpart item scaled 10
+ if j < length mpliboutlinepic[i]:
+ withpostscript "collect"
+ else:
+ withpattern "pattuncolored"
+ withpen pencircle scaled 1/2
+ withcolor (i/4)[red,blue]
+ fi;
+ endfor
+ )
+ withfademethod "linear"
+ ;
+ endfor
+\endmpfig
+\par\leavevmode
+\mpfig
+ picture mill; mill = btex \includegraphics[width=100bp]{mill} etex;
+ draw mill;
+ mill := mill shifted 125right;
+ draw mill
+ withfademethod "circular"
+ withfadecenter (center mill, center mill)
+ withfaderadius (30, abs(lrcorner mill - llcorner mill)/2)
+ withfadeopacity (1, 0)
+ ;
+\endmpfig
+\par
+\def\test#1{%
+ \mpfig
+ fill unitsquare shifted -center unitsquare scaled 200
+ withshadingmethod "linear"
+ withshadingcolors (.3[red,white], .3[blue,white])
+ ;
+ label( btex MetaPost etex scaled 3, origin) ;
+ draw image(
+ fill fullcircle scaled 100 shifted 25left
+ withcolor .8white
+ withtransparency (2,1)
+ ;
+ fill fullcircle scaled 100 shifted 25right
+ withcolor .8white
+ withtransparency (2,1)
+ ;
+ )
+ asgroup "#1"
+ withgroupname "test:#1"
+ withtransparency (1,.5)
+ ;
+ currentpicture := currentpicture scaled 2/3;
+ \endmpfig
+}%
+\hbox{\test{isolated,knockout}\,\test{isolated}\vbox to\MPheight{\vss\hbox{~isolated}\vss}}%
+\hbox{\test{knockout}\,\test{}}%
+\hbox to\MPwidth{\hss knockout\hss}%
+\leavevmode
+\mpfig usemplibgroup "test:isolated,knockout" scaled 2/3 rotated 15 ; \endmpfig
+\usemplibgroup{test:isolated,knockout}%
+\begin{mplibgroup}{mytex}[matrix="rotated 15"] \TeX \end{mplibgroup}%
+\hbox to0pt{\hss\vrule width.5pt height5pt depth5pt\hss}%
+\hbox to0pt{\hss\vrule width10pt height.25pt depth.25pt\hss}%
+\usemplibgroup{mytex}%
+\mpfig usemplibgroup "mytex"; draw (left--right) scaled 5; draw (up--down) scaled 5; \endmpfig
+\par
+\mpfig
+ picture test; test = mplibgraphictext "\textbf{MPLIB}"
+ fakebold 1 fillcolor "red!70" drawcolor .7red scaled 7;
+ draw test withpattern "mypatt" ;
+\endmpfig
+\mpfig
+ picture tex;
+ tex = mplibgraphictext "\bfseries\TeX" rotated 30 scaled 4;
+ draw tex
+ withshadingmethod "linear"
+ withshadingvector (3,0)
+ withshadingcolors (red,blue)
+ ;
+\endmpfig
+\leavevmode
+\mpfig
+ string Test; Test="abçdéf";
+ for k=0 upto mpliblength(Test)-1:
+ draw TEX(mplibsubstring (k,k+1) of Test) scaled 2 shifted (20k,0);
endfor
\endmpfig
+\qquad
+\mpliblegacybehavior{false}%
+\mpfig
+ verbatimtex \hangulfont etex;
+ string Test; Test="나랏말ᄊᆞ미";
+ for k=0 upto mplibuclength(Test)-1:
+ draw TEX(mplibucsubstring (k,k+1) of Test) scaled 1.5 shifted (20k,0);
+ endfor
+\endmpfig
+\mpliblegacybehavior{true}%
\tracingcommands0
\vskip 2\baselineskip
diff --git a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
index c178acb31a7..2f8854c6f37 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
+++ b/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-plain.tex
@@ -1,4 +1,4 @@
-\input luaotfload.sty
+%\input luaotfload.sty
\input miniltx
\input color
\definecolor{orange}{cmyk}{0,.5,1,0}
@@ -178,25 +178,26 @@ draw p scaled 3 shifted (40,0);
endfig;
\endmplibcode
\par
-\mplibsetformat{metafun}%
+%\mplibsetformat{metafun}%
\mplibcode
beginfig(1)
-fill unitsquare xyscaled (\mpdim\hsize, 1cm)
- withshademethod "linear"
- withshadevector (0,1)
- withshadestep (
- withshadefraction .5
- withshadecolors (red,blue)
+fill unitsquare xscaled \mpdim\hsize yscaled 1cm
+ withshadingmethod "linear"
+ withshadingvector (0,1)
+ withshadingstep (
+ withshadingfraction .5
+ withshadingcolors (red,blue)
)
- withshadestep (
- withshadefraction 1
- withshadecolors (blue,green)
+ withshadingstep (
+ withshadingfraction 1
+ withshadingcolors (blue,green)
)
;
endfig;
\endmplibcode
\leavevmode
\mpfig
+color yellow; yellow = (1,1,0);
picture Q, u, e;
Q := mplibglyph "Q" of "texgyrepagella-bolditalic.otf" scaled .1;
u := mplibglyph "u" of "texgyrepagella-bolditalic.otf" scaled .1 shifted lrcorner Q;
@@ -210,9 +211,9 @@ for pic=Q, u, e:
if i < totallen: withpostscript "collect"; fi
endfor
endfor
- withshademethod "linear"
- withshadedirection (0.5,2.5)
- withshadecolors (.7red,.7yellow)
+ withshadingmethod "linear"
+ withshadingdirection (0.5,2.5)
+ withshadingcolors (.7red,.7yellow)
;
\endmpfig
\everymplib[@mpfig]{ drawoptions(withcolor mplibrgbtexcolor"orange"); }%
@@ -231,9 +232,9 @@ draw mpliboutlinetext.b ("$\overbrace{x+\cdots+x}^k$")
("Question")
( withpen pencircle scaled .3 )
(
- withshademethod "linear"
- withshadedirection (2.5, 0.5)
- withshadecolors(red, blue)
+ withshadingmethod "linear"
+ withshadingdirection (2.5, 0.5)
+ withshadingcolors(red, blue)
)
scaled 4;
\endmpfig
@@ -261,18 +262,69 @@ draw mpliboutlinetext.b ("$\overbrace{x+\cdots+x}^k$")
\fiverm\TeX
\endmppattern
\mpfig
- picture tex; tex := mpliboutlinetext.p ("\bf \TeX");
- i:=0;
- for item within tex:
- i:=i+1;
- if i < length tex:
- fill pathpart item scaled 10 withpostscript "collect";
- else:
- draw pathpart item scaled 10 withpattern "pattuncolored"
- withpen pencircle scaled 1/2
- withcolor 0.7 blue;
- fi
+ picture tex;
+ tex = mpliboutlinetext.p ("\bf \TeX");
+ draw image(
+ for i=1 upto mpliboutlinenum:
+ j:=0;
+ for item within mpliboutlinepic[i]:
+ j:=j+1;
+ draw pathpart item scaled 10
+ if j < length mpliboutlinepic[i]:
+ withpostscript "collect"
+ else:
+ withpattern "pattuncolored"
+ withpen pencircle scaled 1/2
+ withcolor (i/4)[red,blue]
+ fi;
+ endfor
endfor
+ )
+ withfademethod "linear"
+ ;
+\endmpfig
+\par\leavevmode
+\mpfig
+fill fullcircle scaled 125 withcolor 2/3[blue,white];
+fill fullcircle scaled 80 withcolor 2/3[red,white];
+draw image(
+ draw (left--right) rotated 45 scaled 50
+ withpen pencircle scaled 20
+ ;
+ draw (left--right) rotated -45 scaled 50
+ withpen pencircle scaled 20
+ ;
+ )
+ asgroup ""
+ withgroupname "testTRgroup"
+ withtransparency (1, .3)
+ ;
+\endmpfig
+\mpfig
+fill fullcircle scaled 125 withcolor 2/3[red,white];
+fill fullcircle scaled 80 withcolor 2/3[blue,white];
+usemplibgroup "testTRgroup"
+ withfademethod "circular"
+ withfaderadius (0,60)
+ ;
+\endmpfig
+\mplibgroup{mytex}[matrix="rotated 15"] \TeX \endmplibgroup
+\hbox to0pt{\hss\vrule width.5pt height5pt depth5pt\hss}%
+\hbox to0pt{\hss\vrule width10pt height.25pt depth.25pt\hss}%
+\usemplibgroup{mytex}%
+\mpfig usemplibgroup "mytex"; draw (left--right) scaled 5; draw (up--down) scaled 5; \endmpfig
+\par
+\mpfig
+ picture test; test = mplibgraphictext "\bf MPLIB"
+ fakebold 1 fillcolor .7[white,blue] drawcolor .7blue scaled 7;
+ draw test withpattern "pattuncolored" ;
+\endmpfig
+\mpfig
+ draw btex \bf\TeX etex rotated 30 scaled 3
+ withshadingmethod "linear"
+ withshadingcolors (red,blue)
+ withshadingvector (0,1)
+ ;
\endmpfig
\tracingcommands0