summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context/sources/general/manuals/metafun
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-03-06 21:58:15 +0000
committerKarl Berry <karl@freefriends.org>2021-03-06 21:58:15 +0000
commit974640d66e61e81cb197ad96fdff7b08343e4c5a (patch)
tree2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/doc/context/sources/general/manuals/metafun
parentb4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff)
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/context/sources/general/manuals/metafun')
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp1284
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-basics.tex309
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-debugging.tex237
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-effects.tex265
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment-layout.tex4
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment.tex46
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-examples.tex253
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-gadgets.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-introduction.tex9
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-layout.tex2
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-lua.tex995
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-macros.tex13
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-reference.tex29
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex149
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-styles.tex4
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text-lmtx.tex1519
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text.tex125
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-welcome.tex64
-rw-r--r--Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun.tex18
19 files changed, 4845 insertions, 482 deletions
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp
new file mode 100644
index 00000000000..5076c729ae1
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/gracht.mp
@@ -0,0 +1,1284 @@
+% Converted from PostScript(TM) to MetaPost by pstoedit
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+% MetaPost backend contributed by Scott Pakin <pakin@uiuc.edu>
+% pstoedit is Copyright (C) 1993 - 1999 Wolfgang Glunz <wglunz@geocities.com>
+
+% Generate structured PostScript
+prologues := 1;
+
+% Display a given string with its *baseline* at a given location
+% and with a given rotation angle
+vardef showtext(expr origin)(expr angle)(expr string) =
+ draw string infont defaultfont scaled defaultscale
+ rotated angle shifted origin;
+enddef;
+
+beginfig(1);
+drawoptions (withcolor (0.8,0.9,1));
+linecap := butt;
+linejoin := mitered;
+fill (34.0598,214.47)--(286.57,214.47)--(285.2,72.9199)
+ --(38.1699,83.8599)--(34.0598,214.47)--cycle;
+drawoptions (withcolor (0.95,0.95,0.95));
+fill (62,152.91)..controls (62,152.91) and (74.24,150.18)..(77.6199,152.91)
+ ..controls (81.0798,155.65) and (98.0698,152.91)..(98.0698,152.91)
+ ..controls (98.0698,152.91) and (106.21,148.81)..(111.68,148.81)
+ ..controls (117.15,148.81) and (130.76,147.37)..(130.76,147.37)
+ --(134.86,140.53)..controls (134.86,140.53) and (130.11,139.88)..(123.92,139.88)
+ ..controls (117.8,139.88) and (98.72,139.23)..(98.72,139.23)
+ --(82.3799,139.23)--(72.1499,145.35)--(64.0198,147.37)
+ --(62,152.91)--cycle;
+drawoptions (withcolor (0.9,0.9,0.9));
+fill (202.11,112.52)--(200.82,126.85)--(184.47,117.99)
+ --(170.86,116.62)--(150.42,117.34)--(141.63,114.61)
+ --(104.19,115.26)--(87.1299,115.26)--(69.49,113.17)
+ --(74.96,107.77)--(106.21,108.42)--(140.98,108.42)
+ --(147.03,110.5)--(165.39,110.5)--(164.74,104.38)
+ --(172.88,103.74)--(285.92,79.0398)--(285.2,98.9099)
+ --(271.59,100.93)--(202.11,112.52)--cycle;
+drawoptions (withcolor (1,0.4,0.4));
+fill (285.92,193.23)--(259.78,193.23)--(259.78,188.7)
+ --(277.35,148.88)--(285.92,155.72)--(285.92,193.23)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (285.92,193.23)--(259.78,193.23)--(259.78,188.7)
+ --(277.35,148.88)--(285.92,155.72)--(285.92,193.23);
+drawoptions (withcolor (1,0.9,0.9));
+pickup pencircle scaled 0bp;
+fill (231.85,165.66)--(235.95,169.69)--(246.75,170.62)
+ --(273.32,149.82)--(272.89,101)--(235.02,107.34)
+ --(231.85,165.66)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (231.85,165.66)--(235.95,169.69)--(246.75,170.62)
+ --(273.32,149.82)--(272.89,101)--(235.02,107.34)
+ --(231.85,165.66);
+drawoptions (withcolor (0,0.5,0));
+pickup pencircle scaled 0bp;
+fill (178.28,133.26)..controls (178.28,133.26) and (175.98,132.39)..(175.11,130.09)
+ ..controls (174.25,127.78) and (172.38,125.62)..(172.38,125.62)
+ ..controls (172.38,125.62) and (170.86,124.47)..(170,121.88)
+ ..controls (169.21,119.36) and (168.99,119.14)..(168.99,118.06)
+ ..controls (168.99,116.98) and (169.21,116.19)..(170.43,116.41)
+ ..controls (171.73,116.55) and (172.81,117.63)..(172.81,117.63)
+ --(175.33,116.84)..controls (175.33,116.84) and (175.9,116.62)..(177.42,117.85)
+ ..controls (178.86,119.14) and (179.29,121.52)..(179.72,120.22)
+ ..controls (180.15,118.93) and (179.94,119.58)..(180.73,118.06)
+ ..controls (181.59,116.55) and (183.03,115.98)..(184.11,116.41)
+ ..controls (185.19,116.84) and (184.47,115.69)..(185.55,117.2)
+ ..controls (186.63,118.71) and (185.19,122.74)..(185.19,122.74)
+ --(182.24,132.39)--(178.28,133.26)--cycle;
+drawoptions (withcolor (0,0.6,0));
+fill (203.19,132.82)..controls (207.44,132.82) and (198.58,125.84)..(194.55,123.61)
+ ..controls (190.45,121.3) and (188.65,115.04)..(184.11,120.87)
+ ..controls (179.65,126.7) and (184.54,132.61)..(180.51,133.04)
+ ..controls (176.48,133.54) and (177.85,132.18)..(174.68,133.54)
+ ..controls (171.51,134.84) and (172.45,140.31)..(172.45,140.31)
+ ..controls (172.45,140.31) and (175.98,145.71)..(177.42,148.88)
+ ..controls (178.78,152.05) and (177.42,152.91)..(177.85,155.22)
+ ..controls (178.28,157.52) and (181.02,159.32)..(181.02,159.32)
+ --(190.02,158.82)--(192.25,162.78)..controls (192.25,162.78) and (196.78,162.92)..(199.02,161.12)
+ ..controls (201.25,159.32) and (201.25,156.58)..(201.25,156.58)
+ --(203.98,155.22)--(203.55,147.58)--(201.68,143.12)
+ ..controls (201.68,143.12) and (201.82,139.95)..(203.19,137.72)
+ ..controls (204.56,135.42) and (202.76,132.82)..(203.19,132.82)
+ --cycle;
+drawoptions (withcolor (0.8,0.8,0.8));
+fill (1.37988,135.34)--(63.9399,129.01)--(67.98,114.97)
+ --(73.8799,108.63)--(57.6799,89.26)--(0.869873,46.2798)
+ --(1.37988,135.34)--cycle;
+drawoptions (withcolor (0,0.6,0));
+fill (141.27,120.87)..controls (140.84,121.23) and (143.65,122.46)..(139.62,123.32)
+ ..controls (135.51,124.26) and (134.65,122.67)..(129.25,122.67)
+ ..controls (123.85,122.67) and (124.28,120.87)..(122.05,122.67)
+ ..controls (119.82,124.47) and (119.38,126.27)..(115.28,126.27)
+ ..controls (111.25,126.27) and (109.45,126.7)..(106.78,124.9)
+ ..controls (104.05,123.1) and (102.68,123.1)..(100.45,123.1)
+ ..controls (98.22,123.1) and (96.3398,123.18)..(93.6799,123.61)
+ ..controls (91.0198,124.04) and (88.7798,124.47)..(86.0498,124.9)
+ ..controls (83.3098,125.41) and (80.5798,125.84)..(77.9099,125.41)
+ ..controls (75.25,124.9) and (70.2798,124.47)..(66.6799,124.9)
+ ..controls (63.0798,125.41) and (60.3398,127.21)..(57.1799,125.41)
+ ..controls (54.0798,123.61) and (49.1099,123.61)..(49.1099,123.61)
+ --(44.1399,122.67)--(45.0798,115.9)..controls (45.0798,115.9) and (43.2798,113.6)..(49.5398,113.6)
+ ..controls (55.8799,113.6) and (58.98,113.6)..(64.8799,113.6)
+ ..controls (70.71,113.6) and (69.4199,112.66)..(76.1099,114.03)
+ ..controls (82.8799,115.47) and (86.98,115.47)..(91.8799,115.47)
+ ..controls (96.8499,115.47) and (100.88,114.97)..(105.85,114.97)
+ ..controls (110.82,114.97) and (112.62,114.97)..(118.02,114.97)
+ ..controls (123.42,114.97) and (125.22,114.54)..(136.02,114.54)
+ ..controls (146.74,114.54) and (146.74,115.9)..(146.74,115.9)
+ --(145.88,120.37)--(141.27,120.87)--cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+fill (5.83984,98.26)--(27.5098,109.14)--(46.3799,113.6)
+ --(70.2798,114.03)--(74.3098,109.57)--(49.5398,105.54)
+ --(0.869873,67.95)--(5.83984,98.26)--cycle;
+drawoptions (withcolor (0.8,0.3,0));
+fill (105.85,108.2)--(106.78,85.23)--(73.8799,84.2998)
+ --(66.25,38.1399)--(36.7998,1.05981)--(0.72998,1.05981)
+ --(0.869873,49.8799)..controls (0.869873,49.8799) and (24.7798,67.0898)..(36.0798,74.7898)
+ ..controls (47.3098,82.5) and (70.2798,104.6)..(72.5098,107.34)
+ ..controls (74.74,110) and (77.48,108.2)..(77.48,108.2)
+ --(105.85,108.2)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (75.25,107.77)--(105.85,107.77)--(105.85,85.23)
+ --(75.25,85.23)--(75.25,107.77)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (75.25,107.77)--(105.85,107.77)--(105.85,85.23)
+ --(75.25,85.23)--(75.25,107.77);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 2.23bp;
+draw (118.59,71.1899)--(117.22,61.8999);
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (266.48,1.56982)--(267.34,45.9199)--(158.84,82.3499)
+ --(149.26,81.2)--(144.15,86.3098)--(140.84,107.77)
+ --(104.84,107.26)--(105.92,86.3098)--(114.92,40.45)
+ --(55.5898,38.5798)--(37.23,0.849854)--(266.48,1.56982)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+fill (55.1599,40.0898)--(113.98,37.21)--(153.94,25.8999)
+ ..controls (153.94,25.8999) and (123.42,17.8398)..(145.88,14.6699)
+ ..controls (168.34,11.4299) and (158.91,11)..(152.65,7.3999)
+ ..controls (146.31,3.7998) and (118.95,1.05981)..(113.48,1.05981)
+ ..controls (108.08,1.05981) and (35.6499,1.05981)..(35.6499,1.05981)
+ --(55.1599,40.0898)--cycle;
+drawoptions (withcolor (1,0.7,0));
+fill (146.96,157.59)--(149.77,157.59)--(149.77,118.06)
+ --(146.96,118.06)--(146.96,157.59)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (146.96,157.59)--(149.77,157.59)--(149.77,118.06)
+ --(146.96,118.06)--(146.96,157.59);
+drawoptions (withcolor (1,0.7,0));
+pickup pencircle scaled 0bp;
+fill (109.16,161.05)--(180.37,158.53)--(176.41,154.86)
+ --(108.66,157.3)--(109.16,161.05)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (109.16,161.05)--(180.37,158.53)--(176.41,154.86)
+ --(108.66,157.3)--(109.16,161.05);
+drawoptions (withcolor (1,0.9,0));
+pickup pencircle scaled 0bp;
+fill (107.65,166.74)--(192.18,162.27)--(189.94,159.54)
+ --(108.15,162.99)--(107.65,166.74)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (107.65,166.74)--(192.18,162.27)--(189.94,159.54)
+ --(108.15,162.99)--(107.65,166.74);
+drawoptions (withcolor (1,0.9,0));
+pickup pencircle scaled 0bp;
+fill (149.77,163.86)--(153.8,163.86)--(153.8,110.07)
+ --(149.77,110.07)--(149.77,163.86)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (149.77,163.86)--(153.8,163.86)--(153.8,110.07)
+ --(149.77,110.07)--(149.77,163.86);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 2.23bp;
+draw (112.26,165.3)--(104.77,109.14);
+draw (109.59,159.82)--(102.75,116.62);
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (153.73,150.61)--(163.38,129.3);
+draw (153.51,140.17)--(163.09,124.33);
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 0bp;
+fill (162.58,130.74)--(168.99,130.74)--(168.99,114.9)
+ --(162.58,114.9)--(162.58,130.74)--cycle;
+drawoptions (withcolor (0,0.4,1));
+fill (153.22,123.1)--(162.58,123.1)--(162.58,115.9)
+ --(153.22,115.9)--(153.22,123.1)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (101.89,117.92)--(149.05,117.42);
+pickup pencircle scaled 2.02bp;
+draw (103.98,113.46)--(150.56,113.67);
+pickup pencircle scaled 0bp;
+fill (102.25,109.71)--(146.82,109.71)--(146.82,107.77)
+ --(102.25,107.77)--(102.25,109.71)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (102.25,109.71)--(146.82,109.71)--(146.82,107.77)
+ --(102.25,107.77)--(102.25,109.71);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (90.4399,158.02)--(92.1699,158.02)--(92.1699,117.92)
+ --(90.4399,117.92)--(90.4399,158.02)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (90.4399,158.02)--(92.1699,158.02)--(92.1699,117.92)
+ --(90.4399,117.92)--(90.4399,158.02);
+drawoptions (withcolor (0,0,0));
+draw (161.86,94.8799)--(164.1,94.8799)--(164.1,92.22)
+ --(161.86,92.22)--(161.86,94.8799);
+drawoptions (withcolor (0.8,0.3,0));
+pickup pencircle scaled 0bp;
+fill (147.32,104.1)--(149.05,104.1)--(149.05,87.97)
+ --(147.32,87.97)--(147.32,104.1)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (147.32,104.1)--(149.05,104.1)--(149.05,87.97)
+ --(147.32,87.97)--(147.32,104.1);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (148.54,104.6)--(150.27,104.6)--(150.27,87.6799)
+ --(148.54,87.6799)--(148.54,104.6)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (148.54,104.6)--(150.27,104.6)--(150.27,87.6799)
+ --(148.54,87.6799)--(148.54,104.6);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (141.2,107.55)--(147.1,107.55)--(147.1,87.25)
+ --(141.2,87.25)--(141.2,107.55)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (141.2,107.55)--(147.1,107.55)--(147.1,87.25)
+ --(141.2,87.25)--(141.2,107.55);
+drawoptions (withcolor (0,0.75,1));
+pickup pencircle scaled 0bp;
+fill (141.49,88.1799)--(153.58,88.1799)--(161.22,81.99)
+ --(143.22,81.2)--(141.49,88.1799)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (141.49,88.1799)--(153.58,88.1799)--(161.22,81.99)
+ --(143.22,81.2)--(141.49,88.1799);
+drawoptions (withcolor (1,0.4,0));
+pickup pencircle scaled 0bp;
+fill (146.53,110.22)--(165.1,110.22)--(165.1,103.09)
+ --(162.8,103.09)--(152.94,87.97)--(147.32,87.97)
+ --(146.53,110.22)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (146.53,110.22)--(165.1,110.22)--(165.1,103.09)
+ --(162.8,103.09)--(152.94,87.97)--(147.32,87.97)
+ --(146.53,110.22);
+drawoptions (withcolor (1,0.5,0));
+pickup pencircle scaled 0bp;
+fill (285.92,78.3899)--(163.09,104.31)--(152.43,88.6899)
+ --(160.57,82.5)..controls (160.57,82.5) and (165.39,79.76)..(175.62,74.2898)
+ ..controls (185.84,68.8198) and (187.86,71.5498)..(192.61,67.45)
+ ..controls (197.36,63.3398) and (215.65,62.0498)..(215.65,62.0498)
+ --(285.63,30.6599)--(285.92,78.3899)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (285.92,78.3899)--(163.09,104.31)--(152.43,88.6899)
+ --(160.57,82.5)..controls (160.57,82.5) and (165.39,79.76)..(175.62,74.2898)
+ ..controls (185.84,68.8198) and (187.86,71.5498)..(192.61,67.45)
+ ..controls (197.36,63.3398) and (215.65,62.0498)..(215.65,62.0498)
+ --(285.63,30.6599)--(285.92,78.3899);
+drawoptions (withcolor (0.2,0.9,0.2));
+pickup pencircle scaled 0bp;
+fill (40.1799,214.47)..controls (47.6699,214.47) and (37.0198,202.59)..(40.3999,195.82)
+ ..controls (43.7798,188.98) and (41.0498,194.46)..(47.8899,187.62)
+ ..controls (54.6599,180.78) and (59.4099,178.76)..(59.4099,173.29)
+ ..controls (59.4099,167.82) and (59.4099,166.45)..(60.1299,159.61)
+ ..controls (60.7798,152.77) and (64.8098,145.93)..(65.5298,141.82)
+ ..controls (66.25,137.79) and (68.98,134.34)..(66.25,130.95)
+ ..controls (63.5098,127.57) and (62.7898,127.57)..(52.6399,127.57)
+ ..controls (42.49,127.57) and (42.49,130.3)..(33.6299,125.48)
+ ..controls (24.7798,120.73) and (25.5,116.62)..(18.6599,120.73)
+ ..controls (11.8899,124.76) and (1.65991,128.22)..(1.65991,128.22)
+ --(1.37988,214.47)--(40.1799,214.47)--cycle;
+drawoptions (withcolor (0,0.5,1));
+fill (122.41,51.8999)..controls (122.41,51.8999) and (121.76,52.47)..(120.25,49.3799)
+ ..controls (118.66,46.21) and (118.66,44.3398)..(115.86,39.9399)
+ ..controls (113.05,35.48) and (114.27,36.49)..(110.53,32.6699)
+ ..controls (106.71,28.9299) and (109.38,32.3799)..(104.34,28.9299)
+ ..controls (99.2998,25.47) and (94.2598,26.3398)..(89.7898,26.7)
+ ..controls (85.3999,26.98) and (76.6199,25.1799)..(72.8699,27.3398)
+ ..controls (69.1299,29.5798) and (67.8999,30.51)..(65.74,34.26)
+ ..controls (63.5798,38) and (63.5798,38)..(61.71,41.46)
+ ..controls (59.8398,44.9099) and (59.3398,48.5798)..(58.2598,50.3098)
+ --(54.8699,55.6399)--(122.41,51.8999)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 1.44bp;
+draw (122.41,51.8999)..controls (122.41,51.8999) and (121.76,52.47)..(120.25,49.3799)
+ ..controls (118.66,46.21) and (118.66,44.3398)..(115.86,39.9399)
+ ..controls (113.05,35.48) and (114.27,36.49)..(110.53,32.6699)
+ ..controls (106.71,28.9299) and (109.38,32.3799)..(104.34,28.9299)
+ ..controls (99.2998,25.47) and (94.2598,26.3398)..(89.7898,26.7)
+ ..controls (85.3999,26.98) and (76.6199,25.1799)..(72.8699,27.3398)
+ ..controls (69.1299,29.5798) and (67.8999,30.51)..(65.74,34.26)
+ ..controls (63.5798,38) and (63.5798,38)..(61.71,41.46)
+ ..controls (59.8399,44.9099) and (59.3398,48.5798)..(58.2598,50.3098)
+ --(54.8699,55.6399)--(122.41,51.8999);
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (202.04,156.87)--(200.53,112.81)--(234.87,107.26)
+ --(233.29,167.1)--(202.04,156.87);
+drawoptions (withcolor (1,0.25,0.25));
+pickup pencircle scaled 0bp;
+fill (246.9,189.63)--(223.06,177.32)--(202.76,160.26)
+ --(230.55,170.55)--(246.9,189.63)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (246.9,189.63)--(223.06,177.32)--(202.76,160.26)
+ --(230.55,170.55)--(246.9,189.63);
+drawoptions (withcolor (1,0.4,0.4));
+pickup pencircle scaled 0bp;
+fill (246.25,188.98)--(230.98,170.62)--(274.76,169.83)
+ --(246.25,188.98)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (246.25,188.98)--(230.98,170.62)--(274.76,169.83)
+ --(246.25,188.98);
+drawoptions (withcolor (0.3,1,0.3));
+pickup pencircle scaled 0bp;
+fill (255.75,122.1)..controls (252.3,122.1) and (253.02,121.45)..(248.26,125.48)
+ ..controls (243.51,129.58) and (242.79,126.2)..(239.41,135.06)
+ ..controls (236.02,143.91) and (234.01,141.18)..(234.66,148.66)
+ ..controls (235.3,156.22) and (230.62,155.5)..(236.02,163.06)
+ ..controls (241.42,170.55) and (240.13,166.45)..(245.53,174.66)
+ ..controls (251,182.79) and (250.28,185.53)..(255.03,186.9)
+ ..controls (259.78,188.26) and (258.49,194.38)..(264.61,186.9)
+ ..controls (270.66,179.41) and (271.3,174.58)..(276.06,173.94)
+ ..controls (280.88,173.29) and (282.25,175.95)..(282.25,167.82)
+ ..controls (282.25,159.61) and (282.9,154.86)..(277.5,149.38)
+ ..controls (272.02,143.91) and (267.27,145.28)..(266.55,137.07)
+ ..controls (265.9,128.86) and (266.55,124.83)..(263.17,124.11)
+ ..controls (259.78,123.39) and (255.75,122.1)..(255.75,122.1)
+ --cycle;
+drawoptions (withcolor (0.8,0.3,0));
+fill (270.66,52.47)--(276.78,52.47)--(276.78,0.629883)
+ --(270.66,0.629883)--(270.66,52.47)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (270.66,52.47)--(276.78,52.47)--(276.78,0.629898)
+ --(270.66,0.629898)--(270.66,52.47);
+drawoptions (withcolor (0.9,0,0));
+pickup pencircle scaled 0bp;
+fill (90.5798,158.02)--(92.0198,158.02)--(92.0198,152.84)
+ --(90.5798,152.84)--(90.5798,158.02)--cycle;
+fill (90.5798,147.66)--(92.0198,147.66)--(92.0198,142.47)
+ --(90.5798,142.47)--(90.5798,147.66)--cycle;
+fill (90.5798,137.43)--(92.0198,137.43)--(92.0198,132.25)
+ --(90.5798,132.25)--(90.5798,137.43)--cycle;
+fill (90.5798,128.14)--(92.0198,128.14)--(92.0198,122.96)
+ --(90.5798,122.96)--(90.5798,128.14)--cycle;
+drawoptions (withcolor (1,0.9,0));
+fill (203.34,160.98)--(200.53,160.98)--(199.38,155.29)
+ --(233.22,167.17)--(236.02,169.98)--(230.34,169.98)
+ --(203.34,160.98)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (203.34,160.98)--(200.53,160.98)--(199.38,155.29)
+ --(233.22,167.17)--(236.02,169.98)--(230.34,169.98)
+ --(203.34,160.98);
+drawoptions (withcolor (1,1,0.7));
+pickup pencircle scaled 0bp;
+fill (232.14,166.59)--(235.52,107.77)--(202.11,112.52)
+ --(202.83,155.65)--(232.14,166.59)--cycle;
+drawoptions (withcolor (0.8,0.8,0.8));
+pickup pencircle scaled 0.22bp;
+draw (232.14,166.59)--(235.52,107.77)--(202.11,112.52)
+ --(202.83,155.65)--(232.14,166.59);
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (214.42,156.3)--(214.42,145.35)--(217.81,146.07)
+ --(217.16,157.66)--(214.42,156.3);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 1.44bp;
+draw (219.9,133.04)--(219.75,109.86)--(230.77,108.42)
+ --(230.12,133.04)--(219.9,133.04);
+drawoptions (withcolor (0,0.8,0));
+pickup pencircle scaled 0bp;
+fill (212.34,118.64)..controls (217.16,122.1) and (219.82,117.34)..(221.19,126.2)
+ ..controls (222.56,135.13) and (224.65,137.86)..(221.91,141.25)
+ ..controls (219.18,144.7) and (213.06,146.07)..(213.06,146.07)
+ ..controls (213.06,146.07) and (213.7,152.26)..(208.3,149.46)
+ ..controls (202.83,146.72) and (196.06,153.42)..(196.06,145.93)
+ ..controls (196.06,138.37) and (200.1,135.13)..(203.55,131.67)
+ ..controls (206.94,128.29) and (206.22,127.57)..(207.58,124.18)
+ ..controls (208.95,120.73) and (212.34,118.64)..(212.34,118.64)
+ --cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (251.86,122.1)--(257.34,122.1)--(257.34,92.0698)
+ --(251.86,92.0698)--(251.86,122.1)--cycle;
+pickup pencircle scaled 0.86bp;
+draw (251.86,122.1)--(257.34,122.1)--(257.34,92.0698)
+ --(251.86,92.0698)--(251.86,122.1);
+drawoptions (withcolor (0.6,0.85,1));
+pickup pencircle scaled 0bp;
+fill (116.5,62.8398)..controls (116.5,62.8398) and (123.06,57.22)..(123.06,54.99)
+ ..controls (123.06,52.8298) and (122.98,51.25)..(118.66,49.95)
+ ..controls (114.27,48.73) and (104.62,47.7898)..(102.1,47.7898)
+ ..controls (99.5798,47.7898) and (93.3198,46.8599)..(91.45,46.8599)
+ ..controls (89.5798,46.8599) and (77.0498,46.21)..(74.5298,46.8599)
+ ..controls (72.0798,47.4299) and (65.8198,46.21)..(63.5798,47.7898)
+ ..controls (61.4199,49.3799) and (58.3298,49.95)..(56.74,52.47)
+ ..controls (55.1599,54.99) and (55.1599,55.3499)..(55.1599,58.1599)
+ ..controls (55.1599,60.97) and (59.8398,64.4199)..(59.8398,64.4199)
+ --(116.5,62.8398)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 1.44bp;
+draw (116.5,62.8398)..controls (116.5,62.8398) and (123.06,57.22)..(123.06,54.99)
+ ..controls (123.06,52.8298) and (122.98,51.25)..(118.66,49.95)
+ ..controls (114.27,48.73) and (104.62,47.7898)..(102.1,47.7898)
+ ..controls (99.5798,47.7898) and (93.3198,46.8599)..(91.45,46.8599)
+ ..controls (89.5798,46.8599) and (77.0498,46.21)..(74.5298,46.8599)
+ ..controls (72.0798,47.4299) and (65.8198,46.21)..(63.5798,47.7898)
+ ..controls (61.4199,49.3799) and (58.3298,49.95)..(56.74,52.47)
+ ..controls (55.1599,54.99) and (55.1599,55.3498)..(55.1599,58.1599)
+ ..controls (55.1599,60.97) and (59.8399,64.4199)..(59.8399,64.4199)
+ --(116.5,62.8398);
+drawoptions (withcolor (0.8,0.9,1));
+pickup pencircle scaled 0bp;
+fill (63.3699,81.4199)..controls (63.3699,81.4199) and (81.5098,83.5)..(87.8499,83.5)
+ ..controls (94.1799,83.5) and (111.82,82.1399)..(111.82,82.1399)
+ ..controls (111.82,82.1399) and (114.06,71.4099)..(114.06,70.0398)
+ ..controls (114.06,68.74) and (115.64,64.6399)..(115.64,64.6399)
+ --(116.29,54.6299)..controls (116.29,54.6299) and (98.5,52.5398)..(93.25,52.5398)
+ ..controls (87.99,52.5398) and (69.2698,50.5999)..(67.47,51.25)
+ ..controls (65.6699,51.8999) and (65.6699,59.8198)..(65.6699,59.8198)
+ --(63.3699,63.49)--(63.3699,81.4199)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (63.3699,81.4199)..controls (63.3699,81.4199) and (81.5098,83.5)..(87.8499,83.5)
+ ..controls (94.1799,83.5) and (111.82,82.1399)..(111.82,82.1399)
+ ..controls (111.82,82.1399) and (114.06,71.4099)..(114.06,70.0398)
+ ..controls (114.06,68.74) and (115.64,64.6399)..(115.64,64.6399)
+ --(116.29,54.6299)..controls (116.29,54.6299) and (98.5,52.5398)..(93.25,52.5398)
+ ..controls (87.99,52.5398) and (69.2698,50.5999)..(67.47,51.25)
+ ..controls (65.6699,51.8999) and (65.6699,59.8198)..(65.6699,59.8198)
+ --(63.3699,63.49)--(63.3699,81.4199);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (66.6799,78.25)..controls (68.9099,79.26) and (74.24,79.26)..(75.8198,79.26)
+ ..controls (77.3398,79.26) and (84.25,79.5398)..(84.25,79.5398)
+ --(85.1799,77.0198)--(85.1799,72.6299)--(83.5999,70.76)
+ ..controls (83.5999,70.76) and (80.22,70.76)..(77.0498,70.1099)
+ ..controls (73.8799,69.46) and (68.2598,68.5298)..(68.2598,68.5298)
+ ..controls (68.2598,68.5298) and (66.0999,69.46)..(66.0999,71.0498)
+ ..controls (66.0999,72.6299) and (66.6799,78.25)..(66.6799,78.25)
+ --cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (66.6799,78.25)..controls (68.9099,79.26) and (74.24,79.26)..(75.8198,79.26)
+ ..controls (77.3398,79.26) and (84.25,79.5398)..(84.25,79.5398)
+ --(85.1799,77.0198)--(85.1799,72.6299)--(83.5999,70.76)
+ ..controls (83.5999,70.76) and (80.22,70.76)..(77.0498,70.1099)
+ ..controls (73.8799,69.46) and (68.2598,68.5298)..(68.2598,68.5298)
+ ..controls (68.2598,68.5298) and (66.0999,69.46)..(66.0999,71.0498)
+ ..controls (66.0999,72.6299) and (66.6799,78.25)..(66.6799,78.25)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (93.0298,79.8298)--(105.85,79.5398)..controls (105.85,79.5398) and (108.37,79.26)..(108.66,77.3098)
+ ..controls (108.94,75.4399) and (109.3,72.9199)..(109.3,72.9199)
+ ..controls (109.3,72.9199) and (108.94,70.76)..(107.43,70.76)
+ ..controls (105.85,70.76) and (93.6099,70.3999)..(93.6099,70.3999)
+ ..controls (93.6099,70.3999) and (91.45,71.3398)..(91.45,72.9199)
+ ..controls (91.45,74.5) and (91.1599,77.3098)..(91.1599,77.3098)
+ --(93.0298,79.8298)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (93.0298,79.8298)--(105.85,79.5398)..controls (105.85,79.5398) and (108.37,79.26)..(108.66,77.3098)
+ ..controls (108.94,75.4399) and (109.3,72.9199)..(109.3,72.9199)
+ ..controls (109.3,72.9199) and (108.94,70.76)..(107.43,70.76)
+ ..controls (105.85,70.76) and (93.6098,70.3999)..(93.6098,70.3999)
+ ..controls (93.6098,70.3999) and (91.45,71.3399)..(91.45,72.9199)
+ ..controls (91.45,74.5) and (91.1599,77.3098)..(91.1599,77.3098)
+ --(93.0298,79.8298);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (95.48,61.3298)..controls (98.6499,61.3298) and (108.01,61.3298)..(108.01,61.3298)
+ --(110.82,58.8098)--(110.82,56.2898)..controls (108.01,55.3499) and (96.4199,54.99)..(96.4199,54.99)
+ ..controls (96.4199,54.99) and (93.3198,54.7)..(93.3198,56.2898)
+ ..controls (93.3198,57.8699) and (93.0298,59.3799)..(93.0298,59.3799)
+ --(95.48,61.3298)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (95.48,61.3298)..controls (98.6499,61.3298) and (108.01,61.3298)..(108.01,61.3298)
+ --(110.82,58.8098)--(110.82,56.2898)..controls (108.01,55.3499) and (96.4199,54.99)..(96.4199,54.99)
+ ..controls (96.4199,54.99) and (93.3198,54.7)..(93.3198,56.2898)
+ ..controls (93.3198,57.8699) and (93.0298,59.3799)..(93.0298,59.3799)
+ --(95.48,61.3298);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (84.5398,60.0298)--(88.2798,58.8098)--(88.2798,55.6399)
+ ..controls (88.2798,55.6399) and (88.3499,54.7)..(86.1199,54.7)
+ ..controls (83.96,54.7) and (71.72,53.1199)..(71.72,53.1199)
+ --(69.2,54.7)--(69.2,57.51)--(71.4299,59.74)
+ --(84.5398,60.0298)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (84.5398,60.0298)--(88.2798,58.8098)--(88.2798,55.6399)
+ ..controls (88.2798,55.6399) and (88.3499,54.7)..(86.1199,54.7)
+ ..controls (83.96,54.7) and (71.72,53.1199)..(71.72,53.1199)
+ --(69.2,54.7)--(69.2,57.51)--(71.4299,59.74)
+ --(84.5398,60.0298);
+drawoptions (withcolor (0,0.7,1));
+pickup pencircle scaled 2.23bp;
+draw (65.3799,59.8198)..controls (70.6399,63.0598) and (81.22,66.6599)..(88.2798,66.4399)
+ ..controls (95.2598,66.22) and (111.97,65.2898)..(115.64,61.47);
+drawoptions (withcolor (0.4,0.8,1));
+pickup pencircle scaled 0bp;
+fill (111.82,82.1399)--(105.92,86.46)..controls (105.92,86.46) and (95.98,87.3899)..(93.8999,87.3899)
+ ..controls (91.8799,87.3899) and (81.9399,87.3899)..(81.9399,87.3899)
+ --(74.24,87.3899)--(68.3398,84.8699)--(63.5798,81.9199)
+ --(64.95,81.2)..controls (64.95,81.2) and (79.4199,83.5)..(87.3398,83.2898)
+ ..controls (95.2598,83.0698) and (111.61,82.1399)..(111.82,82.1399)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 1.44bp;
+draw (111.82,82.1399)--(105.92,86.46)..controls (105.92,86.46) and (95.98,87.3899)..(93.8999,87.3899)
+ ..controls (91.8799,87.3899) and (81.9399,87.3899)..(81.9399,87.3899)
+ --(74.24,87.3899)--(68.3398,84.8699)--(63.5798,81.9199)
+ --(64.95,81.2)..controls (64.95,81.2) and (79.4199,83.5)..(87.3398,83.2898)
+ ..controls (95.2598,83.0698) and (111.61,82.1399)..(111.82,82.1399)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 2.81bp;
+draw (113.84,72.8498)..controls (114.92,72.8498) and (116.29,72.8498)..(118.16,71.7)
+ ..controls (119.96,70.5398) and (119.53,70.5398)..(121.11,68.96)
+ ..controls (122.62,67.3799) and (121.98,66.22)..(121.98,66.22)
+ ..controls (121.98,66.22) and (120.82,65.5798)..(119.02,65.5798)
+ ..controls (117.22,65.5798) and (111.82,65.0698)..(109.74,65.0698)
+ ..controls (107.72,65.0698) and (103.4,65.0698)..(99.7998,65.0698)
+ ..controls (96.2,65.0698) and (90.9399,64.8599)..(88.2798,64.8599)
+ ..controls (85.5398,64.8599) and (79.4199,64.1399)..(76.47,63.9199)
+ ..controls (73.5198,63.7) and (69.49,63.7)..(66.0999,63.7)
+ ..controls (62.72,63.7) and (63.7998,62.7698)..(61.3499,64.1399)
+ ..controls (58.8298,65.5798) and (57.97,64.2099)..(57.97,66.6599)
+ ..controls (57.97,69.1799) and (56.8198,69.46)..(59.3398,71.7)
+ ..controls (61.7798,73.9299) and (61.3499,73.0598)..(63.1499,73.0598);
+pickup pencircle scaled 2.23bp;
+draw (57.97,67.0899)--(57.97,59.1699);
+draw (62.9399,62.7698)--(62.9399,51.25);
+draw (90.2998,64.8598)--(91.45,48.9399);
+draw (121.26,66.01)--(120.61,54.6299);
+draw (60.9199,72.8499)--(62,66.01);
+draw (114.7,72.5598)--(114.7,67.3799);
+pickup pencircle scaled 2.81bp;
+draw (84.6099,87.0999)--(84.8999,94.3799);
+draw (96.8498,86.46)--(96.8498,90.7798);
+drawoptions (withcolor (1,0.9,0));
+pickup pencircle scaled 0bp;
+fill (96.6299,96.25)..controls (98,96.25) and (99.1499,95.1699)..(99.1499,93.73)
+ ..controls (99.1499,92.2898) and (98,91.21)..(96.6299,91.21)
+ ..controls (95.2598,91.21) and (94.1099,92.2898)..(94.1099,93.73)
+ ..controls (94.1099,95.1699) and (95.2598,96.25)..(96.6299,96.25)
+ --cycle;
+drawoptions (withcolor (0.9,0,0));
+pickup pencircle scaled 2.23bp;
+draw (96.6299,96.25)..controls (98,96.25) and (99.1499,95.1699)..(99.1499,93.73)
+ ..controls (99.1499,92.2898) and (98,91.21)..(96.6299,91.21)
+ ..controls (95.2598,91.21) and (94.1099,92.2898)..(94.1099,93.73)
+ ..controls (94.1099,95.1699) and (95.2598,96.25)..(96.6299,96.25)
+ --cycle;
+drawoptions (withcolor (1,0.4,0));
+pickup pencircle scaled 0bp;
+fill (277.14,29.4299)--(285.99,29.4299)--(285.99,0.699951)
+ --(277.14,0.699951)--(277.14,29.4299)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (277.14,29.4299)--(285.99,29.4299)--(285.99,0.699936)
+ --(277.14,0.699936)--(277.14,29.4299);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (271.16,51.75)--(276.49,52.6199)--(276.7,49.95)
+ --(271.16,48.9399)--(271.16,51.75)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (271.16,51.75)--(276.49,52.6199)--(276.7,49.95)
+ --(271.16,48.9399)--(271.16,51.75);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (285.56,29.3599)--(285.27,32.5298)--(276.85,32.5298)
+ --(277.64,29.3599)--(285.56,29.3599)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (285.56,29.3599)--(285.27,32.5298)--(276.85,32.5298)
+ --(277.64,29.3599)--(285.56,29.3599);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (165.82,104.53)--(172.95,104.53)--(172.95,102.08)
+ --(165.82,102.08)--(165.82,104.53)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (165.82,104.53)--(172.95,104.53)--(172.95,102.08)
+ --(165.82,102.08)--(165.82,104.53);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (162.37,92.22)..controls (162.58,92.22) and (162.87,92.22)..(163.16,92.22)
+ ..controls (163.52,92.22) and (163.81,92.22)..(164.1,92.22)
+ ..controls (164.02,89.7698) and (164.02,87.3198)..(164.02,84.8699)
+ ..controls (164.02,82.3499) and (164.02,79.8999)..(164.1,77.3799)
+ ..controls (163.81,77.5298) and (163.52,77.6699)..(163.16,77.74)
+ ..controls (162.94,77.8198) and (162.58,78.0298)..(162.37,78.0298)
+ ..controls (162.3,80.4099) and (162.3,82.7798)..(162.3,85.1599)
+ ..controls (162.3,87.46) and (162.37,89.9099)..(162.37,92.22)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (162.37,92.22)..controls (162.58,92.22) and (162.87,92.22)..(163.16,92.22)
+ ..controls (163.52,92.22) and (163.81,92.22)..(164.1,92.22)
+ ..controls (164.02,89.7698) and (164.02,87.3198)..(164.02,84.8699)
+ ..controls (164.02,82.3499) and (164.02,79.8999)..(164.1,77.3799)
+ ..controls (163.81,77.5298) and (163.52,77.6699)..(163.16,77.74)
+ ..controls (162.94,77.8198) and (162.58,78.0298)..(162.37,78.0298)
+ ..controls (162.3,80.4099) and (162.3,82.7798)..(162.3,85.1599)
+ ..controls (162.3,87.46) and (162.37,89.9099)..(162.37,92.22)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (161.94,92.6499)--(164.31,92.6499)--(164.31,93.6599)
+ --(161.94,93.6599)--(161.94,92.6499)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (161.94,92.6499)--(164.31,92.6499)--(164.31,93.6599)
+ --(161.94,93.6599)--(161.94,92.6499);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (147.25,105.9)--(150.34,105.9)--(150.34,104.53)
+ --(147.25,104.53)--(147.25,105.9)--cycle;
+drawoptions (withcolor (0.1,0.1,0.1));
+pickup pencircle scaled 0.86bp;
+draw (147.25,105.9)--(150.34,105.9)--(150.34,104.53)
+ --(147.25,104.53)--(147.25,105.9);
+drawoptions (withcolor (0,0.7,1));
+pickup pencircle scaled 0bp;
+fill (105.85,90.6299)..controls (110.82,92.5) and (110.82,92)..(113.98,92.9399)
+ ..controls (117.08,93.7998) and (117.58,92.5)..(120.25,92.5)
+ ..controls (122.91,92.5) and (128.67,92)..(130.62,92)
+ --(135.58,92)--(141.85,93.3699)--(143.22,82.5)
+ --(154.45,82.5)--(159.78,79.3298)..controls (159.78,79.3298) and (159.34,72.1299)..(155.74,72.1299)
+ ..controls (152.22,72.1299) and (147.61,69.3899)..(144.08,72.1299)
+ ..controls (140.55,74.7898) and (136.88,75.22)..(134.22,74.7898)
+ ..controls (131.55,74.3599) and (126.94,73.9299)..(123.42,73.9299)
+ ..controls (119.82,73.9299) and (113.05,73.9299)..(113.05,73.9299)
+ --(111.25,82.9299)--(105.85,87.46)--(105.85,90.6299)
+ --cycle;
+drawoptions (withcolor (0,0.4,1));
+fill (109.88,100.93)..controls (116.22,103.45) and (119.82,103.23)..(123.85,103.66)
+ ..controls (127.95,104.1) and (132.49,104.89)..(133.35,104.6)
+ --(138.75,102.8)--(136.02,99.6299)..controls (136.02,99.6299) and (138.25,93.2998)..(136.02,95.0999)
+ ..controls (133.78,96.8999) and (130.18,96.8999)..(127.02,97.3298)
+ ..controls (123.85,97.76) and (118.45,95.5298)..(121.18,95.5298)
+ ..controls (123.85,95.5298) and (131.98,95.5298)..(134.65,94.23)
+ --(139.18,91.9299)..controls (139.18,91.9299) and (112.18,91.9299)..(108.51,91.9299)
+ ..controls (104.91,91.9299) and (104.55,96.0298)..(106.78,96.0298)
+ ..controls (109.02,96.0298) and (115.78,98.7)..(115.78,98.7)
+ --(107.65,100.06)--(109.88,100.93)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (45.9399,128.07)..controls (45.9399,128.07) and (45.0798,122.6)..(45.9399,118.57)
+ ..controls (46.8799,114.54) and (45.9399,113.17)..(47.3098,110.43)
+ ..controls (48.6799,107.77) and (50.48,104.17)..(50.48,104.17)
+ --(54.9399,101.5)--(52.71,99.6299)--(47.74,99.6299)
+ --(43.21,103.3)--(41.9099,114.03)--(41.4099,123.1)
+ --(40.98,127.64)--(45.9399,128.07)--cycle;
+fill (45.0798,95.1699)..controls (45.0798,95.1699) and (42.2698,98.7)..(41.4099,101.94)
+ ..controls (40.5398,105.1) and (38.74,111.37)..(38.74,114.97)
+ ..controls (38.74,118.57) and (38.74,128.07)..(38.74,128.07)
+ --(31.5398,124.04)..controls (31.5398,124.04) and (31.0398,119.5)..(31.5398,116.34)
+ ..controls (31.98,113.17) and (32.8398,108.2)..(33.3398,105.1)
+ ..controls (33.7798,101.94) and (34.21,100.57)..(34.21,97.8298)
+ ..controls (34.21,95.1699) and (39.6799,94.23)..(39.6799,94.23)
+ --(45.0798,95.1699)--cycle;
+fill (27.9399,87.46)..controls (27.9399,87.46) and (27.5098,96.46)..(27.5098,99.2)
+ ..controls (27.5098,101.94) and (27.5098,113.17)..(27.5098,113.17)
+ --(27.0798,120.37)--(22.98,119.07)--(15.3398,123.61)
+ ..controls (15.3398,123.61) and (15.3398,113.6)..(15.3398,110.94)
+ ..controls (15.3398,108.2) and (15.7798,101.5)..(15.3398,96.97)
+ ..controls (14.9099,92.4299) and (15.7798,92)..(14.9099,88.8298)
+ ..controls (13.98,85.6599) and (21.1799,86.5298)..(21.1799,86.5298)
+ --(26.1399,85.23)--(27.9399,87.46)--cycle;
+fill (1.37988,78.3899)--(15.3398,77.5298)..controls (15.3398,77.5298) and (14.8398,80.7)..(13.5398,83.3599)
+ ..controls (12.1799,86.0999) and (7.63989,86.96)..(6.77979,92.8599)
+ ..controls (5.83984,98.7698) and (4.53979,102.8)..(4.53979,107.77)
+ ..controls (4.53979,112.74) and (4.10986,127.21)..(4.10986,127.21)
+ --(1.37988,127.64)--(1.37988,78.3899)--cycle;
+drawoptions (withcolor (0,0.75,1));
+fill (220.62,63.9199)--(217.45,58.5198)--(223.78,51.6799)
+ ..controls (223.78,51.6799) and (230.98,47.22)..(234.15,46.2798)
+ ..controls (237.32,45.3398) and (244.52,43.5398)..(244.52,43.5398)
+ --(257.12,43.5398)--(261.66,44.0498)--(267.42,42.6799)
+ --(266.55,36.3398)--(259.78,32.74)..controls (259.78,32.74) and (254.46,30.9399)..(248.98,32.74)
+ ..controls (243.58,34.5398) and (240.92,34.1099)..(236.38,34.98)
+ ..controls (231.85,35.9099) and (222.42,37.71)..(221.98,40.45)
+ ..controls (221.55,43.1099) and (219.32,49.0198)..(219.32,49.0198)
+ --(217.45,54.4199)--(218.38,62.5498)--(220.62,63.9199)
+ --cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (219.75,63.9199)--(235.02,63.9199)..controls (235.02,63.9199) and (238.18,63.9199)..(243.15,62.1199)
+ ..controls (248.12,60.3198) and (257.12,56.22)..(257.12,56.22)
+ --(262.09,51.25)--(266.98,48.5798)--(266.98,42.6799)
+ --(260.72,44.0498)--(246.32,41.74)--(231.42,46.7798)
+ --(222.42,52.1799)--(218.82,57.1499)--(219.75,63.9199)
+ --cycle;
+drawoptions (withcolor (1,0.9,0));
+fill (223.78,55.7798)--(227.38,60.75)--(231.42,61.6899)
+ ..controls (231.42,61.6899) and (235.88,61.6899)..(238.62,61.26)
+ ..controls (241.35,60.75) and (245.38,59.3799)..(248.12,57.5798)
+ ..controls (250.78,55.7798) and (256.18,52.6199)..(256.18,52.6199)
+ --(254.89,48.5798)--(249.42,46.2798)--(243.58,48.0798)
+ --(237.75,53.0498)--(233.65,54.9199)--(223.78,55.7798)
+ --cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+fill (221.34,54.4199)--(224.65,50.3799)..controls (224.65,50.3799) and (229.62,47.6499)..(232.35,46.7798)
+ ..controls (235.02,45.8499) and (240.56,44.6199)..(240.92,44.48)
+ --(246.75,42.25)--(251.29,48.0798)--(243.58,51.25)
+ --(236.02,54.4199)--(229.18,56.22)--(221.34,54.4199)
+ --cycle;
+drawoptions (withcolor (0.8,0.8,0.8));
+fill (219.32,63.0598)--(219.32,58.0198)--(224.22,51.25)
+ ..controls (224.22,51.25) and (231.92,47.22)..(235.02,45.8499)
+ ..controls (238.18,44.48) and (243.15,43.1099)..(245.89,43.1099)
+ ..controls (248.55,43.1099) and (253.09,43.1099)..(255.75,43.1099)
+ ..controls (258.42,43.1099) and (262.02,44.0498)..(264.32,43.1099)
+ ..controls (266.55,42.25) and (267.42,40.45)..(267.42,40.45)
+ --(262.09,38.6499)..controls (262.09,38.6499) and (255.75,38.6499)..(251.65,38.6499)
+ ..controls (247.62,38.6499) and (240.92,39.51)..(237.32,40.45)
+ ..controls (233.65,41.3098) and (226.88,43.98)..(223.78,47.22)
+ ..controls (220.62,50.3799) and (218.38,53.98)..(218.38,53.98)
+ --(219.32,63.0598)--cycle;
+drawoptions (withcolor (0.6,0.3,0));
+fill (271.45,52.8999)--(271.23,1.41992)--(266.34,1.41992)
+ --(266.41,54.2)..controls (266.41,54.2) and (272.17,53.1899)..(271.45,52.8999)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (271.45,52.8999)--(271.23,1.41992)--(266.34,1.41992)
+ --(266.41,54.2)..controls (266.41,54.2) and (272.17,53.1899)..(271.45,52.8999)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (271.16,51.75)--(266.26,54.1299)--(266.26,50.8899)
+ --(271.16,48.9399)--(271.16,51.75)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (271.16,51.75)--(266.26,54.1299)--(266.26,50.8899)
+ --(271.16,48.9399)--(271.16,51.75);
+drawoptions (withcolor (0.6,0.85,1));
+pickup pencircle scaled 0bp;
+fill (121.98,48.0798)..controls (129.82,48.51) and (138.9,48.51)..(143.36,48.51)
+ ..controls (147.75,48.51) and (157.69,51.6799)..(163.52,49.0198)
+ ..controls (169.42,46.2798) and (168.99,44.0498)..(174.82,43.5398)
+ ..controls (180.66,43.1099) and (189.66,39.51)..(189.66,39.51)
+ ..controls (189.66,39.51) and (190.52,35.8398)..(193.26,34.0398)
+ ..controls (195.99,32.24) and (185.62,29.5)..(185.62,29.5)
+ --(173.89,35.8398)..controls (173.89,35.8398) and (156.32,40.8799)..(152.72,40.8799)
+ ..controls (149.12,40.8799) and (134.79,39.9399)..(134.79,39.9399)
+ ..controls (134.79,39.9399) and (130.69,34.47)..(140.19,34.0398)
+ ..controls (149.55,33.6099) and (157.69,30.9399)..(157.69,30.9399)
+ ..controls (157.69,30.9399) and (156.32,25.47)..(152.72,25.47)
+ ..controls (149.12,25.47) and (129.82,26.4099)..(125.36,26.4099)
+ ..controls (120.82,26.4099) and (103.62,28.21)..(108.51,30.9399)
+ ..controls (113.48,33.6099) and (116.79,41.3098)..(116.79,41.3098)
+ ..controls (116.79,41.3098) and (118.59,46.71)..(121.98,48.0798)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+fill (266.12,54.1299)--(271.3,51.46)--(276.7,52.6199)
+ --(273.68,54.99)--(266.12,54.1299)--cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (266.12,54.1299)--(271.3,51.46)--(276.7,52.6199)
+ --(273.68,54.99)--(266.12,54.1299);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (189.73,159.75)--(185.05,155.07)--(176.19,155.07)
+ --(181.09,159.75)--(189.73,159.75)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (189.73,159.75)--(185.05,155.07)--(176.19,155.07)
+ --(181.09,159.75)--(189.73,159.75);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (191.24,121.45)..controls (191.24,118.71) and (191.24,115.54)..(191.24,113.89)
+ ..controls (191.24,112.16) and (191.6,109.35)..(191.24,107.91)
+ ..controls (190.81,106.54) and (190.38,105.46)..(190.38,105.46)
+ --(190.59,103.16)--(193.98,104.02)--(194.41,106.54)
+ ..controls (194.41,106.54) and (194.41,111.94)..(194.41,113.02)
+ ..controls (194.41,114.03) and (195.06,123.54)..(195.06,123.54)
+ --(191.24,121.45)--cycle;
+pickup pencircle scaled 0.86bp;
+draw (191.24,121.45)..controls (191.24,118.71) and (191.24,115.54)..(191.24,113.89)
+ ..controls (191.24,112.16) and (191.6,109.35)..(191.24,107.91)
+ ..controls (190.81,106.54) and (190.38,105.46)..(190.38,105.46)
+ --(190.59,103.16)--(193.98,104.02)--(194.41,106.54)
+ ..controls (194.41,106.54) and (194.41,111.94)..(194.41,113.02)
+ ..controls (194.41,114.03) and (195.06,123.54)..(195.06,123.54)
+ --(191.24,121.45);
+pickup pencircle scaled 0bp;
+fill (216.58,98.5498)..controls (216.58,100.21) and (216.15,99.3398)..(216.01,102.73)
+ ..controls (215.79,106.11) and (215.14,107.12)..(215.14,110.22)
+ ..controls (215.14,113.46) and (215.14,116.98)..(215.14,118.06)
+ ..controls (215.14,119.14) and (215.14,120.37)..(215.14,120.37)
+ --(212.19,119.36)..controls (212.19,119.36) and (212.19,118.71)..(212.19,116.98)
+ ..controls (212.19,115.33) and (212.19,113.17)..(212.19,111.3)
+ ..controls (212.19,109.42) and (212.19,109.5)..(212.19,106.98)
+ ..controls (212.19,104.46) and (212.05,101.94)..(212.05,101.94)
+ --(211.4,99.3398)--(213.27,98.7)--(216.58,98.5498)
+ --cycle;
+pickup pencircle scaled 0.86bp;
+draw (216.58,98.5498)..controls (216.58,100.21) and (216.15,99.3399)..(216.01,102.73)
+ ..controls (215.79,106.11) and (215.14,107.12)..(215.14,110.22)
+ ..controls (215.14,113.46) and (215.14,116.98)..(215.14,118.06)
+ ..controls (215.14,119.14) and (215.14,120.37)..(215.14,120.37)
+ --(212.19,119.36)..controls (212.19,119.36) and (212.19,118.71)..(212.19,116.98)
+ ..controls (212.19,115.33) and (212.19,113.17)..(212.19,111.3)
+ ..controls (212.19,109.42) and (212.19,109.5)..(212.19,106.98)
+ ..controls (212.19,104.46) and (212.05,101.94)..(212.05,101.94)
+ --(211.4,99.3399)--(213.27,98.6999)--(216.58,98.5498);
+pickup pencircle scaled 0bp;
+fill (184.54,108.78)--(184.54,114.46)--(183.46,116.19)
+ --(182.67,114.46)..controls (182.67,114.46) and (182.82,113.24)..(182.82,112.16)
+ ..controls (182.82,111.08) and (182.82,109.64)..(182.82,109.64)
+ --(184.54,108.78)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (184.54,108.78)--(184.54,114.46)--(183.46,116.19)
+ --(182.67,114.46)..controls (182.67,114.46) and (182.82,113.24)..(182.82,112.16)
+ ..controls (182.82,111.08) and (182.82,109.64)..(182.82,109.64)
+ --(184.54,108.78);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (178.28,117.85)..controls (178.28,117.85) and (178.42,115.76)..(178.42,114.68)
+ ..controls (178.42,113.6) and (178.42,111.3)..(178.42,111.3)
+ --(176.98,109.64)--(176.98,113.46)--(176.98,116.55)
+ --(178.28,117.85)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (178.28,117.85)..controls (178.28,117.85) and (178.42,115.76)..(178.42,114.68)
+ ..controls (178.42,113.6) and (178.42,111.3)..(178.42,111.3)
+ --(176.98,109.64)--(176.98,113.46)--(176.98,116.55)
+ --(178.28,117.85);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (180.51,109.21)..controls (180.51,109.21) and (180.3,109.5)..(180.51,112.16)
+ ..controls (180.73,114.9) and (180.73,117.85)..(180.73,117.85)
+ --(179.5,118.06)..controls (179.5,118.06) and (179.5,115.9)..(179.5,114.9)
+ ..controls (179.5,113.89) and (179.29,110.86)..(179.29,110.86)
+ --(179.5,108.99)--(180.51,109.21)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (180.51,109.21)..controls (180.51,109.21) and (180.3,109.5)..(180.51,112.16)
+ ..controls (180.73,114.9) and (180.73,117.85)..(180.73,117.85)
+ --(179.5,118.06)..controls (179.5,118.06) and (179.5,115.9)..(179.5,114.9)
+ ..controls (179.5,113.89) and (179.29,110.86)..(179.29,110.86)
+ --(179.5,108.99)--(180.51,109.21);
+drawoptions (withcolor (0,0.5,0));
+pickup pencircle scaled 0bp;
+fill (192.46,150.97)..controls (185.55,150.54) and (182.6,151.98)..(182.38,148.88)
+ ..controls (182.24,145.71) and (184.54,150.97)..(185.34,145.28)
+ ..controls (186.2,139.59) and (186.85,138.51)..(186.85,136.21)
+ ..controls (186.85,133.9) and (188.86,133.9)..(189.3,136.42)
+ ..controls (189.73,138.94) and (190.02,140.89)..(192.1,142.11)
+ ..controls (194.19,143.41) and (195.06,146.94)..(191.46,146.5)
+ ..controls (187.86,146.14) and (190.59,149.89)..(190.59,149.89)
+ --(192.46,150.97)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (221.77,159.61)--(227.17,163.06)--(226.52,146.65)
+ --(222.42,145.93)--(221.77,159.61);
+draw (207.8,155.43)--(205.28,153.92)--(205.28,149.1);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 1.44bp;
+draw (204.63,125.48)--(204.63,118.28)--(209.24,117.63);
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (224,160.9)--(224.14,148.88);
+draw (222.06,154.78)--(226.88,157.09);
+draw (216.01,151.62)--(215.79,145.71);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 1.44bp;
+draw (223.5,130.52)--(227.96,130.52)--(228.18,124.4);
+draw (222.7,118.28)--(222.7,115.76)--(228.39,115.11);
+draw (222.27,123.32)--(227.53,123.18);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (240.42,126.27)--(236.82,126.7)--(236.82,113.17)
+ --(241.35,113.17)--(240.42,126.27)--cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (240.42,126.27)--(236.82,126.7)--(236.82,113.17)
+ --(241.35,113.17)--(240.42,126.27);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (246.75,126.7)--(242.65,126.7)--(243.58,112.23)
+ --(248.12,111.8)--(248.55,119.07)--(246.75,126.7)
+ --cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (246.75,126.7)--(242.65,126.7)--(243.58,112.23)
+ --(248.12,111.8)--(248.55,119.07)--(246.75,126.7);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (258.7,119.79)--(258.7,111.66)--(262.74,111.66)
+ --(263.24,123.82)--(258.27,122.96)--(258.7,119.79)
+ --cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (258.7,119.79)--(258.7,111.66)--(262.74,111.66)
+ --(263.24,123.82)--(258.27,122.96)--(258.7,119.79);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (269.36,126.49)--(264.82,126.49)--(265.33,110.22)
+ --(270.73,110.22)--(269.36,126.49)--cycle;
+drawoptions (withcolor (0.5,0.5,0.5));
+pickup pencircle scaled 0.22bp;
+draw (269.36,126.49)--(264.82,126.49)--(265.33,110.22)
+ --(270.73,110.22)--(269.36,126.49);
+drawoptions (withcolor (1,0.8,0.8));
+pickup pencircle scaled 0bp;
+fill (273.32,101.5)--(285.92,98.26)--(285.92,156.58)
+ --(273.32,145.28)--(273.32,101.5)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (273.32,101.5)--(285.92,98.26)--(285.92,156.58)
+ --(273.32,145.28)--(273.32,101.5);
+drawoptions (withcolor (0.95,0.95,0.95));
+pickup pencircle scaled 0bp;
+fill (277.86,125.41)--(276.92,109.57)--(285.92,107.77)
+ --(285.49,123.61)--(277.86,125.41)--cycle;
+drawoptions (withcolor (0.6,0.6,0.6));
+pickup pencircle scaled 1.44bp;
+draw (277.86,125.41)--(276.92,109.57)--(285.92,107.77)
+ --(285.49,123.61)--(277.86,125.41);
+drawoptions (withcolor (0.9,0.9,0.9));
+pickup pencircle scaled 0bp;
+fill (278.29,125.84)--(285.49,123.61)--(285.92,131.24)
+ --(278.29,132.18)--(278.29,125.84)--cycle;
+drawoptions (withcolor (0.6,0.6,0.6));
+pickup pencircle scaled 1.44bp;
+draw (278.29,125.84)--(285.49,123.61)--(285.92,131.24)
+ --(278.29,132.18)--(278.29,125.84);
+pickup pencircle scaled 0.86bp;
+draw (237.32,121.3)--(240.42,121.3);
+drawoptions (withcolor (0.5,0.5,0.5));
+draw (243.15,121.3)--(248.12,120.87);
+draw (259.35,120.37)--(262.52,119.94);
+draw (265.69,121.3)--(269.22,120.87);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (166.04,101.86)..controls (167.12,101.94) and (168.2,101.94)..(169.35,101.94)
+ ..controls (170.43,101.94) and (171.51,101.94)..(172.74,101.86)
+ ..controls (172.66,97.5398) and (172.66,93.1499)..(172.66,88.76)
+ ..controls (172.66,84.3699) and (172.66,79.98)..(172.74,75.5798)
+ ..controls (171.51,76.0898) and (170.43,76.5898)..(169.35,77.0198)
+ ..controls (168.27,77.46) and (167.12,77.96)..(166.04,78.3198)
+ ..controls (166.04,82.2798) and (166.04,86.1699)..(166.04,90.1299)
+ ..controls (166.04,94.0198) and (166.04,97.98)..(166.04,101.86)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0.86bp;
+draw (166.04,101.86)..controls (167.12,101.94) and (168.2,101.94)..(169.35,101.94)
+ ..controls (170.43,101.94) and (171.51,101.94)..(172.74,101.86)
+ ..controls (172.66,97.5398) and (172.66,93.1499)..(172.66,88.76)
+ ..controls (172.66,84.3699) and (172.66,79.98)..(172.74,75.5798)
+ ..controls (171.51,76.0899) and (170.43,76.5898)..(169.35,77.0198)
+ ..controls (168.27,77.4599) and (167.12,77.9599)..(166.04,78.3198)
+ ..controls (166.04,82.2798) and (166.04,86.1699)..(166.04,90.1299)
+ ..controls (166.04,94.0198) and (166.04,97.98)..(166.04,101.86)
+ --cycle;
+drawoptions (withcolor (0,0.6,0));
+pickup pencircle scaled 0bp;
+fill (25.21,151.54)..controls (35.4299,157.66) and (33.3398,161.05)..(32.7,169.33)
+ ..controls (32.0498,177.54) and (29.3098,183.01)..(30.6799,189.13)
+ ..controls (32.0498,195.32) and (25.9299,187.04)..(23.8398,181.57)
+ ..controls (21.8198,176.17) and (13.6199,171.34)..(13.6199,171.34)
+ ..controls (13.6199,171.34) and (5.47998,167.89)..(8.85986,179.55)
+ ..controls (12.25,191.22) and (5.47998,189.78)..(5.47998,185.02)
+ ..controls (5.47998,180.27) and (3.38989,170.62)..(5.47998,164.5)
+ ..controls (7.5,158.38) and (12.3198,157.66)..(12.97,161.05)
+ ..controls (13.6199,164.5) and (17.0698,159.68)..(17.0698,152.19)
+ ..controls (17.0698,144.7) and (25.21,151.54)..(25.21,151.54)
+ --cycle;
+fill (38.8198,143.98)..controls (44.2898,150.18) and (44.2898,155)..(44.2898,159.75)
+ ..controls (44.2898,164.5) and (43.5698,178.18)..(46.2998,174.73)
+ ..controls (49.0398,171.34) and (53.7898,163.86)..(53.7898,158.38)
+ ..controls (53.7898,152.91) and (46.3799,148.09)..(51.1299,143.98)
+ ..controls (55.8799,139.88) and (59.2598,136.5)..(50.4099,136.5)
+ ..controls (41.5498,136.5) and (34.0598,134.41)..(34.0598,134.41)
+ --(38.8198,143.98)--cycle;
+drawoptions (withcolor (0,0.8,0));
+fill (254.6,137.86)..controls (254.6,145.42) and (251.14,148.16)..(254.6,155)
+ ..controls (257.98,161.84) and (261.44,170.7)..(261.44,170.7)
+ ..controls (261.44,170.7) and (262.74,170.7)..(262.74,165.94)
+ ..controls (262.74,161.12) and (268.93,156.3)..(268.93,156.3)
+ --(269.58,149.46)--(262.09,141.97)..controls (262.09,141.97) and (262.09,139.23)..(262.09,134.48)
+ ..controls (262.09,129.66) and (254.6,137.86)..(254.6,137.86)
+ --cycle;
+drawoptions (withcolor (0.95,0.95,0.95));
+fill (80.3599,197.34)..controls (117.8,197.34) and (98.0698,202.81)..(123.92,202.81)
+ ..controls (149.77,202.81) and (150.42,203.53)..(162.66,200.79)
+ ..controls (174.97,198.06) and (174.25,195.25)..(185.84,193.23)
+ ..controls (197.43,191.22) and (206.29,189.78)..(204.92,185.02)
+ ..controls (203.55,180.27) and (180.44,174.15)..(174.97,176.82)
+ ..controls (169.5,179.55) and (155.17,184.38)..(150.42,184.38)
+ ..controls (145.66,184.38) and (110.31,192.58)..(110.31,192.58)
+ ..controls (110.31,192.58) and (102.82,188.41)..(115.14,185.74)
+ ..controls (127.38,183.01) and (154.52,178.9)..(142.28,172.71)
+ ..controls (130.04,166.52) and (115.78,176.17)..(106.93,176.17)
+ ..controls (98.0698,176.17) and (85.1799,176.82)..(78.99,179.55)
+ ..controls (72.8699,182.29) and (61.2798,190.5)..(54.5098,193.95)
+ ..controls (47.6699,197.34) and (49.6899,205.54)..(59.2598,204.18)
+ ..controls (68.7698,202.81) and (80.3599,197.34)..(80.3599,197.34)
+ --cycle;
+drawoptions (withcolor (1,0.4,0));
+fill (14.3398,40.8098)..controls (21.8198,45.5598) and (32.7,53.0498)..(34.7798,56.5)
+ ..controls (36.7998,59.8899) and (37.45,49.6599)..(37.45,49.6599)
+ --(45.6599,57.1499)--(45.6599,47.6499)..controls (45.6599,47.6499) and (42.2,42.8198)..(39.5398,38)
+ ..controls (36.7998,33.25) and (22.47,18.2)..(22.47,18.2)
+ --(19.8098,25.0398)--(25.21,34.6199)--(23.8398,41.46)
+ --(12.25,35.26)--(14.3398,40.8098)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+fill (257.98,96.1799)--(278.43,94.8098)--(264.18,92.72)
+ --(255.25,92.72)--(257.98,96.1799)--cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+fill (215.14,102.37)..controls (215.14,102.37) and (217.16,100.28)..(220.54,100.28)
+ ..controls (224,100.28) and (230.77,99.5598)..(230.77,99.5598)
+ --(227.31,98.1899)--(215.79,97.5398)--(215.14,102.37)
+ --cycle;
+fill (193.98,104.38)--(204.92,104.38)--(203.55,100.93)
+ --(193.33,102.37)--(193.98,104.38)--cycle;
+drawoptions (withcolor (0,0.5,1));
+fill (266.12,11.8599)..controls (260.65,15.25) and (251.79,18.7)..(246.32,18.7)
+ ..controls (240.85,18.7) and (239.48,17.3398)..(230.62,17.3398)
+ ..controls (221.7,17.3398) and (212.91,15.97)..(206.07,17.3398)
+ ..controls (199.23,18.7) and (191.74,16.6199)..(186.92,16.6199)
+ ..controls (182.17,16.6199) and (183.54,11.1399)..(178.06,10.5)
+ ..controls (172.59,9.77979) and (171.94,5.66992)..(167.84,5.66992)
+ ..controls (163.74,5.66992) and (159.06,0.849854)..(168.49,0.849854)
+ ..controls (177.92,0.849854) and (266.12,0.699951)..(266.12,1.41992)
+ --(266.12,11.8599)--cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (1.01978,215.34)--(286.28,215.34)--(286.28,0.849854)
+ --(1.01978,0.849854)--(1.01978,215.34);
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (286.28,31.6599)--(280.81,35.8398)--(277.42,35.8398)
+ --(277.42,31.6599)--(286.28,31.6599)--cycle;
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 0.86bp;
+draw (286.28,31.6599)--(280.81,35.8398)--(277.42,35.8398)
+ --(277.42,31.6599)--(286.28,31.6599);
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 2.81bp;
+draw (69.2698,192.73)..controls (74.74,190.71) and (75.46,185.89)..(75.46,185.89)
+ --(81.5798,185.24);
+draw (62.1399,178.62)..controls (67.5398,176.6) and (69.7,176.89)..(69.7,176.89)
+ --(72.4399,180.27);
+draw (52.3499,196.11)..controls (57.8198,194.02) and (58.47,189.27)..(58.47,189.27)
+ --(61.21,192.66);
+drawoptions (withcolor (0,0,0));
+pickup pencircle scaled 2.23bp;
+draw (173.17,30.73)..controls (173.17,29.72) and (173.38,28.5)..(173.38,28.5)
+ --(175.18,29.0698);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (168.99,32.74)..controls (170.5,34.3999) and (171.51,33.1799)..(172.88,32.5298)
+ ..controls (174.25,31.8799) and (175.98,32.3098)..(175.11,31.23)
+ ..controls (174.32,30.22) and (168.56,29.3599)..(168.56,29.6499)
+ --(168.63,30.9399)--(168.13,31.6599)--(168.99,32.74)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (173.24,32.3098)..controls (173.24,33.3198) and (173.46,34.5398)..(173.46,34.5398)
+ --(175.33,33.97);
+drawoptions (withcolor (0,0,0));
+draw (184.33,24.3899)..controls (184.33,23.3799) and (184.54,22.1599)..(184.54,22.1599)
+ --(186.42,22.8098);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (180.22,26.4099)..controls (181.74,28.0598) and (182.67,26.8398)..(184.04,26.1899)
+ ..controls (185.41,25.5398) and (187.14,25.98)..(186.34,24.97)
+ ..controls (185.55,23.8899) and (179.72,23.0198)..(179.72,23.3098)
+ --(179.86,24.6099)--(179.29,25.3999)--(180.22,26.4099)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (184.47,25.98)..controls (184.47,26.98) and (184.69,28.21)..(184.69,28.21)
+ --(186.56,27.6299);
+drawoptions (withcolor (0,0,0));
+draw (195.7,34.8298)..controls (195.7,33.75) and (195.92,32.5298)..(195.92,32.5298)
+ --(197.79,33.1799);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (191.6,36.7798)..controls (193.04,38.5) and (194.05,37.2798)..(195.42,36.6299)
+ ..controls (196.78,35.9099) and (198.51,36.3398)..(197.72,35.3398)
+ ..controls (196.86,34.3298) and (191.1,33.46)..(191.1,33.6799)
+ --(191.24,35.0498)--(190.66,35.7698)--(191.6,36.7798)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (195.85,36.3398)..controls (195.85,37.4199) and (196.06,38.6499)..(196.06,38.6499)
+ --(197.94,38);
+drawoptions (withcolor (0,0,0));
+draw (198.44,26.26)..controls (198.44,25.1799) and (198.66,23.96)..(198.66,23.96)
+ --(200.53,24.6099);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (194.34,28.21)..controls (195.85,29.9399) and (196.78,28.71)..(198.15,28.0598)
+ ..controls (199.52,27.3398) and (201.25,27.7798)..(200.46,26.7698)
+ ..controls (199.66,25.76) and (193.83,24.8999)..(193.83,25.1099)
+ --(193.98,26.48)--(193.4,27.2)--(194.34,28.21)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (198.58,27.7798)..controls (198.58,28.8599) and (198.8,30.0798)..(198.8,30.0798)
+ --(200.67,29.4299);
+drawoptions (withcolor (0,0,0));
+draw (157.47,21.0798)..controls (157.47,20) and (157.76,18.7798)..(157.76,18.7798)
+ --(159.56,19.4199);
+drawoptions (withcolor (0.2,0.2,0.2));
+pickup pencircle scaled 0bp;
+fill (153.37,23.0198)..controls (154.88,24.75) and (155.82,23.5298)..(157.18,22.8799)
+ ..controls (158.62,22.1599) and (160.35,22.5898)..(159.49,21.5798)
+ ..controls (158.7,20.5798) and (152.86,19.71)..(152.86,19.9299)
+ --(153.01,21.2998)--(152.43,22.0198)--(153.37,23.0198)
+ --cycle;
+pickup pencircle scaled 2.23bp;
+draw (157.62,22.5899)..controls (157.62,23.6699) and (157.83,24.8999)..(157.83,24.8999)
+ --(159.7,24.25);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0.86bp;
+draw (114.85,113.6)--(114.85,109.71);
+draw (124.64,113.6)--(124.64,109.28);
+draw (135.01,113.46)--(135.01,109.93);
+draw (144.08,113.46)--(144.08,110.07);
+pickup pencircle scaled 0bp;
+fill (191.38,89.98)--(212.55,83.7898)--(212.55,78.3198)
+ --(219.39,72.1299)--(218.02,67.3799)--(204.34,74.22)
+ --(205.06,80.3398)--(192.1,85.8799)--(191.38,89.98)
+ --cycle;
+fill (275.98,73.5)--(263.02,76.95)--(258.27,71.48)
+ --(250.06,72.8499)--(248.7,67.3799)--(261.01,65.2898)
+ --(267.13,71.48)--(275.98,68.0999)--(275.98,73.5)
+ --cycle;
+drawoptions (withcolor (0.4,0.4,0.4));
+pickup pencircle scaled 0.86bp;
+draw (69.2698,75.5798)--(75.46,76.95);
+drawoptions (withcolor (0.3,0.3,0.3));
+draw (98.8599,77.6699)--(105.92,76.5198);
+drawoptions (withcolor (0.5,0.5,0.5));
+draw (72.9399,74.1399)--(76.3999,74.6499);
+drawoptions (withcolor (0.4,0.4,0.4));
+draw (101.17,75.4399)--(105.63,74.5);
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (15.0598,62.3398)--(16.5698,62.3398)..controls (17.0698,62.3398) and (17.4299,62.7)..(17.4299,63.2)
+ --(17.4299,67.8799)..controls (17.4299,68.3799) and (17.0698,68.74)..(16.5698,68.74)
+ --(15.0598,68.74)..controls (14.5498,68.74) and (14.1899,68.3799)..(14.1899,67.8799)
+ --(14.1899,63.2)..controls (14.1899,62.7) and (14.5498,62.3398)..(15.0598,62.3398)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (15.0598,62.3399)--(16.5698,62.3399)..controls (17.0698,62.3399) and (17.4299,62.7)..(17.4299,63.2)
+ --(17.4299,67.8799)..controls (17.4299,68.3799) and (17.0698,68.74)..(16.5698,68.74)
+ --(15.0598,68.74)..controls (14.5498,68.74) and (14.1899,68.3799)..(14.1899,67.8799)
+ --(14.1899,63.2)..controls (14.1899,62.7) and (14.5498,62.3399)..(15.0598,62.3399)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (13.3298,70.1099)--(18.0098,70.1099)..controls (18.5798,70.1099) and (19.0198,69.6799)..(19.0198,69.1799)
+ --(19.0198,67.95)..controls (19.0198,67.45) and (18.5798,67.0198)..(18.0098,67.0198)
+ --(13.3298,67.0198)..controls (12.75,67.0198) and (12.3198,67.45)..(12.3198,67.95)
+ --(12.3198,69.1799)..controls (12.3198,69.6799) and (12.75,70.1099)..(13.3298,70.1099)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 1.44bp;
+draw (13.3298,70.1098)--(18.0098,70.1098)..controls (18.5798,70.1098) and (19.0198,69.6799)..(19.0198,69.1799)
+ --(19.0198,67.9499)..controls (19.0198,67.45) and (18.5798,67.0198)..(18.0098,67.0198)
+ --(13.3298,67.0198)..controls (12.75,67.0198) and (12.3198,67.45)..(12.3198,67.9499)
+ --(12.3198,69.1799)..controls (12.3198,69.6799) and (12.75,70.1098)..(13.3298,70.1098)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (62.3599,49.45)--(63.22,49.45)..controls (63.5098,49.45) and (63.73,49.6599)..(63.73,49.95)
+ --(63.73,52.76)..controls (63.73,53.0498) and (63.5098,53.26)..(63.22,53.26)
+ --(62.3599,53.26)..controls (62,53.26) and (61.8599,53.0498)..(61.8599,52.76)
+ --(61.8599,49.95)..controls (61.8599,49.6599) and (62,49.45)..(62.3599,49.45)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 0.86bp;
+draw (62.3599,49.45)--(63.22,49.45)..controls (63.5098,49.45) and (63.73,49.6599)..(63.73,49.95)
+ --(63.73,52.76)..controls (63.73,53.0498) and (63.5098,53.26)..(63.22,53.26)
+ --(62.3599,53.26)..controls (62,53.26) and (61.8599,53.0498)..(61.8599,52.76)
+ --(61.8599,49.95)..controls (61.8599,49.6599) and (62,49.45)..(62.3599,49.45)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (61.3499,54.0598)--(64.0898,54.0598)..controls (64.3799,54.0598) and (64.6599,53.8398)..(64.6599,53.48)
+ --(64.6599,52.8298)..controls (64.6599,52.47) and (64.3799,52.1799)..(64.0898,52.1799)
+ --(61.3499,52.1799)..controls (60.99,52.1799) and (60.7,52.47)..(60.7,52.8298)
+ --(60.7,53.48)..controls (60.7,53.8398) and (60.99,54.0598)..(61.3499,54.0598)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 1.44bp;
+draw (61.3499,54.0598)--(64.0899,54.0598)..controls (64.3799,54.0598) and (64.6599,53.8398)..(64.6599,53.48)
+ --(64.6599,52.8298)..controls (64.6599,52.47) and (64.3799,52.1799)..(64.0899,52.1799)
+ --(61.3499,52.1799)..controls (60.99,52.1799) and (60.7,52.47)..(60.7,52.8298)
+ --(60.7,53.48)..controls (60.7,53.8398) and (60.99,54.0598)..(61.3499,54.0598)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (118.74,51.46)--(119.6,51.46)..controls (119.89,51.46) and (120.1,51.6099)..(120.1,51.97)
+ --(120.1,54.7)..controls (120.1,54.99) and (119.89,55.21)..(119.6,55.21)
+ --(118.74,55.21)..controls (118.38,55.21) and (118.23,54.99)..(118.23,54.7)
+ --(118.23,51.97)..controls (118.23,51.6099) and (118.38,51.46)..(118.74,51.46)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 0.86bp;
+draw (118.74,51.46)--(119.6,51.46)..controls (119.89,51.46) and (120.1,51.6098)..(120.1,51.97)
+ --(120.1,54.7)..controls (120.1,54.99) and (119.89,55.21)..(119.6,55.21)
+ --(118.74,55.21)..controls (118.38,55.21) and (118.23,54.99)..(118.23,54.7)
+ --(118.23,51.97)..controls (118.23,51.6098) and (118.38,51.46)..(118.74,51.46)
+ --cycle;
+drawoptions (withcolor (0.9,0.95,1));
+pickup pencircle scaled 0bp;
+fill (117.73,56)--(120.46,56)..controls (120.75,56) and (120.97,55.7798)..(120.97,55.4199)
+ --(120.97,54.7798)..controls (120.97,54.49) and (120.75,54.2)..(120.46,54.2)
+ --(117.73,54.2)..controls (117.37,54.2) and (117.08,54.49)..(117.08,54.7798)
+ --(117.08,55.4199)..controls (117.08,55.7798) and (117.37,56)..(117.73,56)
+ --cycle;
+drawoptions (withcolor (0,0.2,1));
+pickup pencircle scaled 1.44bp;
+draw (117.73,56)--(120.46,56)..controls (120.75,56) and (120.97,55.7798)..(120.97,55.4199)
+ --(120.97,54.7798)..controls (120.97,54.49) and (120.75,54.2)..(120.46,54.2)
+ --(117.73,54.2)..controls (117.37,54.2) and (117.08,54.49)..(117.08,54.7798)
+ --(117.08,55.4199)..controls (117.08,55.7798) and (117.37,56)..(117.73,56)
+ --cycle;
+drawoptions (withcolor (0.6,0.3,0));
+pickup pencircle scaled 0bp;
+fill (51.7,90.3398)--(52.7798,90.3398)..controls (53.1399,90.3398) and (53.3599,90.6299)..(53.3599,90.99)
+ --(53.3599,94.2998)..controls (53.3599,94.6599) and (53.1399,94.8799)..(52.7798,94.8799)
+ --(51.7,94.8799)..controls (51.3398,94.8799) and (51.1299,94.6599)..(51.1299,94.2998)
+ --(51.1299,90.99)..controls (51.1299,90.6299) and (51.3398,90.3398)..(51.7,90.3398)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 0.86bp;
+draw (51.7,90.3399)--(52.7798,90.3399)..controls (53.1399,90.3399) and (53.3599,90.6299)..(53.3599,90.99)
+ --(53.3599,94.2998)..controls (53.3599,94.6599) and (53.1399,94.8799)..(52.7798,94.8799)
+ --(51.7,94.8799)..controls (51.3398,94.8799) and (51.1299,94.6599)..(51.1299,94.2998)
+ --(51.1299,90.99)..controls (51.1299,90.6299) and (51.3398,90.3399)..(51.7,90.3399)
+ --cycle;
+drawoptions (withcolor (1,1,1));
+pickup pencircle scaled 0bp;
+fill (50.48,95.8899)--(53.7898,95.8899)..controls (54.22,95.8899) and (54.5098,95.5999)..(54.5098,95.24)
+ --(54.5098,94.3799)..controls (54.5098,93.9399) and (54.22,93.6599)..(53.7898,93.6599)
+ --(50.48,93.6599)..controls (50.1199,93.6599) and (49.8298,93.9399)..(49.8298,94.3799)
+ --(49.8298,95.24)..controls (49.8298,95.5999) and (50.1199,95.8899)..(50.48,95.8899)
+ --cycle;
+drawoptions (withcolor (0.3,0.3,0.3));
+pickup pencircle scaled 1.44bp;
+draw (50.48,95.8899)--(53.7898,95.8899)..controls (54.22,95.8899) and (54.5098,95.5998)..(54.5098,95.24)
+ --(54.5098,94.3799)..controls (54.5098,93.9399) and (54.22,93.6599)..(53.7898,93.6599)
+ --(50.48,93.6599)..controls (50.1199,93.6599) and (49.8298,93.9399)..(49.8298,94.3799)
+ --(49.8298,95.24)..controls (49.8298,95.5998) and (50.1199,95.8899)..(50.48,95.8899)
+ --cycle;
+drawoptions (withcolor (0.2,0.2,0.2));
+draw (53,92.6499)..controls (53,88.8298) and (55.2998,80.4099)..(57.5398,76.8799)
+ ..controls (59.7698,73.3498) and (63.5798,67.8799)..(63.5798,67.8799);
+pickup pencircle scaled 2.02bp;
+draw (63.1499,52.26)..controls (63.1499,52.26) and (57.0298,49.5198)..(41.98,52.98)
+ ..controls (26.9399,56.3599) and (16.8599,66.01)..(15.8498,66.2998);
+drawoptions (withcolor (0.9,0,0));
+pickup pencircle scaled 0bp;
+fill (87.7,123.46)--(94.5398,123.46)--(94.5398,113.89)
+ --(87.7,113.89)--(87.7,123.46)--cycle;
+endfig;
+end
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-basics.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-basics.tex
index a52c7a35a63..479f396022b 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-basics.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-basics.tex
@@ -51,8 +51,8 @@ wish, your comments, your grocery list, whatever. Comments in \METAPOST, prefixe
by a percent sign, as in \typ {% Let's draw a circle}, are ignored by the
interpreter, but useful reminders for the programmer.
-If the file is saved as \type {yourfile.mp}, then the file is processed by
-\METAPOST\ by issuing the following command:
+Traditionally, if the file is saved as \type {yourfile.mp}, then the file is
+processed by \METAPOST\ by issuing the following command:
\starttyping
mpost yourfile
@@ -88,7 +88,7 @@ If you have installed \CONTEXT, somewhere on your system there resides a file
following line at the top of your file:
\starttyping
-input mp-tool ; % or input metafun ;
+input metafun ;
\stoptyping
By loading this file, the resulting graphic will provide a high resolution
@@ -96,10 +96,44 @@ bounding box, which enables more accurate placement. The file also sets the \typ
{prologues := 1} so that viewers like \GHOSTVIEW\ can refresh the file when it is
changed.
+{\bf However!} When you use \METAPOST\ in \CONTEXT, you will not run the
+mentioned program at all: you embed your graphic in the document and we will
+discuss this later. You can still use separate files but then you process them as
+follows:
+
+\starttyping
+mtxrun --script metapost somefile.mp
+\stoptyping
+
+Alternatively you can wrap the individual pictures in a \TEX\ file, say \type
+{yourfile.tex}:
+
+\starttyping
+\starttext
+ \startMPpage
+ % code
+ \stopMPpage
+ \startMPpage
+ % code
+ \stopMPpage
+\stoptext
+\stoptyping
+
+and then run:
+
+\starttyping
+context somefile.tex
+\stoptyping
+
+after which you can use the resulting \PDF\ file (if it has more pages you just
+filter the page from that file).
+
Next we will introduce some more \METAPOST\ commands. From now on, we will omit
the encapsulating \type {beginfig} and \type {endfig} macros. If you want to
process these examples yourself, you should add those commands yourself, or if
-you use \CONTEXT\ you don't need them at all.
+you use \CONTEXT\ you don't need them at all. You can for instance wrap them in a
+\type {\startMPpage} \unknown\ \type {\stopMPpage} environment if you want to
+play around.
\startbuffer
pickup pencircle scaled .5cm ;
@@ -463,7 +497,7 @@ draw boundingcircle p withpen pencircle scaled 1mm withcolor .625yellow ;
You can consider the \type {boundingcircle} to be a round boundingbox.
-\startlinecorrection
+\startlinecorrection[blank]
\startcombination[nx=3,ny=1,location=middle]
{\processMPbuffer[a]} {square}
{\processMPbuffer[b]} {circle}
@@ -776,9 +810,9 @@ draw
{\def\Xcom{2}\def\Ycom{3}\def\Zcom{\the\textwidth }}
Chapter 3 of the \METAFONT\ book explains the mathematics behind the construction
-of curves. Both \METAFONT\ and \METAPOST\ implement B\'ezier curves. The fact
-that these curves are named after Pierre B\'ezier obscures the fact that the math
-behind them originates with Serge\u{\i} Bernshte\u{\i}n.
+of curves. Both \METAFONT\ and \METAPOST\ implement Bézier curves. The fact that
+these curves are named after Pierre Bézier obscures the fact that the math behind
+them originates with Sergeĭ Bernshteĭn.
The points on the curve are determined by the following formula:
@@ -2875,6 +2909,20 @@ The leftmost shape uses \type {eofill} and therefore the odd||even rule gets
applied. This time we follow the line and when it gets crossed en even number of
times the area will not be filled.
+Here is another example:
+
+\startbuffer
+eofill for i=1 upto 12: fullcircle scaled ((i/12)*cm) -- endfor cycle ;
+\stopbuffer
+
+\typebuffer
+
+The successive larger circle are unfilled and basically form one path:
+
+\startlinecorrection[blank]
+\processMPbuffer
+\stoplinecorrection
+
A glyph is often constructed from more than one path and eventually the shape is
filled with an odd||even fill (\type {eofill}) operation. Take the following
sequence:
@@ -3363,7 +3411,43 @@ context("%3!texexp!", 10.4698E30,"@2.3f","@2i")
\typebuffer
-This gives: \inlinebuffer .
+This gives: \inlinebuffer . In \in {figure} [fig:formatters] we see some more
+formatters.
+
+\startbuffer
+for i=1 upto 12 :
+ draw
+ thefmttext("\letterpercent 3!date!","month,space,year",2019,i)
+ shifted (0,i *cm / 2);
+ draw
+ thefmttext("@3!date!","month,space,year",2019,i)
+ shifted (4cm,i *cm / 2);
+endfor ;
+
+for i=1 upto 20 :
+ draw
+ thefmttext(decimal i)
+ shifted (1cm,-i/2*cm);
+ draw
+ thefmttext("@!month!",i)
+ shifted (4cm,-i/2*cm);
+ draw
+ thefmttext("@!weekday!",i)
+ shifted (7cm,-i/2*cm);
+ draw
+ thefmttext("@!monthshort!",i)
+ shifted (10cm,-i/2*cm);
+ draw
+ thefmttext("@3!dayoftheweek!",i,1,2018)
+ shifted (13cm,-i/2*cm);
+endfor ;
+\stopbuffer
+
+\typebuffer
+
+\startplacefigure[title=formatters,reference=fig:formatters]
+ \framed{\scale[width=.8\textwidth]{\processMPbuffer}}
+\stopplacefigure
\stopsection
@@ -3582,6 +3666,213 @@ a default value of 20.
\stopsection
+\startsection[title=Grouping]
+
+The grouping model in \METAPOST\ is kind of special. Basically anything that
+happens in a group is processed in some nested action and doesn't interfere with
+the outside. However, the last value put (back) into the input is picked up after
+the group. A \type {vardef} acts that way:
+
+\startbuffer
+vardef foo (expr i, j) =
+ save ii, jj ; ii := 2*i ; jj :=j/2 ;
+ (i, j) -- (ii,jj)
+enddef ;
+
+draw (foo(1,2) .. foo(5,1) .. foo(12,3))
+ ysized 1cm
+ withpen pencircle scaled 2mm
+ withcolor darkred ;
+
+draw boundingbox currentpicture withcolor darkyellow ;
+\stopbuffer
+
+\typebuffer
+
+This weird shape comes out:
+
+\startlinecorrection[blank]
+ \processMPbuffer
+\stoplinecorrection
+We save two variables, and then give new local numerics with their names some
+values. Then we \quote {return} a path. A \type {vardef} automatically starts
+with a \type {begingroup} and ends with an \type {endgroup}. The next example
+shows how we can use that grouping trick directly. The \type {--} has to come
+before the \type {begingroup}.
+
+\startbuffer
+vardef turtle expr p =
+ save a ; pair a ; a := point 0 of p ; a
+ for i = 1 upto length(p) if cycle p : - 1 fi :
+ -- begingroup a := a shifted point i of p ; a endgroup
+ endfor
+ if cycle p : -- cycle fi
+enddef ;
+
+draw ((0, 0) -- (10, 0) -- (100, 10) -- (-5,20) -- cycle)
+ withpen pencircle scaled 2 withcolor darkred ;
+draw turtle ((0, 0) -- (10, 0) -- (100, 10) -- (-5,20) -- cycle)
+ withpen pencircle scaled 2 withcolor darkyellow ;
+\stopbuffer
+
+\typebuffer
+
+Turtle graphics use relative positions. Actually they use one number and switch
+direction but the above is okay too. Effectively we loop over the path and use
+each point as a relative move, so we recalculate it.
+
+\startlinecorrection[blank]
+ \processMPbuffer
+\stoplinecorrection
+
+We could have said \type {-- hide(a := a shifted point i of p) a} because the
+\type {hide} macro does that the grouping trick.
+
+\stopsection
+
+\startsection[title=External files]
+
+You can put code in an external file and load that one when needed. The low level
+command is \type {input}:
+
+\starttyping
+input myfile ;
+input myfile.mp ;
+input myfile.mpiv ;
+input myfile.mpxl ;
+input "myfile.mpxl" ;
+\stoptyping
+
+In \CONTEXT\ we have modules and their name starts with \type {mp-} and the
+suffix can depend on what version you use (\type {mpii}, \type {mpiv}, \type
+{mpxl}) but that will be dealt with automatically.
+
+\starttyping
+loadmodule("mine") ;
+\stoptyping
+
+This will locate \type {mp-mine} with the proper suffix and often a module will
+be set up to be loaded only once. For loading files \LUAMETAFUN\ provides:
+
+\starttyping
+loadfile("somefile.mp") ;
+\stoptyping
+
+Which is a bit more robust than the \type {input} commands that is kind of fuzzy
+because it takes a sequence of tokens or a string. When you embed code in a
+document source there are some environments that permit loading of definitions
+and extensions.
+
+\starttyping
+\startMPdefinitions
+ % code passed to the library directly
+\stopMPdefinitions
+
+\startMPextensions
+ % code passed to the library but via tex (expansion step)
+\stopMPextensions
+\stoptyping
+
+\stopsection
+
+\startsection[title=Instances]
+
+The library supports several numbering models. The default is \type {scaled} that
+uses integers that represent a (relatively small) float. Although you can go up
+to 32K it's wise to stay below 4096. The \type {double} number model supports 64
+bit floating point and the \type {decimal} model arbitrary precision. In \LUATEX\
+there is also \type {binary} for arbitrary precision but in \LUAMETATEX\ that
+model is not provided.
+
+You can use different models and instances alongside. In \MKIV\ and \LMTX\ we have
+a few predefined. The \type {metafun} instance is the default. Here we show the
+ones that use \METAFUN:
+
+\starttyping[style=\ttx]
+\defineMPinstance[metafun] [format=metafun,extensions=yes,initializations=yes]
+\defineMPinstance[minifun] [format=minifun,extensions=yes,initializations=yes]
+\defineMPinstance[extrafun] [format=metafun,extensions=yes,initializations=yes]
+\defineMPinstance[lessfun] [format=metafun]
+\defineMPinstance[doublefun] [format=metafun,extensions=yes,initializations=yes,method=double]
+\defineMPinstance[decimalfun][format=metafun,extensions=yes,initializations=yes,method=decimal]
+\defineMPinstance[mprun] [format=metafun,extensions=yes,initializations=yes]
+\defineMPinstance[simplefun] [format=metafun,method=double] % for internal usage
+\stoptyping
+
+All instances will load additional definitions btu extensions (expanded
+definitions) and initializations (before each graphic) are optional.
+
+\starttyping
+\startMPdefinitions
+\stopMPdefinitions
+
+\startMPextensions
+\stopMPextensions
+
+\startMPinitializations
+\stopMPinitializations
+\stoptyping
+
+You can search the sources of manuals and test suite for examples of usage, but here are
+some:
+
+\startbuffer
+\defineMPinstance[foo][definitions=yes]
+\defineMPinstance[bar][definitions=yes]
+
+\startMPdefinitions{foo}
+ vardef p = image (
+ draw fullsquare scaled 1cm withcolor "darkgreen" ;
+ draw textext("1") ;
+ )
+ enddef ;
+\stopMPdefinitions
+
+\startMPdefinitions{bar}
+ vardef p = image (
+ draw (fullsquare rotated 45) scaled 1cm withcolor "darkyellow" ;
+ draw textext("2") ;
+ )
+ enddef ;
+\stopMPdefinitions
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We use both as:
+
+\startbuffer[demo-1]
+\startMPcode{foo}
+ draw p ;
+ draw image (
+ draw fullcircle scaled 1cm withcolor "darkblue" ;
+ draw textext("3") withcolor "darkred" ;
+ ) ;
+ draw p ;
+\stopMPcode
+\stopbuffer
+
+\startbuffer[demo-2]
+\startMPcode{bar}
+ draw p ;
+ draw image (
+ draw fullcircle scaled 1cm withcolor "darkblue" ;
+ draw textext("4") withcolor "darkred" ;
+ ) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer[demo-1,demo-2]
+
+\startlinecorrection
+\startcombination[nx=2,ny=1]
+ {\getbuffer[demo-1]} {foo}
+ {\getbuffer[demo-2]} {bar}
+\stopcombination
+\stoplinecorrection
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-debugging.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-debugging.tex
index 4174d34e10b..f8957b5d834 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-debugging.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-debugging.tex
@@ -56,9 +56,8 @@ parent point with thin lines.
\processMPbuffer
\stoplinecorrection
-You can deduce the direction of a path from the way the
-points are numbered, but using an arrow to indicate the
-direction is more clear.
+You can deduce the direction of a path from the way the points are numbered, but
+using an arrow to indicate the direction is more clear.
\startbuffer
path p ; p := fullcircle xscaled 4cm yscaled 3cm ;
@@ -376,6 +375,238 @@ When we overlay these three we get. The envelope only returns the outer curve.
\stopoverlay
\stoplinecorrection
+We show a few nore examples and let it to the user to come up with applications
+for this feature. We start by defining a scaled pen that we apply to a simple
+path that has three point.
+
+\startbuffer
+pen whateverpen ; whateverpen := makepen(fullcircle xyscaled(1/20,1/40));
+
+path p ; p := (origin .. (1,1/2) .. (1,1/4)) scaled 10 ;
+path q ; q := envelope whateverpen of p ;
+
+draw p withpen pencircle xyscaled(1/2,1/4)
+ withcolor "darkgreen" withtransparency (1,.5) ;
+drawpoints p withpen pencircle scaled 1
+ withcolor "darkgray" withtransparency (1,.5) ;
+drawcontrolpoints p withpen pencircle scaled 1/2
+ withcolor "darkmagenta" withtransparency (1,.5) ;
+
+currentpicture := currentpicture shifted (-20,0) ;
+
+draw p withpen pencircle xyscaled(1/2,1/4)
+ withcolor "darkgreen" withtransparency (1,.5) ;
+draw q withpen pencircle scaled 1/5
+ withcolor "darkblue" withtransparency (1,.5) ;
+drawpoints q withpen pencircle scaled 1
+ withcolor "darkgray" withtransparency (1,.5) ;
+drawcontrolpoints q withpen pencircle scaled 1/2
+ withcolor "darkyellow" withtransparency (1,.5) ;
+draw q withpen pencircle scaled 1/50
+ withcolor "white" ;
+
+currentpicture := currentpicture ysized 2cm ;
+\stopbuffer
+
+\typebuffer
+
+On the left we see the path drawn with a circular pen. The points and control
+points are also shown. The path is repeated on the right but there it gets the
+envelope overlayed. We show the points and control points of the envelope: they
+nearly overlap but that depends of course on the used pen.
+
+\startlinecorrection[blank]
+ \processMPbuffer
+\stoplinecorrection
+
+In order to illustrate that the envelope is an outline we blow up a piece of
+this image:
+
+\startlinecorrection[blank]
+ \scale[height=3cm]{\clip[nx=10,ny=20,x=9,y=7]{\processMPbuffer}}
+\stoplinecorrection
+
+Without further explanation we let you ponder the results of the following code.
+
+\startbuffer
+drawoptions(withcolor "darkred") ;
+draw (envelope pensquare of (up--left)) ;
+draw (up--left) shifted (4,0) withpen pensquare ;
+draw fullcircle shifted (8,0) ;
+draw (envelope pensquare of fullcircle) shifted (12,0) ;
+draw (fullcircle) shifted (16,0) withpen pensquare ;
+draw (fullcircle) shifted (20,0) withpen pencircle ;
+currentpicture := currentpicture xsized TextWidth ;
+\stopbuffer
+
+\typebuffer
+
+The efficiency of the output of each draw differs a lot because circles are made
+from eight points and because a transformed pen results in two paths. Normally
+that is not something you have to loose sleep over.
+
+\startlinecorrection[blank]
+ \processMPbuffer
+\stoplinecorrection
+
+\stopsection
+
+\startsection[title=Performance]
+
+On the average performance of \METAPOST\ is quite okay. The original program uses
+scaled numbers, which are floats packed into an integer. The library also
+supports doubles, decimal and binary number models. In \CONTEXT\ we only support
+scaled, double and decimal. Because the library has to support multiple models
+there is more overhead and therefore it is also slower. There's also more dynamic
+memory allocation going on. In the transition from \MKII\ to \MKIV\ some of the
+critical code (like the code involved in passing \TEX\ states to \METAPOST) had
+to be optimized, although when the \LUA\ interface was added, betters ways became
+possible. We have to accept the penalty in performance and often can gain back a
+lot because we have the \LUA\ interface.
+
+One of the main bottlenecks in storing quantities. \footnote {Recently, Taco
+Hoekwater has done some excellent explanations about the way \METAPOST\ scans the
+input and create variables and you can find his presentations at meetings on the
+\CONTEXT\ garden.} When we see something \type {a[1]} and \type {a[3]} the \type
+{a} is a root variable and the \type {1} and {3} are entries in a linked list
+from that root. It's not an array in the sense that there is some upper bound and
+that there's also a slot \type {2}. There is order but the list is sparse. When
+access is needed, for instance to do some calculations, a linear lookup (from the
+head of the list) takes place. This is quite okay performance wise because
+normally these list are small. The same is true for a path, which is also a
+linked list. If you need point 25, it is looked up by starting at the first knot
+of the path. The longer the path, the more time it takes to reach arbitrary
+points. In the \LUA\ chapter we give an example of how to get around that
+limitation.
+
+Concerning the arrays, here is s trick to get around a performance bottleneck:
+
+\starttyping
+numeric foo[];
+
+def set_foo(expr c, s) =
+ foo[c] := s ;
+enddef ;
+
+def get_foo(expr c) =
+ foo[c]
+enddef ;
+\stoptyping
+
+If you use this as follows:
+
+\starttyping
+numeric n ; n = 123 ;
+
+for i=1 upto 20000 :
+ set_foo(i,n) ;
+endfor ;
+
+for i=1 upto 20000 :
+ n := get_foo(i) ;
+endfor ;
+\stoptyping
+
+the runtime can (for instance) be 3.3 seconds, but when you use the following
+variant, it goes down to 0.13 seconds.
+
+\starttyping
+numeric foo[][][][]; % 12345 : 1 12 123 44 instead of 12344
+
+def set_foo(expr c, s) =
+ foo[c div 10000][c div 1000][c div 100][c] := s ;
+enddef ;
+def get_foo(expr c) =
+ foo[c div 10000][c div 1000][c div 100][c]
+enddef ;
+\stoptyping
+
+This time the lookup is not split into phases each being relatively fast. So, in
+order to reach slot 1234 the engine doesn't have to check and jump over what
+comes before that. You basically create a tree here: 0 (hit), 1000 (hit in one),
+200 (hit in two), 34 (hit in 34). We could go to a single digit but that doesn't
+save much. Before we had ways to store data at the \LUA\ end we used this a few
+times in macros that dealt with data (like Alan Braslau's node and graphics
+modules). This is typically something one can figure out by looking at the (non
+trivial) source code.
+
+Here is another example. In \LUA\ we can easily create a large file, like this:
+
+\starttyping
+\startluacode
+ local t = { }
+ for i=1,10000 do
+ t[i] = string.rep(
+ "here we have number " ..
+ tostring(i) ..
+ " out of the 10000 numbers that we will test"
+ ,100)
+ end
+ t = table.concat(t,"\n")
+ io.savedata("foo1.tmp",t)
+ io.savedata("foo2.tmp",t)
+ io.savedata("foo3.tmp",t)
+\stopluacode
+\stoptyping
+
+We make two copies because we do two experiments and we want to treat them equal with
+respect to caching.
+
+\starttyping
+\startMPcode
+ string f ; f := "foo1.tmp" ;
+ string s[] ;
+ numeric n ; n := 0 ;
+ for i=1 upto 10000 :
+ s[i] := readfrom f ;
+ exitif s[i] = EOF ;
+ n := n + 1 ;
+ endfor ;
+\stopMPcode
+\stoptyping
+
+Say that this runs in 2.2 seconds, how come that the next one runs in 1.7 seconds
+instead?
+
+\starttyping
+\startMPcode
+ string f ; f := "foo2.tmp" ;
+ string s[] ;
+ string ss ;
+ numeric n ; n := 0 ;
+ for i=1 upto 10000 :
+ ss := readfrom f ;
+ exitif ss = EOF ;
+ s[i] := ss ;
+ n := n + 1 ;
+ endfor ;
+\stopMPcode
+\stoptyping
+
+The main reason is that the first case we have two lookups in the linked list
+that determines variable \type {s} and the longer the list, the more time it will
+take. In the second case we use an intermediate variable. Although that means
+extra memory (de)allocation it still pays of. In practice you don't need to worry
+too much about it but of course we can again follow the tree approach:
+
+\startMPcode
+ string f ; f := "foo3.tmp" ;
+ string s[][][] ;
+ string ss ;
+ numeric n ; n := 0 ;
+ for i=1 upto 10000 :
+ ss := readfrom f ;
+ exitif ss = EOF ;
+ s[i div 1000][i div 100][i] := ss ;
+ n := n + 1 ;
+ endfor ;
+\stopMPcode
+
+This time we go down to 1.5 second. Timings could be a bit different in \MKIV\ and
+\LMTX\ because in \LUAMETATEX\ all \METAPOST\ file \IO\ goes through \LUA\ but the
+relative performance gains are the same. With \LUATEX\ and \MKIV\ I measures
+2.9, 2.5 and 2.1 and with \LUAMETATEX\ and \LMTX\ I got 2.3, 1.7 and 1.5.
+
\stopsection
\stopchapter
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-effects.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-effects.tex
index 74e7d487e9e..6c020acda90 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-effects.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-effects.tex
@@ -363,9 +363,9 @@ moment shading is only supported in \PDF. In the following examples, we will use
the next three colors:
\startbuffer
-\definecolor[a][darkyellow]
-\definecolor[b][s=.8]
-\definecolor[c][darkred]
+\definecolor[mycolora][darkyellow]
+\definecolor[mycolorb][s=.8]
+\definecolor[mycolorc][darkred]
\stopbuffer
\typebuffer
@@ -386,13 +386,13 @@ First we discuss the old method which is still valid and also available in
\startuniqueMPgraphic{CircularShade}
path p ;
p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
- circular_shade(p,0,\MPcolor{a},\MPcolor{b}) ;
+ circular_shade(p,0,\MPcolor{mycolora},\MPcolor{mycolorb}) ;
\stopuniqueMPgraphic
\startuniqueMPgraphic{LinearShade}
path p ;
p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
- linear_shade(p,0,\MPcolor{a},\MPcolor{b});
+ linear_shade(p,0,\MPcolor{mycolora},\MPcolor{mycolorb});
\stopuniqueMPgraphic
\stopbuffer
@@ -458,7 +458,7 @@ stepping through the color values, we can use the more efficient and generalized
width := \overlaywidth ;
height := \overlayheight ;
path p ; p := unitsquare xscaled width yscaled height ;
- #2_shade(p,#3,\MPcolor{a},\MPcolor{b}) ;
+ #2_shade(p,#3,\MPcolor{mycolora},\MPcolor{mycolorb}) ;
\stopuniqueMPgraphic
\defineoverlay[shade-#1][\uniqueMPgraphic{shade-#1}]%
\framed[background=shade-#1,width=2cm,height=2cm,frame=off]{}}
@@ -501,7 +501,7 @@ stepping through the color values, we can use the more efficient and generalized
% \startbuffer
% path p ; p := fullcircle scaled 1cm ;
% for i=0 step 2cm until 8cm :
-% circular_shade(p shifted (i,0),0,\MPcolor{a},\MPcolor{b}) ;
+% circular_shade(p shifted (i,0),0,\MPcolor{mycolora},\MPcolor{mycolorb}) ;
% endfor ;
% \stopbuffer
%
@@ -518,7 +518,7 @@ stepping through the color values, we can use the more efficient and generalized
% the center of the shading stays at the first circle.
%
% \startbuffer
-% circular_shade(fullcircle scaled 1cm,0,\MPcolor{a},\MPcolor{b}) ;
+% circular_shade(fullcircle scaled 1cm,0,\MPcolor{mycolora},\MPcolor{mycolorb}) ;
% picture s ; s := currentpicture ; currentpicture := nullpicture ;
% for i=0 step 2cm until 8cm :
% addto currentpicture also s shifted (i,0) ;
@@ -544,7 +544,7 @@ stepping through the color values, we can use the more efficient and generalized
\startbuffer
sh := define_circular_shade
- (origin,origin,0,8cm,\MPcolor{a},\MPcolor{b}) ;
+ (origin,origin,0,8cm,\MPcolor{mycolora},\MPcolor{mycolorb}) ;
for i=0 step 2cm until 8cm :
fill fullcircle scaled 1cm shifted (i,0) withshade sh ;
endfor ;
@@ -570,9 +570,9 @@ the shade. The next macro demonstrates the principles in a different way.
def test_shade (expr a, b, ra, rb) =
pickup pencircle scaled 1mm ;
- color ca ; ca := \MPcolor{a} ;
- color cb ; cb := \MPcolor{b} ;
- color cc ; cc := \MPcolor{c} ;
+ color ca ; ca := \MPcolor{mycolora} ;
+ color cb ; cb := \MPcolor{mycolorb} ;
+ color cc ; cc := \MPcolor{mycolorc} ;
path pa ; pa := fullcircle scaled 2ra shifted a ;
path pb ; pb := fullcircle scaled 2rb shifted b ;
@@ -640,9 +640,9 @@ test_shade(origin shifted (.25cm,0), origin, .50cm, 1cm) ;
def test_shade (expr a, b) =
pickup pencircle scaled 1mm ;
- color ca ; ca := \MPcolor{a} ;
- color cb ; cb := \MPcolor{b} ;
- color cc ; cc := \MPcolor{c} ;
+ color ca ; ca := \MPcolor{mycolora} ;
+ color cb ; cb := \MPcolor{mycolorb} ;
+ color cc ; cc := \MPcolor{mycolorc} ;
sh := define_linear_shade(a,b,ca,cb) ;
@@ -1472,8 +1472,8 @@ graphics in \PNG, \PDF, and \JPG\ format, or more precise: those formats
supported by \PDFTEX.\pagereference[hacker]
\startbuffer
-draw externalfigure "hacker.png" scaled 5cm shifted (-6cm,0) ;
-draw externalfigure "hacker.png" scaled 5cm slanted .5 ;
+draw externalfigure "hacker.png" xsized 5cm shifted (-6cm,0) ;
+draw externalfigure "hacker.png" xsized 5cm slanted .5 ;
\stopbuffer
\typebuffer
@@ -1497,7 +1497,7 @@ for i := 1 upto 5 :
c := .5(s,s) ; % center of picture
d := (2cm*i,.5cm) randomized .5cm ; % displacement
draw externalfigure "hacker.png"
- scaled s rotatedaround (c,0 randomized 30) shifted d ;
+ ysized s rotatedaround (c,0 randomized 30) shifted d ;
endfor ;
\stopbuffer
@@ -1516,7 +1516,7 @@ figure inclusion and shading.
\startbuffer
picture p ;
-p := externalfigure "hacker.png" scaled 150pt ;
+p := externalfigure "hacker.png" xsized 150pt ;
clip p to unitcircle scaled 150pt ;
circular_shade(boundingbox p enlarged 10pt, 0, .2red, .9red) ;
addto currentpicture also p ;
@@ -2222,10 +2222,10 @@ The \type {simple} option disables all. The simple results are shown in
When you use this feature you need to be aware of the fact that fonts can have
features, for instance ligatures and kerns between characters. In \in {figure}
-[fig:outlines:features] we see a few examples with and without features, one with
-Pagella (the Zapf quote) and one with Optima Nova (the Tufte quote).
+[fig:outlines:features] we see a few examples, one with Pagella (the Zapf quote)
+and one with Dejavu (the Tufte quote).
-\startplacefigure[reference=fig:outlines:features,title={Pagela (\OPENTYPE) and Optima Nova (\TYPEONE)}]
+\startplacefigure[reference=fig:outlines:features,title={Pagela and Dejavu}]
\startcombination[1*4]
\bgroup
\def|#1|{-}%
@@ -2249,24 +2249,24 @@ Pagella (the Zapf quote) and one with Optima Nova (the Tufte quote).
\egroup {pagella / default features}
\bgroup
\def|#1|{-}%
- \definedfont[lt55476.afm*none]% optima nova
+ \definedfont[dejavuserif.ttf*none]%
\startMPcode
draw outlinetext.b
("\framed[align=normal,width=max]{\input{tufte}}")
(withcolor .375white)
(withcolor .625green withpen pencircle scaled 1/10) ;
\stopMPcode
- \egroup {optima nova / no features}
+ \egroup {dejavu serif / no features}
\bgroup
\def|#1|{-}%
- \definedfont[lt55476.afm*default]% optima nova
+ \definedfont[dejavuserif.ttf*default]%
\startMPcode
draw outlinetext.b
("\framed[align=normal,width=max]{\input{tufte}}")
(withcolor .375white)
(withcolor .625yellow withpen pencircle scaled 1/10) ;
\stopMPcode
- \egroup {optima nova / default features}
+ \egroup {dejavu serif / default features}
\stopcombination
\stopplacefigure
@@ -2287,6 +2287,219 @@ like:
\processMPbuffer
\stoplinecorrection
+The next example needs the \type {hanbatang-lvt.ttf} font so when you process this
+you might want to install that first. In \MKIV\ and \LMTX\ you can put that font
+in \typ {<texroot>/texmf-fonts/data/hanbantang} or a similar path.
+
+We start by defining the font:
+
+% \definefontfeature
+% [korean-base]
+% [goodies=hanbatanglvt,
+% colorscheme=default,
+% mode=node,
+% script=hang,
+% language=kor]
+
+\startbuffer
+\definefontfeature
+ [korean-base]
+ [goodies=hanbatanglvt,
+ colorscheme=default,
+ mode=node,
+ script=hang,
+ language=kor]
+
+\definefont[KoreanFont][hanbatanglvt*korean-base]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Next we define a macro that will draw the outline:
+
+\startbuffer
+\startMPdefinitions
+ string KoreanColors[] ;
+
+ KoreanColors[1] := "darkred" ;
+ KoreanColors[2] := "darkgreen" ;
+ KoreanColors[3] := "darkblue" ;
+ KoreanColors[4] := "darkyellow" ;
+ KoreanColors[5] := "darkgray" ;
+
+ newinternal KoreanSplit ; KoreanSplit := -1 ;
+ newinternal KoreanCode ; KoreanCode := -2 ;
+ newinternal KoreanMode ; KoreanMode := KoreanSplit ;
+
+ def KoreanOutline(expr txt) =
+ picture p ; p := outlinetext.p(txt) ;
+ numeric n ; n := 0 ;
+ string old, new ; old := "" ;
+ for i within p :
+ if KoreanMode == KoreanSplit :
+ n := n + 1 ;
+ elseif KoreanMode == KoreanCode :
+ new := prescriptpart i ;
+ if new <> old :
+ old := new ;
+ n := n + 1 ;
+ fi ;
+ else :
+ n := KoreanMode ;
+ fi ;
+ if unknown KoreanColors[n] :
+ n := 1 ;
+ fi ;
+ draw pathpart i
+ withpen pencircle scaled 1/10
+ withcolor KoreanColors[n] ;
+ endfor ;
+ enddef ;
+
+ def KoreanTest(expr txt) =
+ image (
+ KoreanMode := KoreanSplit ; KoreanOutline(txt) ;
+ currentpicture := currentpicture shifted (- xpart urcorner currentpicture, 0);
+ KoreanMode := KoreanCode ; KoreanOutline(txt) ;
+ currentpicture := currentpicture shifted (- xpart urcorner currentpicture, 0);
+ KoreanMode := 3 ; KoreanOutline(txt) ;
+ )
+ enddef ;
+\stopMPdefinitions
+\stopbuffer
+
+Because we want to reuse this definition, we define it for all what comes:
+
+\typebuffer \getbuffer
+
+% entered as three characters: ᄅ ᅡ ᆺ (mail collapses)
+%
+% \startMPcode KoreanTest("\KoreanFont 랏") ; \stopMPcode
+
+\startbuffer
+\startcombination[3*2]
+ {\startMPcode draw KoreanTest("\KoreanFont 랏") ysized 15mm ; \stopMPcode} {}
+ {\startMPcode draw KoreanTest("\KoreanFont 논") ysized 15mm ; \stopMPcode} {}
+ {\startMPcode draw KoreanTest("\KoreanFont 왕") ysized 15mm ; \stopMPcode} {}
+ {\startMPcode draw KoreanTest("\KoreanFont 닭") ysized 15mm ; \stopMPcode} {}
+ {\startMPcode draw KoreanTest("\KoreanFont 박") ysized 15mm ; \stopMPcode} {}
+ {\startMPcode draw KoreanTest("\KoreanFont 서") ysized 15mm ; \stopMPcode} {}
+\stopcombination
+\stopbuffer
+
+We use this macro in the following example. The results can be seen in \in
+{figure} [koreanoutlines]. There is one drawback of this example: It contributes
+a lot to the runtime: about 2.5~seconds to a 16~second run without this example.
+\footnote {This is partly due to an enforced intermediate garbage collection
+step.} The font itself loads fast but the outlines take their time because a few
+hundred megabytes of \LUA\ tables are involved. Instead you can define the
+feature to use \typ {goodies=hanbatanglvt} and \typ {colorscheme=default} and
+play with that.
+
+\typebuffer
+
+\startplacefigure[title=Some Korean magic,reference=koreanoutlines]
+ \doifelsemode{optional} {
+ \getbuffer
+ } {
+ \framed{A large optional example is not shown here!}
+ }
+\stopplacefigure
+
+On the mailing list occasionally questions pop op with respect to outlines and
+user Garulfo came up with a neat solution for shaded text. First some examples:
+
+\startbuffer
+\startMPcode
+ picture p ; p := lmt_outline [
+ text = "\strut foo f o o",
+ drawcolor = "white",
+ rulethickness = .2
+ ] ysized 3cm ;
+ fill boundingbox p
+ withshademethod "linear"
+ withshadedirection(0,1)
+ withshadecolors ("darkblue", "darkyellow") ;
+ draw p;
+\stopMPcode
+\stopbuffer
+
+\typebuffer
+
+Here the background shines through the text:
+
+\startlinecorrection \getbuffer \stoplinecorrection
+
+You can actually use the effects features which for a larger text is more
+efficient because it just renders the font differently. The result is
+shown in \in {figure} [fig:effects:text].
+
+\startbuffer[effects-text]
+\startuseMPgraphic{MyShade}
+ fill OverlayBox
+ withshademethod "linear"
+ withshadedirection(0,1)
+ withshadecolors (red, blue) ;
+\stopuseMPgraphic
+
+\defineoverlay[MyShade][\useMPgraphic{MyShade}]
+
+\setupbackgrounds[page][background=MyShade]
+
+\startmakeup
+ \definedfont[SerifBold*default @ 50pt] \setupinterlinespace
+
+ \defineeffect[MyOutline][alternative=outer,rulethickness=1pt]
+
+ \startcolor[white]
+ \starteffect[MyOutline]
+ \input jojomayer
+ \stopeffect
+ \stopcolor
+\stopmakeup
+\stopbuffer
+
+\typebuffer[effects-text]
+
+\startplacefigure[title=Regular text effects,reference=fig:effects:text]
+ \typesetbuffer[effects-text][height=.3\textheight]
+\stopplacefigure
+
+We now come to the neat example:
+
+\startbuffer
+\startMPcode
+ picture tt ; tt := lmt_outline [
+ kind = "fillup",
+ text = "\definedfont[name:texgyrepagellabold*default]foo f o o",
+ ] xsized 12cm ;
+
+ path bb ; bb := boundingbox tt ;
+
+ path pp ; pp := bb enlarged 2cm ;
+
+ fill pp
+ withshademethod "linear"
+ withshadedirection down
+ withshadecolors ("darkred", "darkblue") ;
+
+ for i within tt :
+ nofill pathpart i;
+ endfor ;
+
+ eofill bb withcolor "darkgray" ;
+ clip currentpicture to bb ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer
+
+It uses a clever combination of refilling the shape and background:
+
+\startlinecorrection
+ \getbuffer
+\stoplinecorrection
+
\stopsection
\startsection[title=Transparency groups]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment-layout.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment-layout.tex
index 409839cbafe..8a30aad7c68 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment-layout.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment-layout.tex
@@ -71,9 +71,11 @@
\setuppagenumbering
[alternative=doublesided]
+\definefontfallback[moremono] [dejavusansmono] [0x0000-0xFFFF] [rscale=0.85]
+
\definetypeface [metafunbodyfont] [rm] [serif] [pagella] [default]
\definetypeface [metafunbodyfont] [ss] [sans] [modern] [default]
-\definetypeface [metafunbodyfont] [tt] [mono] [modern] [default]
+\definetypeface [metafunbodyfont] [tt] [mono] [modern] [default] [fallbacks=moremono]
\definetypeface [metafunbodyfont] [mm] [math] [palatino] [default]
\setupbodyfont [metafunbodyfont,10pt] % 11 pt and 12pt -> errors due to intersection mess
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment.tex
index ca9fc24b3fa..57875008dbe 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-environment.tex
@@ -182,24 +182,50 @@
\defineoverlay[titled][\uniqueMPgraphic{titled}]
+% \starttexdefinition unexpanded ChapterCommand #1#2
+% \ifconditional\headshownumber
+% \ifdim\leftmarginwidth<\rightmarginwidth
+% \donetrue
+% \else
+% \donefalse
+% \fi
+% \hskip-\ifdone\leftmargintotal\else\rightmargintotal\fi
+% \framed [
+% background=titled,
+% frame=off,
+% offset=0pt
+% ] {
+% \hbox to \ifdone\leftmarginwidth\else\rightmarginwidth\fi {
+% #1
+% \hss
+% }
+% \hskip\ifdone\leftmargindistance\else\rightmargindistance\fi
+% #2
+% }
+% \else
+% \framed [
+% background=titled,
+% frame=off,
+% offset=0pt
+% ] {
+% #2
+% }
+% \fi
+% \stoptexdefinition
+
\starttexdefinition unexpanded ChapterCommand #1#2
\ifconditional\headshownumber
- \ifdim\leftmarginwidth<\rightmarginwidth
- \donetrue
- \else
- \donefalse
- \fi
- \hskip-\ifdone\leftmargintotal\else\rightmargintotal\fi
+ \hskip-\leftmargintotal\relax
\framed [
background=titled,
frame=off,
offset=0pt
] {
- \hbox to \ifdone\leftmarginwidth\else\rightmarginwidth\fi {
+ \hbox to \leftmarginwidth {
#1
\hss
}
- \hskip\ifdone\leftmargindistance\else\rightmargindistance\fi
+ \hskip\leftmargindistance\relax
#2
}
\else
@@ -316,7 +342,7 @@
\startbuffer[shape-a]
\startuniqueMPgraphic{meta:hash}{linewidth,linecolor,angle,gap}
- if unknown context_back : input mp-back ; fi ;
+ loadmodule("back") ;
some_hash ( OverlayWidth, OverlayHeight ,
\MPvar{linewidth}, \MPvar{linecolor} ,
\MPvar{angle}, \MPvar{gap} ) ;
@@ -343,7 +369,7 @@
\startbuffer[symb-a]
\startuniqueMPgraphic{meta:button}{type,size,linecolor,fillcolor}
- if unknown context_butt : input mp-butt ; fi ;
+ loadmodule("butt") ;
some_button ( \MPvar{type},
\MPvar{size},
\MPvar{linecolor},
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-examples.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-examples.tex
index 4e5e0eed310..5549a3bdd85 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-examples.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-examples.tex
@@ -3264,6 +3264,259 @@ We get:
\stopsection
+\startsection[title=Educational]
+
+I made this example long ago, when some family member had to learn tables by
+heart. For some reason, at school, this is made into a complex issue, with tricks
+and such, even it if only involves only a few numbers. My own experience (if I
+remember right) was that some of these numbers are trivial, and that there is
+quite some symmetry, so in practice only a quarter needs to be remembered. And,
+assuming that you can easily deduct the trivial cases, one can just calculate the
+rest if needed.
+
+\startbuffer
+\start \ttbf \startMPcode
+ def MyDraw(expr i, j, c) =
+ fill fullsquare shifted (i,j) withcolor c withtransparency (1,.5) ;
+ enddef ;
+
+ for i = 1 upto 10 :
+ for j = 1 upto 10 : MyDraw( i, -j, "middlered" ) ; endfor ; endfor ;
+
+ for j = 1 upto 10 : MyDraw( 1, -j, "middleblue" ) ; endfor ;
+ for i = 1 upto 10 : MyDraw( i, -10, "middlegreen" ) ; endfor ;
+ for i = 1 upto 10 : MyDraw( i, -1, "middleyellow") ; endfor ;
+ for j = 1 upto 10 : MyDraw(10, -j, "middlecyan" ) ; endfor ;
+ for j = 1 upto 10 : MyDraw( 5, -j, "middlegray" ) ; endfor ;
+ for j = 1 upto 10 : MyDraw( j, -j, "middlegray" ) ; endfor ;
+
+ draw image ( for i = 1 upto 10 : for j = 1 upto 10 :
+ draw textext(decimal (i*j)) ysized .25 shifted (i,-j) ;
+ endfor ; endfor ; ) withcolor white ;
+
+ currentpicture := currentpicture ysized 10cm ;
+\stopMPcode \stop
+\stopbuffer
+
+\typebuffer
+
+\startplacefigure[title=Overlapping glyphs,reference=fig:tentable]
+ \getbuffer
+\stopplacefigure
+
+Here we use both transparency and colors to stress the reduction of cases. The
+named colors resolve to ones defined at the \TEX\ end. We see the redndering
+\in {figure} [fig:tentable].
+
+\startsection[title=Glyph magic]
+
+The next example is the result of a tread on the mailing list. After Henri Menke
+posted a some glyph overlap code, I made a variant that more suited the way we do
+it in \METAFUN. In the meantime Floris van Maanen had found out that some glyphs
+need a more inventive solution so after that the code evolved. By then the \type
+{outlinetext}, \type {drawoutlinetext} and \type {filloutlinetext} helpers had
+been added to the code base.
+
+Because this is complicated stuff, we just show the two solutions. The first one
+is a relative simple one, the second one uses an approach suggested by Alan
+Braslau and therefore uses some of the code that can be found in the \type
+{crossingunder} macro.
+
+\startbuffer
+\startMPdefinitions
+def ShowOverlapInOutlinesA(expr first, second) =
+ path p_i, p_j, s_i, s_j ;
+ numeric n_i, n_j, index ;
+ pair found ;
+ index := 0 ;
+ for i within first :
+ for j within second :
+ p_i := pathpart i ; n_i := length(p_i) ;
+ p_j := pathpart j ; n_j := length(p_j) ;
+ for ii = 0 upto n_i - 1 :
+ s_i := subpath(ii,ii+1) of p_i ;
+ for jj = 0 upto n_j - 1 :
+ s_j := subpath(jj,jj+1) of p_j ;
+ found := s_i intersection_point s_j ;
+ if intersection_found :
+ index := index + 1 ;
+ drawdot found
+ withpen pencircle scaled 4 withcolor white ;
+ draw textext("\strut\ttbf " & decimal index) ysized 3
+ shifted found ;
+ fi ;
+ endfor ;
+ endfor ;
+ endfor ;
+ endfor ;
+enddef ;
+\stopMPdefinitions
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This is the solution based on \type {crossingunder}, a macro that has been
+introduced as part of Alan's neat node module.
+
+\startbuffer
+\startMPdefinitions
+def ShowOverlapInOutlinesB(expr first, second) =
+ begingroup ;
+ save p, q, n, t, a, b, c, bcuttings, hold, found ;
+ path p, q ;
+ numeric n, hold ;
+ path a, b, c, bcuttings ;
+ pair found ;
+ c := makepath(currentpen scaled crossingscale) ;
+ for f within first :
+ numeric t[];
+ path hold[];
+ t[0] := n := hold := 0 ;
+ for s within second :
+ p := pathpart f ;
+ q := pathpart s ;
+ a := p ;
+ for i=1 upto crossingnumbermax : % safeguard
+ clearxy ; z = a intersectiontimes q ;
+ if x < 0 :
+ exitif hold < 1 ;
+ a := hold[hold] ; hold := hold - 1 ;
+ clearxy ; z = a intersectiontimes q ;
+ fi
+ (t[incr n], whatever) = p intersectiontimes point x of a ;
+ if x = 0 :
+ a := a cutbefore c shifted point x of a ;
+ elseif x = length a :
+ a := a cutafter c shifted point x of a ;
+ else : % before or after?
+ b := subpath (0,x) of a cutafter c shifted point x of a ;
+ bcuttings := cuttings ;
+ a := subpath (x,length a) of a cutbefore c shifted point x of a ;
+ clearxy ; z = a intersectiontimes q ;
+ if x < 0 :
+ a := b ;
+ cuttings := bcuttings ;
+ elseif length bcuttings > 0 :
+ clearxy ; z = b intersectiontimes q ;
+ if x >= 0 :
+ hold[incr hold] := b ;
+ fi
+ fi
+ fi
+ if length cuttings = 0 :
+ exitif hold < 1 ;
+ a := hold[hold] ; hold := hold - 1 ;
+ fi
+ endfor ;
+ endfor ;
+ t[incr n] = length p ;
+ for i=1 upto n :
+ found := point t[i] of p ;
+ drawdot found
+ withpen pencircle scaled 4 withcolor white ;
+ draw textext("\strut\ttbf " & decimal i) ysized 3
+ shifted found ;
+ endfor ;
+ endfor ;
+ endgroup ;
+enddef ;
+\stopMPdefinitions
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We demonstrate the differences with an example. The result can be seen in
+\in {figure} [fig:overlapping:a].
+
+\startbuffer
+\startcombination
+ {\startMPcode
+ picture first, second ;
+ first := outlinetext.p("N") ; first := first scaled 10 ;
+ second := outlinetext.p("T") ; second := second scaled 10 ;
+ second := second rotatedaround(center second, 5) shifted (1,-1) ;
+ filloutlinetext(first ) withcolor .5[darkblue,white] ;
+ filloutlinetext(second) withcolor .5[darkred,white] ;
+ drawoutlinetext(first ) ;
+ drawoutlinetext(second) ;
+ ShowOverlapInOutlinesA(first, second) ;
+ addbackground withcolor darkgray ;
+ currentpicture := currentpicture scaled 2.5 ;
+ \stopMPcode} {Method A}
+ {\startMPcode
+ picture first, second ;
+ first := outlinetext.p("N") ; first := first scaled 10 ;
+ second := outlinetext.p("T") ; second := second scaled 10 ;
+ second := second rotatedaround(center second, 5) shifted (1,-1) ;
+ filloutlinetext(first ) withcolor .5[darkgreen,white] ;
+ filloutlinetext(second) withcolor .5[darkyellow,white] ;
+ drawoutlinetext(first ) ;
+ drawoutlinetext(second) ;
+ ShowOverlapInOutlinesB(first, second) ;
+ addbackground withcolor darkgray ;
+ currentpicture := currentpicture scaled 2.5 ;
+ \stopMPcode} {Method B}
+\stopcombination
+\stopbuffer
+
+\typebuffer
+
+\startplacefigure[title=Overlapping glyphs,reference=fig:overlapping:a]
+ \getbuffer
+\stopplacefigure
+
+We duplicate some code because the pictures will change in the process of
+analyzing. Let's make a helper for that:
+
+\startbuffer
+\startMPdefinitions
+def ShowOverlap(expr f, s, m) =
+ picture first, second ;
+ first := outlinetext.p(f) ; first := first scaled 10 ;
+ second := outlinetext.p(s) ; second := second scaled 10 ;
+
+ filloutlinetext(first ) withcolor darkblue ;
+ drawoutlinetext(first ) ;
+
+ filloutlinetext(second) withcolor darkred ;
+ drawoutlinetext(second) ;
+
+ if m == 2 :
+ ShowOverlapInOutlinesB
+ else :
+ ShowOverlapInOutlinesA
+ fi (first, second) ;
+
+ addbackground withcolor darkgray ;
+ currentpicture := currentpicture ysized 4cm ;
+enddef ;
+\stopMPdefinitions
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Again we demonstrate the differences with some examples. The result can be seen in
+\in {figure} [fig:overlapping:b].
+
+\startbuffer
+ \startcombination[nx=3,ny=2]
+ {\startMPcode ShowOverlap("N","T",1) ; \stopMPcode} {Method 1}
+ {\startMPcode ShowOverlap("\$","Q",1) ; \stopMPcode} {Method 1}
+ {\startMPcode ShowOverlap("\tttf ABC","\tttf PQR",1) ; \stopMPcode} {Method 1}
+ {\startMPcode ShowOverlap("N","T",2) ; \stopMPcode} {Method 2}
+ {\startMPcode ShowOverlap("\$","Q",2) ; \stopMPcode} {Method 2}
+ {\startMPcode ShowOverlap("\tttf ABC","\tttf PQR",2) ; \stopMPcode} {Method 2}
+ \stopcombination
+\stopbuffer
+
+\typebuffer
+
+\startplacefigure[title=Overlapping glyphs,reference=fig:overlapping:b]
+ \getbuffer
+\stopplacefigure
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-gadgets.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-gadgets.tex
index 9010fc403e6..014bd66e81c 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-gadgets.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-gadgets.tex
@@ -361,6 +361,8 @@ second argument in the next line:
\starttyping
\startuniqueMPgraphic{smile}{type,height,color}
+ % the image
+\stopuniqueMPgraphic
\stoptyping
Because unique graphics often are used in backgrounds, its uniqueness is
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-introduction.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-introduction.tex
index b519055c041..e2c33f6f3e8 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-introduction.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-introduction.tex
@@ -88,6 +88,15 @@ they are. Therefore this manual presents different ways to solve problems.
Hopefully this is not too confusing. Numerous examples can be found in the other
manuals and test suite.
+The first version of \METAFUN\ evolved in \CONTEXT\ \MKII, and when we moved to
+\MKIV\ some interfaces (especially the extensions) could be made better. We now
+have \LMTX\ so we can make even those better (and often easier). The downside is
+that some features discussed here won't work in \MKII\ and \MKIV. If you run into
+that, just consider updating to \LMTX. The current version should process okay
+with the latest version; thanks to Otared Kavian for keeping an eye on that and
+posting me possible issues. The real new features are part of what is to become
+\LUAMETAFUN, but for that we have a separate manual.
+
\blank[big,samepage]
\startlines
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-layout.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-layout.tex
index 2be7e19ff3f..e81800bb43a 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-layout.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-layout.tex
@@ -327,9 +327,11 @@ is represented by a lioness. It is still unclear if they have a relationship,
but if so, and if a cub is born, may it enjoy \METAFUN.}
\stopbuffer
+\pushoverloadmode
\startquotation
\def\processwords#1{#1}\getbuffer[lions]
\stopquotation
+\popoverloadmode
The low level \CONTEXT\ macro \type {\processwords} provides a mechanism to treat
the individual words of its argument. The macro is called as follows:
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-lua.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-lua.tex
index 0794fc87919..e445cef53f9 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-lua.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-lua.tex
@@ -24,11 +24,17 @@ of a graphic from data but often it makes more sense to do the reverse. I finall
found time and reason to look into this and in the following sections I will
describe how it's done.
-\stopintro
+\blank
-\startsection[title=Introduction]
+{\bi The \LUA\ interface in \MKIV\ is way more limited than in \LMTX\ and new
+features will only show up in \LMTX, simply because the \METAPOST\ library in
+\LUAMETATEX\ is more powerful.}
-\stopsection
+\stopintro
+
+% \startsection[title=Introduction]
+%
+% \stopsection
\startsection[title=The basics]
@@ -232,7 +238,7 @@ helper is \type {mp.quoted}, as in:
\startbuffer
draw
- textext(lua("mp.quoted('@0.3f'," & decimal n & ")"))
+ textext(lua("mp.quoted('@0.3f'," & decimal 1.234 & ")"))
withcolor darkred ;
\stopbuffer
@@ -416,73 +422,73 @@ So in the end we can simplify the code that we started with to:
\stopsection
-\startsection[title=Access to variables]
-
-The question with such mechanisms is always: how far should we go. Although
-\METAPOST\ is a macro language it has properties of procedural languages. It also
-has more introspective features at the user end. For instance, one can loop over
-the resulting picture and manipulate it. This means that we don't need full
-access to \METAPOST\ internals. However, it makes sense to provide access to
-basic variables: \type {numeric}, \type {string}, and \type {boolean}.
-
-\startbuffer
-draw textext(lua("mp.quoted('@0.15f',mp.get.numeric('pi')-math.pi)"))
- ysized 1cm
- withcolor darkred ;
-\stopbuffer
-
-\typebuffer
-
-In double mode you will get zero printed but in scaled mode we definitely get a
-difference:
-
-\startlinecorrection[blank]
-\processMPbuffer
-\stoplinecorrection
-
-\startbuffer
-boolean b ; b := true ;
-draw textext(lua("mp.quoted(mp.get.boolean('b') and 'yes' or 'no')"))
- ysized 1cm
- withcolor darkred ;
-\stopbuffer
-
-In the next example we use \type {mp.quoted} to make sure that indeed we pass a
-string. The \type {textext} macro can deal with numbers but an unquoted \type
-{yes} or \type {no} is asking for problems.
-
-\typebuffer
-
-Especially when more text is involved it makes sense to predefine a helper in
-the \type {MP} namespace if only because \METAPOST\ (currently) doesn't like
-newlines in the middle of a string, so a \type {lua} call has to be on one line.
-
-\startlinecorrection[blank]
-\processMPbuffer
-\stoplinecorrection
-
-Here is an example where \LUA\ does something that would be close to impossible,
-especially if more complex text is involved.
-
-% \enabletrackers[metapost.lua]
-
-\startbuffer
-string s ; s := "ΤΕΧ" ; % "τεχ"
-draw textext(lua("mp.quoted(characters.lower(mp.get.string('s')))"))
- ysized 1cm
- withcolor darkred ;
-\stopbuffer
-
-\typebuffer
-
-As you can see here, the whole repertoire of helper functions can be used in
-a \METAFUN\ definition.
-
-\startlinecorrection[blank]
-\processMPbuffer
-\stoplinecorrection
-
-\stopsection
+% \startsection[title=Access to variables]
+%
+% The question with such mechanisms is always: how far should we go. Although
+% \METAPOST\ is a macro language it has properties of procedural languages. It also
+% has more introspective features at the user end. For instance, one can loop over
+% the resulting picture and manipulate it. This means that we don't need full
+% access to \METAPOST\ internals. However, it makes sense to provide access to
+% basic variables: \type {numeric}, \type {string}, and \type {boolean}.
+%
+% \startbuffer
+% draw textext(lua("mp.quoted('@0.15f',mp.get.numeric('pi')-math.pi)"))
+% ysized 1cm
+% withcolor darkred ;
+% \stopbuffer
+%
+% \typebuffer
+%
+% In double mode you will get zero printed but in scaled mode we definitely get a
+% difference:
+%
+% \startlinecorrection[blank]
+% \processMPbuffer
+% \stoplinecorrection
+%
+% \startbuffer
+% boolean b ; b := true ;
+% draw textext(lua("mp.quoted(mp.get.boolean('b') and 'yes' or 'no')"))
+% ysized 1cm
+% withcolor darkred ;
+% \stopbuffer
+%
+% In the next example we use \type {mp.quoted} to make sure that indeed we pass a
+% string. The \type {textext} macro can deal with numbers but an unquoted \type
+% {yes} or \type {no} is asking for problems.
+%
+% \typebuffer
+%
+% Especially when more text is involved it makes sense to predefine a helper in
+% the \type {MP} namespace if only because \METAPOST\ (currently) doesn't like
+% newlines in the middle of a string, so a \type {lua} call has to be on one line.
+%
+% \startlinecorrection[blank]
+% \processMPbuffer
+% \stoplinecorrection
+%
+% Here is an example where \LUA\ does something that would be close to impossible,
+% especially if more complex text is involved.
+%
+% % \enabletrackers[metapost.lua]
+%
+% \startbuffer
+% string s ; s := "ΤΕΧ" ; % "τεχ"
+% draw textext(lua("mp.quoted(characters.lower(mp.get.string('s')))"))
+% ysized 1cm
+% withcolor darkred ;
+% \stopbuffer
+%
+% \typebuffer
+%
+% As you can see here, the whole repertoire of helper functions can be used in
+% a \METAFUN\ definition.
+%
+% \startlinecorrection[blank]
+% \processMPbuffer
+% \stoplinecorrection
+%
+% \stopsection
\startsection[title=The library]
@@ -678,53 +684,53 @@ So this gives:
\startlinecorrection[blank] \getbuffer \stoplinecorrection
-A variant call is the following: \footnote {Getting that to work properly in the
-library was non||trivial as the loop variable \type {i} is an abstract nameless
-variable at the \METAPOST\ end. When investigating this Luigi Scarso and I found out
-that the internals of \METAPOST\ are not really geared for interfacing this way
-but in the end it worked out well.}
-
-\startbuffer
-\startMPcode
- for i=1 upto lua("mp.size(MP.myset)") :
- fill area
- lua("mp.path(MP.myset[mp.get.numeric('i')])")
- xysized (HSize,5ExHeight)
- withcolor basiccolors[i]/2
- withtransparency (2,.25) ;
- endfor ;
-\stopMPcode
-\stopbuffer
-
-\typebuffer
-
-The result is the same:
-
-\startlinecorrection[blank] \getbuffer \stoplinecorrection
-
-\startbuffer
-\startluacode
- MP.mypath = function(i)
- return mp.path(MP.myset[mp.get.numeric(i)])
- end
-\stopluacode
-\stopbuffer
-
-\typebuffer \getbuffer
-
-\startbuffer
-\startMPcode
- for i=1 upto lua("mp.size(MP.myset)") :
- fill area
- lua("MP.mypath('i')")
- xysized (HSize,5ExHeight)
- withcolor basiccolors[i]/2
- withtransparency (2,.25) ;
- endfor ;
-\stopMPcode
-\stopbuffer
-
-\typebuffer
+% A variant call is the following: \footnote {Getting that to work properly in the
+% library was non||trivial as the loop variable \type {i} is an abstract nameless
+% variable at the \METAPOST\ end. When investigating this Luigi Scarso and I found out
+% that the internals of \METAPOST\ are not really geared for interfacing this way
+% but in the end it worked out well.}
+%
+% \startbuffer
+% \startMPcode
+% for i=1 upto lua("mp.size(MP.myset)") :
+% fill area
+% lua("mp.path(MP.myset[mp.get.numeric('i')])")
+% xysized (HSize,5ExHeight)
+% withcolor basiccolors[i]/2
+% withtransparency (2,.25) ;
+% endfor ;
+% \stopMPcode
+% \stopbuffer
+%
+% \typebuffer
+%
+% The result is the same:
+%
+% \startlinecorrection[blank] \getbuffer \stoplinecorrection
+%
+% \startbuffer
+% \startluacode
+% MP.mypath = function(i)
+% return mp.path(MP.myset[mp.get.numeric(i)])
+% end
+% \stopluacode
+% \stopbuffer
+%
+% \typebuffer \getbuffer
+%
+% \startbuffer
+% \startMPcode
+% for i=1 upto lua("mp.size(MP.myset)") :
+% fill area
+% lua("MP.mypath('i')")
+% xysized (HSize,5ExHeight)
+% withcolor basiccolors[i]/2
+% withtransparency (2,.25) ;
+% endfor ;
+% \stopMPcode
+% \stopbuffer
+%
+% \typebuffer
This snippet of \METAPOST\ code still looks kind of horrible so how can we make
it look better? Here is an attempt, First we define a bit more \LUA:
@@ -1167,285 +1173,600 @@ the same name defined.
\stopsection
-\startsection[title=Large paths]
+\startsection[title=Accessing paths]
-The plugins (like those dealing with text) also use calls in the \type {mp}
-namespace but they have sort of protected names, starting with \type {mf_}. These
-are visible but not meant to be used by users. Not only can their name change,
-their functionality can as well.
+A path in \METAPOST\ is internally a linked list of knots and each knot has a
+coordinate and two control points. Access to specific points of very large path
+can be somewhat slow. First of all, the lookup start at the beginning and when
+you use fractions (say halfway between point 4 and 5) the engine has to find the
+spot. For this (and other reasons not mentioned here) we have a way to access
+paths different, using \LUA\ behind the scenes.
-The following are actually private as they have related macros but also have a
-public alias:
+\startbuffer
+path p ; p := fullcircle xysized (4cm,2cm) ;
+for i inpath p:
+ drawdot leftof i withpen pencircle scaled 2mm withcolor darkred ;
+ drawdot pointof i withpen pencircle scaled 3mm withcolor darkgreen ;
+ drawdot rightof i withpen pencircle scaled 2mm withcolor darkblue ;
+endfor ;
+draw for i inpath p:
+ pointof i .. controls (leftof i) and (rightof i) ..
+endfor cycle withpen pencircle scaled .5mm withcolor white ;
+
+p := p shifted (5cm,0) ;
+draw for i inpath p:
+ pointof i --
+endfor cycle withpen pencircle scaled .5mm withcolor .5white ;
+for i inpath p:
+ drawdot pointof i withpen pencircle scaled 3mm withcolor darkgreen ;
+endfor ;
+\stopbuffer
-\startlines
-lua.mp.pathlength(name)
-lua.mp.pathpoint(i)
-lua.mp.pathleft(i)
-lua.mp.pathright(i)
-lua.mp.pathreset()
-\stoplines
+\typebuffer
-They are meant for special high|-|performance path access, for example:
+Here we access the main coordinate and the two control points. The last draw is of course
+just mimicking drawing the path.
-\startlinecorrection
-\startMPcode
- save p, q, r;
- path p ; p := for i=1 upto 1000 :
- (i,0) -- (i,4 + uniformdeviate 4) --
- endfor cycle ;
- fill p xysized (TextWidth,20mm) withcolor red ;
-
- path q ; q := for i=1 upto lua.mp.pathlength("p") :
- if (i mod 4) == 0 : lua.mp.pathpoint(i) -- fi
- endfor cycle ;
- fill q xysized (TextWidth,2cm) shifted (0,-45mm) withcolor green ;
-
- path r ; r := for i inpath p :
- if not odd (i) : pointof i -- fi
- endfor cycle ;
- fill r xysized (TextWidth,2cm) shifted (0,-70mm) withcolor blue ;
-\stopMPcode
+\startlinecorrection[blank]
+\processMPbuffer
\stoplinecorrection
-Because a lookup of a point in \METAPOST\ is a linear lookup over a linked list
-for very large paths the gain is significant when using \LUA\ because there the
-points are stored in an indexed table. The left and right points can be used
-vebose like
+\stopsection
-\starttyping
-lua.mp.pathpoint(i) controls lua.mp.pathleft(i) and lua.mp.pathright(i)
-\stoptyping
+\startsection[title=Acessing \TEX]
-or more terse:
+In \MKIV\ and \LMTX\ it is possible to access \TEX\ registers and macros from the
+\METAPOST\ end. Let's first define and set some:
-\starttyping
-pointof i controls leftof i and rightof i
-\stoptyping
+\startbuffer
+\newdimen\MyMetaDimen \MyMetaDimen = 2mm
+\newcount\MyMetaCount \MyMetaCount = 10
+\newtoks \MyMetaToks \MyMetaToks = {\bfd \TeX}
+ \def\MyMetaMacro {not done}
+\stopbuffer
-Beware: this kind of trickery is {\em only} needed when you have very large paths
-that are to be manipulated and the. Otherwise it's overkill.
+\typebuffer \getbuffer
-\stopsection
+\startbuffer
+\startMPcode
+ for i=1 upto getcount("MyMetaCount") :
+ draw fullcircle scaled (i * getdimen("MyMetaDimen")) ;
+ endfor ;
+ draw textext(gettoks("MyMetaToks")) xsized 15mm withcolor darkred ;
+ setglobaldimen("MyMetaDimen", bbwidth(currentpicture)) ;
+ setglobalmacro("MyMetaMacro", "done") ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer
-\startsection[title={Interfacing to \TEX}]
+\startlinecorrection[blank]
+ \getbuffer
+\stoplinecorrection
-The next bunch of calls is for accessing \TEX\ registers. You can set their
-values and get them as well.
+We can now look at the two updated globals where \type {\MyMetaMacro: \the\MyMetaDimen}
+typesets: {\tttf \MyMetaMacro: \the\MyMetaDimen}. As demonstrated you can best define your
+own registers but in principle you can also access system ones, like \type {\scratchdimen}
+and friends.
-\starttyping
-lua.mp.getmacro(k)
-lua.mp.getdimen(k)
-lua.mp.getcount(k)
-lua.mp.gettoks (k)
-
-lua.mp.setmacro(k,v)
-lua.mp.setdimen(k,v)
-lua.mp.setcount(k,v)
-lua.mp.settoks (k,v)
-\stoptyping
+\stopsection
+
+\startsection[title=Abstraction]
-When you mess around with variables and run into issues it might help to
-report values on the console. The \type {report} function does this:
+We will now stepwise implement some simple helpers for accessing data in files.
+The examples are kind of useless but demonstrate how interfaces evolved. The
+basic command to communicate with \LUA\ is \type {runscript}. In this example
+we will load a (huge) file and run over the lines.
\starttyping
-lua.mp.report(a,b)
+\startMPcode{doublefun}
+ save q ; string q ; q := "'\\" & ditto & "'" ;
+ runscript (
+ "GlobalData = string.splitlines(io.loaddata('foo.tmp')) return ''"
+ ) ;
+ numeric l ; l = runscript (
+ "return string.format('\letterpercent q',\letterhash GlobalData)"
+ );
+ for i=1 step 1 until l :
+ l := length ( runscript (
+ "return string.format('\letterpercent q',GlobalData[" & decimal i & "])"
+ ) ) ;
+ endfor ;
+ draw textext(decimal l);
+\stopMPcode
\stoptyping
-\startlinecorrection
-\startMPcode
-lua.mp.report("status","a circle") ;
-fill fullcircle xyscaled (2cm,1cm) withcolor red ;
-lua.mp.report("status","its boundingbox [@N,@N,@N,@N]",
- xpart llcorner currentpicture, ypart llcorner currentpicture,
- xpart urcorner currentpicture, ypart urcorner currentpicture
-) ;
-draw boundingbox currentpicture withcolor blue ;
-report("status","the size: @Nbp x @Nbp",
- bbwidth(currentpicture), bbheight(currentpicture)
-) ;
-message("done") ;
-\stopMPcode
-\stoplinecorrection
+The \type {runscript} primitive takes a string and should return a string (in
+\LUAMETATEX\ you can also return nothing). This low level solution will serve as
+our benchmark: it takes 2.04 seconds on the rather large (64MB) test file with
+10.000 lines.
-The console shows:
+The code looks somewhat clumsy. This is because in \METAPOST\ escaping is not
+built in so one has to append a double quote character using \type {char 34} and
+the \type {ditto} string is defined as such. This mess is why in \CONTEXT\ we
+have an interface:
\starttyping
-metapost > status : a circle
-metapost > status : its boundingbox [-28.34645,-14.17323,28.34645,14.17323]
-metapost > status : the size: 57.1929bp x 28.84647bp
-metapost > message : done
+\startMPcode{doublefun}
+ lua("GlobalData = string.splitlines(io.loaddata('foo.tmp'))") ;
+ numeric l ;
+ for i=1 step 1 until lua("mp.print(\#GlobalData)") :
+ l := length(lua("mp.quoted(GlobalData[" & decimal i & "])")) ;
+ endfor ;
+ draw textext(decimal l);
+\stopMPcode
\stoptyping
-There are two more getters. These can be used to access the specific graphic
-related variables set at the \TEX\ end.
+As expected we pay a price for the additional overhead, so this time we need 2.28
+seconds to process the file. The return value of a run is a string that is fed
+into \type {scantokens}. Here \type {print} function prints the number as string
+and that gets scanned back to a number. The \type {quoted} function returns a
+string in a string so when we're back in \METAPOST\ that gets scanned as string.
+
+When code is used more frequently, we can make a small library, like this:
\starttyping
-mp.texvar(name)
-mp.texstr(name)
+\startluacode
+ local MyData = { }
+ function mp.LoadMyData(filename)
+ MyData = string.splitlines(io.loaddata(filename))
+ end
+ local mpprint = mp.print
+ local mpquoted = mp.quoted
+ function mp.MyDataSize()
+ mpprint(#MyData)
+ end
+ function mp.MyDataString(i)
+ mpquoted(MyData[i] or "")
+ end
+\stopluacode
\stoptyping
-If you have adaptive styles you might want to test for modes.
+It is not that hard to imagine a more advanced mechanisms where data from multiple
+files can be handled at the same time. This code is used as:
\starttyping
-if lua.mp.mode("screen") : % or processingmode
- % some action only needed for screen documents
-fi ;
-if lua.mp.systemmode("first") :
- % some action for the first run
-fi ;
+\startMPcode{doublefun}
+ lua.mp.LoadMyData("foo.tmp") ;
+ numeric l ;
+ for i=1 step 1 until lua.mp.MyDataSize() :
+ l := length(lua.mp.MyDataString(i)) ;
+ endfor ;
+ draw textext(decimal l);
+\stopMPcode
\stoptyping
-For convenience these are wrapped into macros:
+The \type {mp} namespace at the \LUA\ end is a subnamespace at the \METAPOST\
+end. This solution needs 2.20 seconds so we're still slower than the first one,
+but in \LUAMETATEX\ with \LMTX we can do better. First the \LUA\ code:
\starttyping
-if texmode("screen") :
- % some action only needed for screen documents
-fi ;
-if systemmode("first") :
- % some action for the first run
-fi ;
+\startluacode
+ local injectnumeric = mp.inject.numeric
+ local injectstring = mp.inject.string
+ local MyData = { }
+ function mp.LoadMyData(filename)
+ MyData = string.splitlines(io.loaddata(filename))
+ end
+ function mp.MyDataSize()
+ injectnumeric(#MyData)
+ end
+ function mp.MyDataString(i)
+ injectstring(MyData[i] or "")
+ end
+\stopluacode
\stoptyping
-When you implement your own helpers you can fall back on some auxiliary functions
-in the \type {mp} namespace. Actually these are collected in \type {mp.aux} and
-thereby protected from being overwritten by mistake. Here they are:
-
-% mp.flush()
-% mp.size(t)
-
-\stopsection
-
-\startsection[title={Interfacing to \METAPOST}]
-
-There is also experimental access to some of the \METAPOST\ internals. In order
-to deal with (large) paths a few more iterator related helpers are provided too.
-
-% mp.set (numeric string path boolean)
+This time we use injectors. The mentioned \type {print} helpers serialize data so
+numbers, pairs, colors etc are converted to a string that represents them that is
+fed back to \METAPOST\ after the snippet is run. Multiple prints are collected
+into one string. An injecter follows a more direct route: it pushes back a proper
+\METAPOST\ data type.
\starttyping
-n = mp.getnumeric(name)
-s = mp.getstring(name)
-b = mp.getboolean(name)
-p = mp.getpath(name)
+\startMPcode{doublefun}
+ lua.mp.LoadMyData("foo.tmp") ;
+ numeric l ;
+ for i=1 step 1 until lua.mp.MyDataSize() :
+ l := length(lua.mp.MyDataString(i)) ;
+ endfor ;
+ draw textext(decimal l);
+\stopMPcode
\stoptyping
-A is path a table of tables that have six values: the coordinates and the
-pre- and postcontrol. You can manipulate this table and feed it back into
-\METAPOST.
+This usage brings us down to 1.14 seconds, so we're still not good. The next
+variant is performing similar: 1.05 seconds.
-\startlinecorrection
-\startMPcode
-numeric n ; n := lua.mp.newhash() ;
-
-for i=1 upto 3 :
- lua.mp.tohash(n,i) ;
-endfor ;
-
-fill fullcircle scaled 10mm withcolor
- if lua.mp.inhash(n,3) : green else : red fi ;
-
-fill fullcircle scaled 5mm withcolor
- if lua.mp.inhash(n,4) : green else : red fi ;
-
-lua.mp.disposehash(n)
+\starttyping
+\startMPcode{doublefun}
+ runscript("mp.LoadMyData('foo.tmp')") ;
+ numeric l ;
+ for i=1 step 1 until runscript("mp.MyDataSize()") :
+ l := length(runscript("mp.MyDataString(" & decimal i & ")")) ;
+ endfor ;
+ draw textext(decimal l);
\stopMPcode
-\stoplinecorrection
+\stoptyping
-You can also store values with keys and access them later:
+We will now delegate scanning to the \LUA\ end.
-\startlinecorrection
-\startMPcode
-numeric n ; n := lua.mp.newhash() ;
-
-for i=1 upto 3 :
- lua.mp.tohash(n,i,decimal sqrt(i)) ;
-endfor ;
+\starttyping
+\startluacode
+ local injectnumeric = mp.inject.numeric
+ local injectstring = mp.inject.string
+ local scannumeric = mp.scan.numeric
+ local scanstring = mp.scan.string
+ local MyData = { }
+ function mp.LoadMyData()
+ MyData = string.splitlines(io.loaddata(scanstring()))
+ end
+ function mp.MyDataSize()
+ injectnumeric(#MyData)
+ end
+ function mp.MyDataString()
+ injectstring(MyData[scannumeric()] or "")
+ end
+\stopluacode
+\stoptyping
-draw textext(lua.mp.fromhash(n,3))
- ysized 1cm
- withcolor blue ;
+This time we are faster than the clumsy code we started with: 0.87 seconds.
-lua.mp.disposehash(n)
+\starttyping
+\startMPcode{doublefun}
+ runscript("mp.LoadMyData()") "foo.tmp" ;
+ numeric l ;
+ for i=1 step 1 until runscript("mp.MyDataSize()") :
+ l := length(runscript("mp.MyDataString()") i) ;
+ endfor ;
+ draw textext(decimal l);
\stopMPcode
-\stoplinecorrection
-
-You can also name your own hash:
+\stoptyping
-\startlinecorrection
-\startMPcode
-lua.mp.newhash("foo") ;
+In \LMTX\ we can add some more abstraction. Performance is about the same and
+sometimes a bit faster but that depends on extreme usage: you need thousands of
+call to notice.
-for i=1 upto 3 :
- lua.mp.tohash("foo",i,decimal sqrt(i)) ;
-endfor ;
+\starttyping
+\startluacode
+ local injectnumeric = mp.inject.numeric
+ local injectstring = mp.inject.string
+ local scannumeric = mp.scan.numeric
+ local scanstring = mp.scan.string
+ local MyData = { }
+ metapost.registerscript("LoadMyData", function()
+ MyData = string.splitlines(io.loaddata(scanstring()))
+ end)
+ metapost.registerscript("MyDataSize", function()
+ injectnumeric(#MyData)
+ end)
+ metapost.registerscript("MyDataString", function()
+ injectstring(MyData[scannumeric()] or "")
+ end)
+\stopluacode
+\stoptyping
-draw textext(lua.mp.fromhash("foo",2))
- ysized 1cm
- withcolor green ;
+We have the same scripts but we register them. At the \METAPOST\ end we resolve
+the registered scripts and then call \type {runscript} with the (abstract) numeric
+value:
-lua.mp.disposehash("foo")
+\starttyping
+\startMPcode{doublefun}
+ newscriptindex my_script_LoadMyData ;
+ newscriptindex my_script_MyDataSize ;
+ newscriptindex my_script_MyDataString ;
+
+ my_script_LoadMyData := scriptindex "LoadMyData" ;
+ my_script_MyDataSize := scriptindex "MyDataSize" ;
+ my_script_MyDataString := scriptindex "MyDataString" ;
+
+ runscript my_script_LoadMyData "foo.tmp" ;
+ numeric l ;
+ for i=1 step 1 until runscript my_script_MyDataSize :
+ l := length(my_script_MyDataString i) ;
+ endfor ;
+ draw textext(decimal l);
\stopMPcode
-\stoplinecorrection
+\stoptyping
-Although it might look like \METAPOST\ supports arrays the reality is that it
-doesn't really. There is a concept of suffixes but internally these are just a
-way to compose macros. The following test is one that is used in one of the
-\METAFUN\ modules written by Alan Braslau.
+This is of course nicer:
-\startlinecorrection
-\startMPcode
-path p, q[] ;
-
-if lua.mp.isarray(str q[1]) :
- fill fullcircle scaled 1cm withcolor red ;
- draw textext(lua.mp.prefix(str q[1])) withcolor white;
-else :
- fill fullsquare scaled 1cm withcolor blue ;
-fi ;
-
-currentpicture := currentpicture shifted (-2cm,0) ;
-
-if lua.mp.isarray(str p) :
- fill fullcircle scaled 1cm withcolor red ;
-else :
- fill fullsquare scaled 1cm withcolor blue ;
-fi ;
+\starttyping
+\startMPcode{doublefun}
+ def LoadMyData (expr s) = runscript my_script_LoadMyData s enddef ;
+ def MyDataSize = runscript my_script_MyDataSize enddef ;
+ def MyDataString(expr i) = runscript my_script_MyDataString i enddef ;
+
+ LoadMyData("foo.tmp") ;
+ numeric l ;
+ for i=1 step 1 until MyDataSize :
+ l := length(MyDataString(i)) ;
+ endfor ;
+ draw textext(decimal l);
\stopMPcode
-\stoplinecorrection
+\stoptyping
-Another helper relates to extensions that \METAFUN\ adds to \METAPOST. When you
-iterate over a picture you can recognize these as objects. The next code shows
-the \LUA\ call as well as the more convenient macro call. So, \type {textext}
-clearly is a foreign object.
+So, to sumarize, there are many ways to look at this: verbose direct ones
+but also nicely abstract ones.
-\startlinecorrection
-\startMPcode
-picture p ; p := image (
- fill fullcircle scaled 1cm withcolor red ;
- draw textext("ok") withcolor white ;
-) ;
-
-for i within p :
- if not picture i :
- draw i ysized 4cm ;
- elseif isobject i :
- draw i xsized 3cm ;
- else :
- draw i ysized 4cm ;
- fi ;
-endfor ;
+\stopsection
-currentpicture := currentpicture shifted (-6cm,0) ;
+% The plugins (like those dealing with text) also use calls in the \type {mp}
+% namespace but they have sort of protected names, starting with \type {mf_}. These
+% are visible but not meant to be used by users. Not only can their name change,
+% their functionality can as well.
+%
+% The following are actually private as they have related macros but also have a
+% public alias:
+%
+% \startlines
+% lua.mp.pathlength(name)
+% lua.mp.pathpoint(i)
+% lua.mp.pathleft(i)
+% lua.mp.pathright(i)
+% lua.mp.pathreset()
+% \stoplines
+%
+% They are meant for special high|-|performance path access, for example:
+%
+% \startlinecorrection
+% \startMPcode
+% save p, q, r;
+% path p ; p := for i=1 upto 1000 :
+% (i,0) -- (i,4 + uniformdeviate 4) --
+% endfor cycle ;
+% fill p xysized (TextWidth,20mm) withcolor red ;
+%
+% path q ; q := for i=1 upto lua.mp.pathlength("p") :
+% if (i mod 4) == 0 : lua.mp.pathpoint(i) -- fi
+% endfor cycle ;
+% fill q xysized (TextWidth,2cm) shifted (0,-45mm) withcolor green ;
+%
+% path r ; r := for i inpath p :
+% if not odd (i) : pointof i -- fi
+% endfor cycle ;
+% fill r xysized (TextWidth,2cm) shifted (0,-70mm) withcolor blue ;
+% \stopMPcode
+% \stoplinecorrection
+%
+% Because a lookup of a point in \METAPOST\ is a linear lookup over a linked list
+% for very large paths the gain is significant when using \LUA\ because there the
+% points are stored in an indexed table. The left and right points can be used
+% vebose like
+%
+% \starttyping
+% lua.mp.pathpoint(i) controls lua.mp.pathleft(i) and lua.mp.pathright(i)
+% \stoptyping
+%
+% or more terse:
+%
+% \starttyping
+% pointof i controls leftof i and rightof i
+% \stoptyping
+%
+% Beware: this kind of trickery is {\em only} needed when you have very large paths
+% that are to be manipulated and the. Otherwise it's overkill.
+%
+% \stopsection
+%
+% \startsection[title={Interfacing to \TEX}]
+%
+% The next bunch of calls is for accessing \TEX\ registers. You can set their
+% values and get them as well.
+%
+% \starttyping
+% lua.mp.getmacro(k)
+% lua.mp.getdimen(k)
+% lua.mp.getcount(k)
+% lua.mp.gettoks (k)
+%
+% lua.mp.setmacro(k,v)
+% lua.mp.setdimen(k,v)
+% lua.mp.setcount(k,v)
+% lua.mp.settoks (k,v)
+% \stoptyping
+%
+% When you mess around with variables and run into issues it might help to
+% report values on the console. The \type {report} function does this:
+%
+% \starttyping
+% lua.mp.report(a,b)
+% \stoptyping
+%
+% \startlinecorrection
+% \startMPcode
+% lua.mp.report("status","a circle") ;
+% fill fullcircle xyscaled (2cm,1cm) withcolor red ;
+% lua.mp.report("status","its boundingbox [@N,@N,@N,@N]",
+% xpart llcorner currentpicture, ypart llcorner currentpicture,
+% xpart urcorner currentpicture, ypart urcorner currentpicture
+% ) ;
+% draw boundingbox currentpicture withcolor blue ;
+% report("status","the size: @Nbp x @Nbp",
+% bbwidth(currentpicture), bbheight(currentpicture)
+% ) ;
+% message("done") ;
+% \stopMPcode
+% \stoplinecorrection
+%
+% The console shows:
+%
+% \starttyping
+% metapost > status : a circle
+% metapost > status : its boundingbox [-28.34645,-14.17323,28.34645,14.17323]
+% metapost > status : the size: 57.1929bp x 28.84647bp
+% metapost > message : done
+% \stoptyping
+%
+% There are two more getters. These can be used to access the specific graphic
+% related variables set at the \TEX\ end.
+%
+% \starttyping
+% mp.texvar(name)
+% mp.texstr(name)
+% \stoptyping
+%
+% If you have adaptive styles you might want to test for modes.
+%
+% \starttyping
+% if lua.mp.mode("screen") : % or processingmode
+% % some action only needed for screen documents
+% fi ;
+% if lua.mp.systemmode("first") :
+% % some action for the first run
+% fi ;
+% \stoptyping
+%
+% For convenience these are wrapped into macros:
+%
+% \starttyping
+% if texmode("screen") :
+% % some action only needed for screen documents
+% fi ;
+% if systemmode("first") :
+% % some action for the first run
+% fi ;
+% \stoptyping
+%
+% When you implement your own helpers you can fall back on some auxiliary functions
+% in the \type {mp} namespace. Actually these are collected in \type {mp.aux} and
+% thereby protected from being overwritten by mistake. Here they are:
+%
+% % mp.flush()
+% % mp.size(t)
+%
+% \stopsection
-for i within p :
- if isobject(i) :
- draw i xsized 5cm ;
- else :
- draw i ysized 3cm withcolor blue;
- fi ;
-endfor ;
-\stopMPcode
-\stoplinecorrection
+% \startsection[title={Interfacing to \METAPOST}]
+%
+% There is also experimental access to some of the \METAPOST\ internals. In order
+% to deal with (large) paths a few more iterator related helpers are provided too.
+%
+% % mp.set (numeric string path boolean)
+%
+% \starttyping
+% n = mp.getnumeric(name)
+% s = mp.getstring(name)
+% b = mp.getboolean(name)
+% p = mp.getpath(name)
+% \stoptyping
+%
+% A is path a table of tables that have six values: the coordinates and the
+% pre- and postcontrol. You can manipulate this table and feed it back into
+% \METAPOST.
+%
+% \startlinecorrection
+% \startMPcode
+% numeric n ; n := lua.mp.newhash() ;
+%
+% for i=1 upto 3 :
+% lua.mp.tohash(n,i) ;
+% endfor ;
+%
+% fill fullcircle scaled 10mm withcolor
+% if lua.mp.inhash(n,3) : green else : red fi ;
+%
+% fill fullcircle scaled 5mm withcolor
+% if lua.mp.inhash(n,4) : green else : red fi ;
+%
+% lua.mp.disposehash(n)
+% \stopMPcode
+% \stoplinecorrection
+%
+% You can also store values with keys and access them later:
+%
+% \startlinecorrection
+% \startMPcode
+% numeric n ; n := lua.mp.newhash() ;
+%
+% for i=1 upto 3 :
+% lua.mp.tohash(n,i,decimal sqrt(i)) ;
+% endfor ;
+%
+% draw textext(lua.mp.fromhash(n,3))
+% ysized 1cm
+% withcolor blue ;
+%
+% lua.mp.disposehash(n)
+% \stopMPcode
+% \stoplinecorrection
+%
+% You can also name your own hash:
+%
+% \startlinecorrection
+% \startMPcode
+% lua.mp.newhash("foo") ;
+%
+% for i=1 upto 3 :
+% lua.mp.tohash("foo",i,decimal sqrt(i)) ;
+% endfor ;
+%
+% draw textext(lua.mp.fromhash("foo",2))
+% ysized 1cm
+% withcolor green ;
+%
+% lua.mp.disposehash("foo")
+% \stopMPcode
+% \stoplinecorrection
+%
+% Although it might look like \METAPOST\ supports arrays the reality is that it
+% doesn't really. There is a concept of suffixes but internally these are just a
+% way to compose macros. The following test is one that is used in one of the
+% \METAFUN\ modules written by Alan Braslau.
+%
+% \startlinecorrection
+% \startMPcode
+% path p, q[] ;
+%
+% if lua.mp.isarray(str q[1]) :
+% fill fullcircle scaled 1cm withcolor red ;
+% draw textext(lua.mp.prefix(str q[1])) withcolor white;
+% else :
+% fill fullsquare scaled 1cm withcolor blue ;
+% fi ;
+%
+% currentpicture := currentpicture shifted (-2cm,0) ;
+%
+% if lua.mp.isarray(str p) :
+% fill fullcircle scaled 1cm withcolor red ;
+% else :
+% fill fullsquare scaled 1cm withcolor blue ;
+% fi ;
+% \stopMPcode
+% \stoplinecorrection
+%
+% Another helper relates to extensions that \METAFUN\ adds to \METAPOST. When you
+% iterate over a picture you can recognize these as objects. The next code shows
+% the \LUA\ call as well as the more convenient macro call. So, \type {textext}
+% clearly is a foreign object.
+%
+% \startlinecorrection
+% \startMPcode
+% picture p ; p := image (
+% fill fullcircle scaled 1cm withcolor red ;
+% draw textext("ok") withcolor white ;
+% ) ;
+%
+% for i within p :
+% if not picture i :
+% draw i ysized 4cm ;
+% elseif isobject i :
+% draw i xsized 3cm ;
+% else :
+% draw i ysized 4cm ;
+% fi ;
+% endfor ;
+%
+% currentpicture := currentpicture shifted (-6cm,0) ;
+%
+% for i within p :
+% if isobject(i) :
+% draw i xsized 5cm ;
+% else :
+% draw i ysized 3cm withcolor blue;
+% fi ;
+% endfor ;
+% \stopMPcode
+% \stoplinecorrection
% not yet, still experimental:
%
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-macros.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-macros.tex
index e1df13c92ac..969e7d1b169 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-macros.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-macros.tex
@@ -31,12 +31,13 @@ There are several ways to use the power of \METAFUN, either or not using
\stopitem
\startitem
- You can embed the graphic in a \type {\startMPpage} construct and process it
- with \CONTEXT\ \MKIV. In that case you have the full \METAFUN\ functionality
- available. If for some reason you still want to use \MKII, you need to use
- \TEXEXEC\ as before processing the file, it will do a couple of checks on the
- file. It will also make sure that the temporary files (\type {mpt} for \type
- {textext}'s and \type {mpo} for outline fonts) are taken care of too.
+ You can embed the graphic in a \type {\startMPpage} \unknown \type
+ {\stopMPpage} construct and process it with \CONTEXT\ \MKIV. In that case you
+ have the full \METAFUN\ functionality available. If for some reason you still
+ want to use \MKII, you need to use \TEXEXEC\ as before processing the file,
+ it will do a couple of checks on the file. It will also make sure that the
+ temporary files (\type {mpt} for \type {textext}'s and \type {mpo} for
+ outline fonts) are taken care of too.
\stopitem
\startitem
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-reference.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-reference.tex
index 6eb177949be..bc59218b0cc 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-reference.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-reference.tex
@@ -476,7 +476,7 @@ defineshade cshade withshademethod "circular" ;
\ShowSampleJ {mm} {pencircle transform} {pencircle}
\ShowSampleJ {mm} {pensquare transform} {pensquare}
\ShowSampleJ {mm} {penrazor transform} {penrazor}
-\ShowSampleK {mm} {penspeck transform} {penspeck}
+\ShowSampleK {mm} {penspec transform} {penspec}
\ShowSampleL {mm} {draw} {fullcircle}
\ShowSampleL {mm} {fill} {fullcircle}
@@ -610,7 +610,7 @@ defineshade cshade withshademethod "circular" ;
\ShowSampleS {fm}
{externalfigure string ...}
- {draw externalfigure "mycow.pdf" scaled 3cm}
+ {draw externalfigure "mycow.pdf" ysized 3cm}
\ShowSampleT {fm} {addbackground text}
{addbackground withcolor .625 yellow}
@@ -637,11 +637,28 @@ defineshade cshade withshademethod "circular" ;
\ShowSampleT {mm}
{withmask string}
- {draw externalfigure "m-1.png" scaled 2cm withmask "m-2.png"}
+ {draw externalfigure "m-1.png" ysized 2cm withmask "m-2.png"}
{Scale := 1 ;
- draw externalfigure "m-2.png" scaled 2cm shifted (-3cm,0) ;
- draw externalfigure "m-1.png" scaled 2cm shifted (-6cm,0) ;
- draw externalfigure "m-1.png" scaled 2cm withmask "m-2.png"}
+ draw externalfigure "m-2.png" ysized 2cm shifted (-3cm,0) ;
+ draw externalfigure "m-1.png" ysized 2cm shifted (-6cm,0) ;
+ draw externalfigure "m-1.png" ysized 2cm withmask "m-2.png"}
+
+\stopsection
+
+\startsection[title={Access}]
+
+\ShowSampleW
+ {mm} {leftof n}
+ {for i inpath fullcircle : drawdot leftof i ; endfor}
+ {for i inpath fullcircle xsized 3cm: drawdot leftof i withpen pencircle scaled 2mm InRed ; endfor}
+\ShowSampleW
+ {mm} {pointof n}
+ {for i inpath fullcircle : drawdot pointof i ; endfor}
+ {for i inpath fullcircle xsized 3cm: drawdot pointof i withpen pencircle scaled 2mm InYellow ; endfor}
+\ShowSampleW
+ {mm} {rightof n}
+ {for i inpath fullcircle : drawdot rightof i ; endfor}
+ {for i inpath fullcircle xsized 3cm: drawdot rightof i withpen pencircle scaled 2mm InRed ; endfor}
\stopsection
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex
index 02c502cf01c..56bf5d4d61e 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex
@@ -22,12 +22,12 @@ undefined or special variables. Consider the following:
\starttyping
vardef foo@#(text t) =
- save s ; string s ; s := str @# ;
- if length(s) > 0 :
- textext(s)
- else :
- nullpicture
- fi
+ save s ; string s ; s := str @# ;
+ if length(s) > 0 :
+ textext(s)
+ else :
+ nullpicture
+ fi
enddef ;
\stoptyping
@@ -41,7 +41,7 @@ But if afterwards we say:
\starttyping
vardef bar(expr x) =
- 123
+ 123
enddef ;
\stoptyping
@@ -55,6 +55,141 @@ to store their meanings and allocate new ones after that inside the group.
\stopsection
+\startsection[title=Templates]
+
+This section is a bit off|-|topic and thereby also qualifies as sneaky. At the
+\TEX\ end we have a couple of alternative input methods, like \XML\ and templates.
+Just because we want to be consistent, the \METAPOST\ end also offers this.
+
+The first example resembled the \type{btex ... etex} approach:
+
+\startbuffer
+\startbuffer[test-a]
+ blua for i=0,100,20 do elua
+ draw fullcircle scaled (blua p(i) elua * cm)
+ withcolor "darkgreen" withpen pencircle scaled 1cm ;
+ blua end elua
+
+ blua for i=10,100,20 do elua
+ draw fullcircle scaled (blua p(i) elua * cm)
+ withcolor "darkred" withpen pencircle scaled 1cm ;
+ blua end elua
+\stopbuffer
+
+\startMPcode
+ draw image (
+ loadfile ("mpstemplate://buffer?name=test-a") ;
+ ) ysized 3cm ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer[test-1][option=TEX]
+
+The filename is specified as a \URI\ and the \type {mpstemplate} does the magic
+here.
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+The second example is like the \type {lmx} files that you can find in the distibution:
+
+\startbuffer
+\startbuffer[test-b]
+ <?lua for i=0,100,20 do ?>
+ draw fullcircle scaled (<?lua p(i) ?> * cm)
+ withcolor "darkblue" withpen pencircle scaled 1cm ;
+ <?lua end ?>
+
+ <?lua for i=10,100,20 do ?>
+ draw fullcircle scaled (<?lua p(i) ?> * cm)
+ withcolor "darkyellow" withpen pencircle scaled 1cm ;
+ <?lua end ?>
+\stopbuffer
+
+\startMPcode
+ draw image (
+ loadfile ("mpstemplate://buffer?name=test-b") ;
+ ) ysized 3cm ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer[test-b][option=TEX]
+
+The filename is again specified as a \URI:
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\startbuffer
+\startMPcode
+ picture p[] ; % we can't input nested
+ loadfile("mpstemplate://buffer?name=test-a&method=metapost") ;
+ p[1] := currentpicture ; currentpicture := nullpicture ;
+ loadfile("mpstemplate://buffer?name=test-b&method=xml") ;
+ p[2] := currentpicture ; currentpicture := nullpicture ;
+ draw p[1] ysized 3cm ;
+ draw p[2] ysized 4cm shifted (4cm,0) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer[option=TEX]
+
+The combination comes out as:
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+Another approach is to load as image, which saves some typing:
+
+\startbuffer
+\startMPpage[offset=10pt]
+ draw image (loadfile("mpstemplate://buffer?name=test-a&method=metapost"))
+ xsized 2cm shifted ( 3cm,0) ;
+ draw image (loadfile("mpstemplate://buffer?name=test-b&method=xml"))
+ xsized 2cm shifted ( 6cm,0) ;
+ draw loadimage ("mpstemplate://buffer?name=test-a&method=metapost")
+ xsized 2cm shifted ( 9cm,0) ;
+ draw loadimage ("mpstemplate://buffer?name=test-b&method=xml")
+ xsized 2cm shifted (12cm,0) ;
+\stopMPpage
+\stopbuffer
+
+\typebuffer[option=TEX]
+
+The result is predictable:
+
+\startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+Of course there is also a \type {cld} approach possible:
+
+\startbuffer
+\startluacode
+ context.startMPcode() -- context.startMPpage { offset = "10pt" }
+ for i=0,100,20 do
+ context ( [[draw fullcircle scaled (%s * cm)
+ withcolor "darkmagenta" withpen pencircle scaled 1cm ;]], i)
+ end
+ for i=10,100,20 do
+ context ( [[draw fullcircle scaled (%s * cm)
+ withcolor "darkcyan" withpen pencircle scaled 1cm ;]], i)
+ end
+ context.stopMPcode() -- context.stoppage()
+\stopluacode
+\stopbuffer
+
+\typebuffer[option=TEX]
+
+The commented commands will create a page. This is a convenient way to make
+graphics that can be used in other documents (programs). For practical reasons the
+example is scaled down:
+
+\startlinecorrection[blank] \scale[height=3cm]{\getbuffer} \stoplinecorrection
+
+All these methods are rather efficient because all happens in memory and without
+intermediate runs. It is this kind of features that the tight integration of \TEX,
+\METAPOST\ and \LUA\ make possible.
+
+\stoptext
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-styles.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-styles.tex
index f82359117a7..6de9a54daa2 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-styles.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-styles.tex
@@ -189,14 +189,14 @@ what lines we need in order to be calculate the button shapes.
\placefigure
[here][fig:style]
{The lines used to calculate the button shapes.}
- {\externalfigure[mfun-774.pdf][page=1,height=.85\textheight]}
+ {\typesetfile[mfun-774.tex][page=1,height=.85\textheight]}
\stopmode
\startnotmode[screen]
\placefigure
[here][fig:style]
{The auxiliary lines used to calculate the button shapes.}
- {\rotate{\externalfigure[mfun-774.pdf][page=1,height=\textwidth]}}
+ {\rotate{\typesetfile[mfun-774.tex][page=1,height=\textwidth]}}
\stopnotmode
\page
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text-lmtx.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text-lmtx.tex
new file mode 100644
index 00000000000..abdca3c3ad0
--- /dev/null
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text-lmtx.tex
@@ -0,0 +1,1519 @@
+% language=uk
+%
+% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
+
+\startcomponent metafun-text
+
+\environment metafun-environment
+
+\startchapter[reference=sec:typesetting,title={Typesetting in \METAPOST}]
+
+\startintro
+
+It is said that a picture tells more than a thousand words. So you might expect
+that text in graphics becomes superfluous. Out of experience we can tell you that
+this is not the case. In this chapter we explore the ways to add text to
+\METAPOST\ graphics, and let you choose whether or not to have it typeset by
+\TEX.
+
+\stopintro
+
+\startsection[title={The process}]
+
+\index{text}
+
+The \METAPOST\ program is about graphics, not about text. Its ancestor was made
+for creating fonts and in order to do so, it actually had some limited
+capabilities to add text to a graphic, like coordinates to points. Now, when
+you really want to add typeset text, we need something more. The traditional way
+to add some text to a \METAPOST\ graphic was to use this:
+
+\starttyping
+btex Some text to be typeset by \TEX etex
+\stoptyping
+
+The machinery was set up in such a way that these snippets got delegated to \TEX,
+and the resulting \DVI\ converted back into a a \METAPOST\ picture with objects
+that refer to a font and character. Although the \METAPOST\ program could handle
+that by calling out to \TEX, we never used that method. In \MKII\ we had two
+flows: either direct processing, or collect all texts and process them between
+runs. Because the backend (conversion to \PDF) was under \CONTEXT\ control we
+could do more than usual. You can find some information in the older manuals.
+
+In \CONTEXT\ \MKIV\ we started using the library variant of \METAPOST. Its
+integration in \LUATEX\ made it possible to do all text rendering runtime at high
+speed. This change has an enormous speed gain: when this manual had about 425
+pages, on my laptop with mobile 3840QM processor, one run of this document takes
+18 seconds (14.5 with \LUAJITTEX) and that includes loading a bunch of (outline)
+fonts and processing some 2200 \METAPOST\ images. While writing the first version
+of this manual runtime was upto 50 times slower for half the number of pages so
+compared to \MKII\ we have gained a lot.
+
+In \MKIV\ we still have two internal runs per \METAPOST\ graphic that has text:
+the first time the texts snippets are collected and afterwards handed over to
+\LUA\ that tells the \TEX\ ending to process it. The dimensions are saved and
+used in a second processing of the graphic. Contrary to \MKII\ the user doesn't
+see these two runs: they appear as one. In \in {figure} [fig:text:mkiv] this is
+illustrated.
+
+\startFLOWchart[mkiv]
+ \startFLOWcell
+ \name {metapost 1}
+ \location {1,1}
+ \shape {action}
+ \text {\METAPOST\ \type{textext 1}}
+ \connection [rl] {lua 1}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {lua 1}
+ \location {2,1}
+ \shape {action}
+ \text {\LUA}
+ \connection [rl] {context 1}
+ \connection [bb] {metapost 2}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {context 1}
+ \location {3,1}
+ \shape {action}
+ \text {\CONTEXT}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {metapost 2}
+ \location {4,1}
+ \shape {action}
+ \text {\METAPOST\ \type{textext 2}}
+ \connection [bb] {lua 1}
+ \connection [rl] {backend 1}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {backend 1}
+ \location {5,1}
+ \shape {action}
+ \text {backend}
+ \stopFLOWcell
+\stopFLOWchart
+
+In the later versions of \MKIV\ it was possible to jump out to \TEX\ immediately
+and save the second run, although there were cases where this was not possible
+(reliable). In \LMTX\ we always have one run. This is summarized in \in {figure}
+[fig:text:mkiv]. All this has to do with the fact that \TEX, \METAPOST\ and \LUA\
+are integrated but still kind of independent. When you expand a macro (that
+triggers processing of a graphic) you end up in a call to the \METAPOST\ library
+but \TEX\ is still in that macro. In \LUATEX\ and more advanced in \LUAMETATEX\
+you can sort of spawn a subprocess in \TEX\ (called local control) and indeed
+process the text immediately and use the calculated dimension after that has been
+done. All that \METAPOST\ needs is dimensions as it the backend that eventually
+will include the text.
+
+\startplacefigure[title={How \TEX\ and \METAPOST\ work together (\MKIV).},reference=fig:text:mkiv]
+ \FLOWchart[mkiv]
+\stopplacefigure
+
+\startFLOWchart[lmtx]
+ \startFLOWcell
+ \name {context 1}
+ \location {1,1}
+ \shape {action}
+ \text {\CONTEXT}
+ \connection [rl] {lua 1}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {lua 1}
+ \location {2,1}
+ \shape {action}
+ \text {\LUA}
+ \connection [lr] {context 1}
+ \connection [rl] {metapost 1}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {metapost 1}
+ \location {3,1}
+ \shape {action}
+ \text {\METAPOST\ \type{textext}}
+ \connection [lr] {lua 1}
+ \connection [rl] {backend 1}
+ \stopFLOWcell
+ \startFLOWcell
+ \name {backend 1}
+ \location {5,1}
+ \shape {action}
+ \text {backend}
+ \stopFLOWcell
+\stopFLOWchart
+
+\startplacefigure[title={How \TEX\ and \METAPOST\ work together (\LMTX).},reference=fig:text:lmtx]
+ \FLOWchart[lmtx]
+\stopplacefigure
+
+\stopsection
+
+\startsection[title={Environments}]
+
+\index{environments}
+
+The \type {textext} command is the main text handling command and it is used in many places
+in this manual. It takes a string.
+
+In \MKII\ text was processed between runs or immediately but still by running an
+independent \TEX\ run. That has some consequences when the text was to share its
+properties with the main document. This means that in \MKII\ we pass
+characteristics of the layout, spacing, fonts, color and optionally an
+environment that a user has set up. This is mentioned in the older manual but no
+longer relevant in \MKIV\ and \LMTX. Because we handle the text runtime we
+automatically use the same style and document properties.
+
+This means that in code like the following, a Palatino font will be used because
+that is what we use in this document.
+
+\starttyping
+\startMPcode
+draw btex Meta is a female lion! etex xysized (TextWidth,TextHeight) ;
+\stopMPcode
+\stoptyping
+
+But even when we still support \type {btex} we strongly advise users to use this:
+
+\starttyping
+\startMPcode
+draw textext("Meta is a female lion!") xysized (TextWidth,TextHeight) ;
+\stopMPcode
+\stoptyping
+
+In this example as well in the next one you see that we access \type {TextWidth}
+directly. In older examples in the \CONTEXT\ distribution you will notice that we
+serialize \TEX\ registers like \type {\textwidth}. This is still valid but less
+preferable. Here \type {TextWidth} is actually a macro that calls out to \LUA\
+from where we fetch the value of \type {\textwidth} and pipe it back to
+\METAPOST\ in a way that makes it look like we have a variable.
+
+\startbuffer[lioncode]
+\startMPcode
+numeric w, h ; w := TextWidth ; h := w/2 ;
+
+picture p ; p := textext.urt("Meta is a female lion!") xysized (w,h) ;
+picture q ; q := textext.urt("Meta is a female lion!") xysized (w,h) ;
+
+path b ; b := boundingbox p ; draw p withcolor "darkyellow" ;
+
+draw textextanchor(p) withpen pencircle scaled 5mm withcolor "darkblue" ;
+
+for i = (.28w,.90h), (.85w,.90h), (w,.05h) :
+ picture r ; r := q ;
+ path s ; s := (fullsquare xscaled .05w yscaled .4h) shifted i ;
+ clip r to s ;
+ draw r withcolor "darkred";
+endfor ;
+
+setbounds currentpicture to b ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer[lioncode]
+
+\in {Figure} [lionclip] shows the previous sentence in a slightly different look.
+You may consider coloring the dots to be an exercise in clipping.
+
+\startplacefigure[title={An example of clipping.},reference=lionclip]
+ \getbuffer[lioncode]
+\stopplacefigure
+
+In this example we show that the origin of the text. By default it gets centered
+but the \type {urt} suffix moves it. Here is another example of showing the
+origin:
+
+\startbuffer
+\startMPcode
+picture p ; p := thetextext.top("foo",(10,1));
+picture q ; q := thetextext.lft("foo",(1,10));
+
+draw textextanchor(p) withpen pencircle scaled 2mm withcolor "darkred" ;
+draw textextanchor(q) withpen pencircle scaled 1mm withcolor "white" ;
+
+draw p;
+draw q;
+\stopMPcode
+\stopbuffer
+
+\typebuffer
+
+It gives the following:
+
+\startlinecorrection[blank]
+\getbuffer
+\stoplinecorrection
+
+\stopsection
+
+\startsection[title={Labels}]
+
+\index{labels}
+
+In \METAPOST\ you can use the \type {label} macro to position text at certain
+points.
+
+\starttyping
+label("x", origin) ;
+\stoptyping
+
+The font and scale are determined by two variables, \type {defaultfont} and \type
+{defaultscale}, the former expecting the name of a font in the form of a string,
+the latter expecting a numeric to be used in the scaling of the font. Should you
+choose not to set these yourself, they default to \type {"Mono"} and \type
+{1.0}, respectively. However, you can change the defaults as follows:
+
+\starttyping
+defaultfont := "texgyrepagella-regular*default" ;
+defaultscale := 1.2 ;
+\stoptyping
+
+These settings selects Pagella at about 12pt. You can also set these variables
+to \CONTEXT\ related values. For \CONTEXT\ graphics they are set to:
+
+\starttyping
+defaultfont := "\truefontname{Regular}*default" ;
+defaultscale := \the\bodyfontsize/10 ;
+\stoptyping
+
+This means that they will adapt themselves to the current body font (in this
+document we get \truefontname {Regular}) and the current size of the bodyfont
+(here \the\bodyfontsize/10).
+
+Normally you can stick to the default and forget about these details. More important
+is how you anchor labels. This is best shown with some examples:
+
+\startbuffer
+\startMPcode
+ path p ; p := fullcircle scaled 3cm ;
+
+ drawarrow p ;
+
+ dotlabel ("test",point 0 of p) withcolor red ;
+ dotlabel.rt ("rt", point 1 of p) ;
+ dotlabel.urt ("urt", point 2 of p) ;
+ dotlabel.top ("top", point 3 of p) ;
+ dotlabel.ulft("ulft",point 4 of p) ;
+ dotlabel.lft ("lft", point 5 of p) ;
+ dotlabel.llft("llft",point 6 of p) ;
+ dotlabel.bot ("bot", point 7 of p) ;
+ dotlabel.lrt ("lrt", point 8 of p) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer \startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\startbuffer
+\startMPcode
+ path p ; p := fullcircle scaled 3cm ;
+
+ drawarrow p ;
+
+ dotlabel ("test",p) ;
+ dotlabel.rt ("rt", p) ;
+ dotlabel.urt ("urt", p) ;
+ dotlabel.top ("top", p) ;
+ dotlabel.ulft("ulft",p) ;
+ dotlabel.lft ("lft", p) ;
+ dotlabel.llft("llft",p) ;
+ dotlabel.bot ("bot", p) ;
+ dotlabel.lrt ("lrt", p) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer \startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\startbuffer
+\startMPcode
+ p := (origin..right..up..left) scaled 3cm ;
+
+ drawarrow p ;
+
+ label ("test",p) ;
+ label.rt ("rt", p) ;
+ label.urt ("urt", p) ;
+ label.top ("top", p) ;
+ label.ulft("ulft",p) ;
+ label.lft ("lft", p) ;
+ label.llft("llft",p) ;
+ label.bot ("bot", p) ;
+ label.lrt ("lrt", p) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer \startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\startbuffer
+\startMPcode
+ picture p ; p := image(drawarrow (origin..right..up..left) scaled 3cm ;) ;
+
+ draw p ;
+ draw bbox p dashed evenly ;
+
+ label ("test",p) ;
+ label.rt ("rt", p) ;
+ label.urt ("urt", p) ;
+ label.top ("top", p) ;
+ label.ulft("ulft",p) ;
+ label.lft ("lft", p) ;
+ label.llft("llft",p) ;
+ label.bot ("bot", p) ;
+ label.lrt ("lrt", p) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer \startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\startbuffer
+\startMPcode
+ picture p ; p := image(drawarrow (origin..right..up..left) scaled 3cm ;) ;
+
+ draw p ;
+ draw bbox p dashed evenly ;
+
+ draw textext ("test") shifted theoffset (p) ;
+ draw textext.lft ("rt") shifted theoffset.rt (p) ;
+ draw textext.llft("urt") shifted theoffset.urt (p) ;
+ draw textext.bot ("top") shifted theoffset.top (p) ;
+ draw textext.lrt ("ulft") shifted theoffset.ulft(p) ;
+ draw textext.rt ("lft") shifted theoffset.lft (p) ;
+ draw textext.urt ("llft") shifted theoffset.llft(p) ;
+ draw textext.top ("bot") shifted theoffset.bot (p) ;
+ draw textext.ulft("lrt") shifted theoffset.lrt (p) ;
+\stopMPcode
+\stopbuffer
+
+\typebuffer \startlinecorrection[blank] \getbuffer \stoplinecorrection
+
+\stopsection
+
+\startsection[title={Text along a path}]
+
+\index{text}
+
+In the next example we will use a special mechanism for building graphics step by
+step. The advantage of this method is that we can do intermediate calculations in
+\TEX. Our objective is to write a macro that draws text along a circular path.
+While doing so we want to achieve the following:
+
+\startitemize[packed]
+ \startitem
+ the text should be properly kerned, i.e.\ the spacing between characters
+ should be optimal,
+ \stopitem
+ \startitem
+ the position on the circle should vary, and
+ \stopitem
+ \startitem
+ the radius of the circle should vary.
+ \stopitem
+\stopitemize
+
+This code below is a bit rusted but it illustrates the principles. In \MKIV\ and
+\LMTX\ we have typesetting along a curve built in so we no longer show the \TEX\
+code that integrates it. This implementation is not the most straightforward one,
+but by doing it step by step, at least we see what is involved.
+
+We let the bodyfont match the font used in this document, and define \type
+{RotFont} to be the regular typeface, the one you are reading right now, but
+bold.
+
+\startbuffer
+\definefont[RotFont][RegularBold*default]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Since \METAPOST\ is unaware of kerning, we have to use \TEX\ to keep track of the
+positions. We will split the text into tokens (often characters) and store the
+result in an array of pictures (\type {pic}). We will also store the accumulated
+width in an array (\type {len}). The number of characters is stored in~\type {n}.
+In a few paragraphs we will see why the other arrays are needed.
+
+While defining the graphic, we need \TEX\ to do some calculations. Therefore, we
+will use \type {\startMPdrawing} to stepwise construct the definition. The basic
+pattern we will follow is:
+
+\starttyping
+\resetMPdrawing
+\startMPdrawing
+ metapost code
+\stopMPdrawing
+tex code
+\startMPdrawing
+ metapost code
+\stopMPdrawing
+\MPdrawingdonetrue
+\getMPdrawing
+\stoptyping
+
+In the process, we will use a few variables. We will store the individual
+characters of the text in the variable \type {pic}, its width in \type {wid} and
+the length of the string so far in \type {len}. Later we will use the \type {pos}
+array to store the position where a character ends up. The variable \type {n}
+holds the number of tokens.
+
+\startbuffer[init]
+\resetMPdrawing
+\startMPdrawing
+ picture pic[] ;
+ numeric wid[], len[], pos[], n ;
+ wid[0] := len[0] := pos[0] := n := 0 ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[init]
+
+We also started fresh by resetting the drawing. From now on, each start command
+will add some more to this graphic. The next macro is responsible for collecting
+the data. Each element is passed on to \TEX, using the \type {btex} construct.
+So, \METAPOST\ itself will call \TEX !
+
+\startbuffer[toks]
+\def\whatever#1%
+ {\appendtoks#1\to\MPtoks
+ \setbox\MPbox=\hbox{\bfd\the\MPtoks}%
+ \startMPdrawing
+ n := n + 1 ; len[n] := \the\wd\MPbox ;
+ \stopMPdrawing
+ \startMPdrawing[-]
+ pic[n] := textext("\bfd\setstrut\strut#1") ;
+ pic[n] := pic[n] shifted - llcorner pic[n] ;
+ \stopMPdrawing}
+
+\handletokens MetaPost is Fun!\with\whatever
+\stopbuffer
+
+\typebuffer[toks]
+
+We use the low level \CONTEXT\ macro \type {\appendtoks} to extend the token list
+\type {\MPtoks}. The \type {\handletokens} macro passes each token (character) of
+\typ {MetaPost is Fun!} to the macro \type {\whatever}. The tokens are appended
+to the token register \type {\MPtoks} (already defined). Then we typeset the
+content of \type {\MPtoks} in \type {\MPbox} (also already defined). The width of
+the box is passed to \METAPOST\ and stored in \type {len}.
+
+By default the content of the drawing is expanded, which means that the macro is
+replaced by its current meaning, so the current width ends up in the \METAPOST\
+file. The next part of the drawing, starting with \type {btex}, puts the token in
+a picture. This time we don't expand the drawing, since we want to pass font
+information. Here, the \type {[-]} suppresses expansion of \typ {btex \bfd #1
+etex}. The process is iterated by \type {\handletokens} for each character of the
+text \typ {MetaPost is Fun!}.
+
+Before we typeset the text, now available in pieces in \type {pic}, in a circle,
+we will first demonstrate what they look like. You may like to take a look at the
+file \type {mpgraph.mp} to see what is passed to \METAPOST.
+
+\startbuffer[test]
+\startMPdrawing
+ pair len ; len := origin ;
+ for i=1 upto n :
+ draw pic[i] shifted len ;
+ draw boundingbox pic[i] shifted len
+ withpen pencircle scaled .25pt withcolor red ;
+ len := len+(xpart urcorner pic[i]-xpart llcorner pic[i],0) ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[test]
+
+\startbuffer[show]
+\MPdrawingdonetrue\getMPdrawing
+\stopbuffer
+
+We can call up this drawing with \type {\getMPdrawing}, but first we inform the
+compiler that our \METAPOST\ drawing is completed.
+
+\typebuffer[show]
+
+This results in:
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,test,show]
+\stoplinecorrection
+
+Compare this text with the text as typeset by \TEX:
+
+\blank \start \bfd MetaPost is Fun!\par \stop \blank
+
+and you will see that the text produced by \METAPOST\ is not properly kerned.
+When putting characters after each other, \TEX\ uses the information available in
+the font, to optimize the spacing between characters, while \METAPOST\ looks at
+characters as separate entities. But, since we have stored the optimal spacing in
+\type {len}, we can let \METAPOST\ do a better job. Let's first calculate the
+correction needed.
+
+\startbuffer[kern]
+\startMPdrawing
+ for i=1 upto n :
+ wid[i] := abs(xpart urcorner pic[i] - xpart llcorner pic[i]) ;
+ pos[i] := len[i]-wid[i] ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[kern]
+
+This compares well to the text as typeset by \TEX:
+
+\blank \start \bfd MetaPost is Fun!\par \stop \blank
+
+We can now use the values in \type {pos} to position the pictures according to
+what \TEX\ considered to be the best (relative) position.
+
+\startbuffer[test]
+\startMPdrawing
+ for i=1 upto n :
+ draw pic[i] shifted (pos[i],0) ;
+ draw boundingbox pic[i] shifted (pos[i],0)
+ withpen pencircle scaled .25pt withcolor red ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[test]
+
+That this correction is adequate, is demonstrated in the next graphic. If you
+look closely, you will see that for instance the \quote {o} is moved to the left,
+under the capital \quote {P}.
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,kern,test,show]
+\stoplinecorrection
+
+When we want to position the pictures along a circle, we need to apply some
+rotations, especially because we want to go clockwise. Since we don't want to use
+\quote {complicated} math or more advanced \METAPOST\ code yet, we will do it in
+steps.
+
+\startbuffer[swap]
+\startMPdrawing
+ for i=1 upto n:
+ pic[i] := pic[i] rotatedaround(origin,-270) ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[swap]
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,kern,swap,test,show]
+\stoplinecorrection
+
+\startbuffer[cent]
+\startMPdrawing
+ for i=1 upto n :
+ pic[i] := pic[i]
+ shifted (0,ypart -.5[ulcorner pic[i],llcorner pic[i]]) ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+We will now center the pictures around the baseline. Centering comes down to
+shifting over half the height of the picture. This can be expressed by:
+
+\starttyping
+ypart -.5[ulcorner pic[i],llcorner pic[i]]
+\stoptyping
+
+but different ways of calculating the distance are possible
+too.
+
+\typebuffer[cent]
+
+So, now we have:
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,kern,swap,cent,test,show]
+\stoplinecorrection
+
+When we typeset on a (half) circle, we should map the actual length onto a
+partial circle. We denote the radius with an~\type {r} and shift the pictures to
+the left.
+
+\startbuffer[shif]
+\startMPdrawing
+ numeric r ; r := len[n]/pi ;
+ for i=1 upto n :
+ pic[i] := pic[i] shifted (-r,0) ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[shif]
+
+You can now use the following code to test the current state of the pictures. Of
+course this code should not end up in the final definitions.
+
+\startbuffer[test]
+\startMPdrawing
+ draw origin
+ withpen pencircle scaled 5pt withcolor red ;
+ for i=1 upto n :
+ draw pic[i] ;
+ draw boundingbox pic[i]
+ withpen pencircle scaled .25pt withcolor red ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[test]
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,kern,swap,cent,shif,test,show]
+\stoplinecorrection
+
+Later we will write a compact, efficient macro to take care of rotation. However,
+for the moment, so as not to overwhelm you with complicated code, we will rotate
+each individual picture with the following code fragment.
+
+\startbuffer[rots]
+\startMPdrawing
+ numeric delta, extra, radius, rot[] ;
+
+ delta := extra := radius := 0 ;
+
+ for i=1 upto n :
+ rot[i] := extra+delta-((pos[i]+.5wid[i])/len[n])*(180+2delta) ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[rots]
+
+Here we introduce a few variables that we can use later to tune the result a bit.
+With \type {delta}, the space between the characters can be increased, while
+\type {extra} rotates the whole string around the origin. The \type {radius}
+variable can be used to increase the distance to the origin. Without these
+variables, the assignment would have been:
+
+\starttyping
+rot[i] := ((pos[i]+.5wid[i])/len[n])*180 ;
+\stoptyping
+
+Placing the pictures is now rather easy:
+
+\startbuffer[done]
+\startMPdrawing
+ for i=1 upto n :
+ draw pic[i] shifted (-radius,0) rotatedaround(origin,rot[i]) ;
+ endfor ;
+\stopMPdrawing
+\stopbuffer
+
+\typebuffer[done]
+
+The pictures are now positioned on half a circle, properly kerned.
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,kern,swap,cent,shif,rots,done,show]
+\stoplinecorrection
+
+A bit more insight is given in the next picture:
+
+\startbuffer[test]
+\startMPdrawing
+ def moved(expr i) =
+ shifted (-radius,0) rotatedaround(origin,rot[i])
+ enddef ;
+ pickup pencircle scaled .5pt ;
+ for i=1 upto n :
+ draw pic[i] moved(i) ;
+ draw boundingbox pic[i] moved(i) withcolor red ;
+ draw origin -- center pic[i] moved(i) withcolor green ;
+ endfor ;
+ draw tcircle scaled 2r withcolor blue ;
+\stopMPdrawing
+\stopbuffer
+
+\startlinecorrection[blank]
+\getbuffer[init,toks,kern,swap,cent,shif,rots,test,show]
+\stoplinecorrection
+
+This was defined as follows. The path variable \type {tcycle} is predefined to
+the top half of a fullcircle.
+
+\typebuffer[test]
+
+We will now package all of this into a nice, efficient macro, using, of course,
+the predefined scratch registers \type {\MPtoks} and \type {\MPbox}. First we
+define the token processor. Note again the expansion inhibition switch \type
+{[-]}. This code is presented as an example of how these mechanissm evolved in
+\CONTEXT.
+
+\startbuffer
+\def\processrotationtoken#1%
+ {\appendtoks#1\to\MPtoks
+ \setbox\MPbox=\hbox{\RotFont\the\MPtoks}%
+ \startMPdrawing
+ n := n + 1 ; len[n] := \the\wd\MPbox ;
+ \stopMPdrawing
+ \startMPdrawing[-]
+ pic[n] := textext("\RotFont\setstrut\strut#1") ;
+ pic[n] := pic[n] shifted - llcorner pic[n] ;
+ \stopMPdrawing}
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+The main macro is a bit more complicated but by using a few scratch numerics, we
+can keep it readable.
+
+\startbuffer
+\def\rotatetokens#1#2#3#4% delta extra radius tokens
+ {\vbox\bgroup
+ \MPtoks\emptytoks
+ \resetMPdrawing
+ \startMPdrawing
+ picture pic[] ;
+ numeric wid, len[], rot ;
+ numeric delta, extra, radius, n, r ;
+ len[0] := n := 0 ;
+ delta := #1 ; extra := #2 ; radius := #3 ;
+ \stopMPdrawing
+ \handletokens#4\with\processrotationtoken
+ \startMPdrawing
+ r := len[n]/pi ;
+ for i=1 upto n :
+ wid := abs(xpart lrcorner pic[i] -
+ xpart llcorner pic[i]) ;
+ rot := extra + delta -
+ ((len[i]-.5wid)/len[n]) * (180+2delta) ;
+ draw pic[i]
+ rotatedaround (origin,-270) shifted (-r-radius,
+ ypart -.5[ulcorner pic[i], llcorner pic[i]])
+ rotatedaround (origin,rot) ;
+ endfor ;
+ \stopMPdrawing
+ \MPdrawingdonetrue
+ \getMPdrawing
+ \resetMPdrawing
+ \egroup}
+\stopbuffer
+
+\typebuffer
+
+\getbuffer
+
+\startbuffer
+\startcombination[3*1]
+ {\rotatetokens {0} {0}{0}{Does it work ok?}} {A}
+ {\rotatetokens{20} {0}{0}{Does it work ok?}} {B}
+ {\rotatetokens{20}{30}{0}{Does it work ok?}} {C}
+\stopcombination
+\stopbuffer
+
+We can use this macro as follows:
+
+\typebuffer
+
+\startlinecorrection[blank]
+\getbuffer
+\stoplinecorrection
+
+The previous macro is not really an example of generalization, but we used it for
+demonstrating how to build graphics in a stepwise way. If you put the steps in
+buffers, you can even combine steps and replace them at will. This is how we made
+the previous step by step examples: We put each sub||graphic in a buffer and then
+called the ones we wanted.
+
+Next we show how it is done today in \LMTX. Instead of wrapping it in a macro we
+just do all in \METAPOST. Watch how we use the key|/|value interface:
+
+\startbuffer
+\startMPcode
+ draw lmt_followtext [
+ path = halfcircle rotated 45 scaled 4cm,
+ text = "Does it work ok?",
+ spread = true,
+ trace = true,
+ ] ;
+ draw lmt_followtext [
+ path = halfcircle rotated -30 scaled 3cm,
+ text = "Does it work ok?",
+ spread = false,
+ trace = true,
+ ] shifted (4cm,0) ;
+ draw lmt_followtext [
+ path = reverse halfcircle scaled 2cm,
+ text = "Does it work ok?",
+ spread = true,
+ trace = true,
+ ] shifted (8cm,0) ;
+\stopMPcode
+\stopMPcode
+\stopbuffer
+
+\typebuffer
+
+\startlinecorrection[blank]
+\getbuffer
+\stoplinecorrection
+
+\stopsection
+
+\startsection[title={Using shapes}]
+
+Sometimes, others may say oftentimes, we are in need for some fancy typesetting.
+If we want to typeset a paragraph of text in a non standard shape, like a circle,
+we have to fall back on \type {\parshape}. Unfortunately, \TEX\ is not that
+strong in providing the specifications of more complicated shapes, unless you are
+willing to do some complicated arithmetic \TEX. Given that \METAPOST\ knows how
+to deal with shapes, the question is: \quotation {Can \METAPOST\ be of help?}
+
+In the process of finding out how to deal with this, we first define a simple
+path. Because we are going to replace pieces of code, we will compose the graphic
+from components. First, we create the path.
+
+\startbuffer
+\startuseMPgraphic{text path}
+ path p ; p := ((0,1)..(-1,0)..(1,0)--cycle) scaled 65pt ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This shape is not that beautiful, but it has a few characteristics that will help
+us to identify bordercases.
+
+\startbuffer
+\startuseMPgraphic{text draw}
+ drawarrow p withpen pencircle scaled 1pt withcolor red ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Now we use \CONTEXT's \type {\includeMPgraphic} command to build our graphic from
+the previously defined components.
+
+\startbuffer
+\startuseMPgraphic{text}
+ \includeMPgraphic{text path}
+ \includeMPgraphic{text draw}
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+When called with \type {\useMPgraphic{text}}, we get:
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+For the moment we start the path at $(x=0,y>0)$, but later using more complicated
+macros, we will see that we can use arbitrary paths.
+
+We are going to split the path in two, and will use the points that make up the
+bounding box as calcutated by \METAPOST. The next graphic shows one of these
+points, the lower left corner, available as point \typ {llcorner p}.
+
+\startbuffer
+\startuseMPgraphic{text draw}
+ draw p withpen pencircle scaled 3pt withcolor red ;
+ draw boundingbox p withpen pencircle scaled 1pt ;
+ draw llcorner p withpen pencircle scaled 5pt ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+The five points that \METAPOST\ can report for each path or picture are:
+
+\starttabulate[|Tl|l|]
+\NC llcorner \NC lower left corner \NC \NR
+\NC lrcorner \NC lower right corner \NC \NR
+\NC urcorner \NC upper right corner \NC \NR
+\NC ulcorner \NC upper left corner \NC \NR
+\NC center \NC intersection of the diagonals \NC \NR
+\stoptabulate
+
+If we want to typeset text inside this circle, we need to know where a line
+starts and ends. Given that lines are horizontal and straight, we therefore need
+to calculate the intersection points of the lines and the path. As a first step,
+we calculate the top and bottom of the path and after that we split off the left
+and right path.
+
+\startbuffer
+\startuseMPgraphic{text split}
+ pair t, b ; path l, r ;
+
+ t := (ulcorner p -- urcorner p) intersectionpoint p ;
+ b := (llcorner p -- lrcorner p) intersectionpoint p ;
+
+ l := p cutbefore t ; l := l cutafter b ;
+ r := p cutbefore b ; r := r cutafter t ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The \type {intersectionpoint} macro returns the point where two paths cross. If
+the paths don't cross, an error is reported, when the paths cross more times,
+just one point is returned. The \type {cutafter} and \type {cutbefore} commands
+do as their names say and return a path.
+
+In the \type {text split} code fragment, \type {t} and \type {b} are the top
+points of the main path, while \type {l} and \type {r} become the left and right
+half of path \type {p}.
+
+We now draw the original path using a thick pen and both halves with a thinner
+pen on top of the original. The arrows show the direction.
+
+\startbuffer
+\startuseMPgraphic{text draw}
+ draw p withpen pencircle scaled 3pt withcolor red ;
+ drawarrow l withpen pencircle scaled 1pt withcolor green ;
+ drawarrow r withpen pencircle scaled 1pt withcolor blue ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We use \type {\includeMPgraphic} to assemble the components:
+
+\startbuffer
+\startuseMPgraphic{text}
+ \includeMPgraphic{text path}
+ \includeMPgraphic{text split}
+ \includeMPgraphic{text draw}
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+This graphic is typeset with \type {\useMPgraphic{text}}:
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+Before we are going to use them, we define some variables that specify the text.
+We use a baseline distance of 8~points. The part of the line above the baseline
+is 7.2~points, while the (maximum) depth is 2.8~points. These ratios are the ones
+we use in \CONTEXT. Because we don't want the text to touch the circle so we
+define an offset too.
+
+\startbuffer
+\startuseMPgraphic{text vars}
+ MyOffset := LineHeight/2 ;
+ MyTopSkip := StrutHeight ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+We more or less achieve the offset by scaling the path. In doing so, we use the
+width and height, which we call \type {hsize} and \type {vsize}, thereby
+conforming to the \TEX\ naming scheme.
+
+First we calculate both dimensions from the bounding box of the path. Next we
+down scale the path to compensate for the offset. When done, we recalculate the
+dimensions.
+
+\startbuffer
+\startuseMPgraphic{text move}
+ pair t, b ; path q, l, r ;
+
+ hsize := xpart lrcorner p - xpart llcorner p ;
+ vsize := ypart urcorner p - ypart lrcorner p ;
+
+ q := p xscaled ((hsize-2MyOffset)/hsize)
+ yscaled ((vsize-2MyOffset)/vsize) ;
+
+ hsize := xpart lrcorner q - xpart llcorner q ;
+ vsize := ypart urcorner q - ypart lrcorner q ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startuseMPgraphic{text split}
+ t := (ulcorner q -- urcorner q) intersectionpoint q ;
+ b := (llcorner q -- lrcorner q) intersectionpoint q ;
+
+ l := q cutbefore t ; l := l cutafter b ;
+ r := q cutbefore b ; r := r cutafter t ;
+\stopuseMPgraphic
+\stopbuffer
+
+We adapt the \type {text split} code to use the reduced path
+instead of the original.
+
+\typebuffer \getbuffer
+
+\startbuffer
+\startuseMPgraphic{text draw}
+ drawarrow p withpen pencircle scaled 1pt withcolor red ;
+ draw t withpen pencircle scaled 2pt ;
+ draw b withpen pencircle scaled 2pt ;
+ drawarrow l withpen pencircle scaled 1pt withcolor green ;
+ drawarrow r withpen pencircle scaled 1pt withcolor blue ;
+\stopuseMPgraphic
+\stopbuffer
+
+In order to test what we have reached so far, we draw the original path, the left
+and right part of the reduced path, and both the top and bottom point.
+
+\typebuffer \getbuffer
+
+Again we use \type {\includeMPgraphic} to combine the
+components into a graphic.
+
+\startbuffer
+\startuseMPgraphic{text}
+ \includeMPgraphic{text path} \includeMPgraphic{text vars}
+ \includeMPgraphic{text move} \includeMPgraphic{text split}
+ \includeMPgraphic{text draw}
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Then we use \type {\useMPgraphic{text}} to call up the picture.
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+The offset is not optimal. Note the funny gap at the top. We could try to fix
+this, but there is a better way to optimize both paths.
+
+We lower the top edge of \type {q}'s bounding box by \type {MyTopSkip}, then cut
+any part of the left and right pieces of \type {q} that lie above it. Similarly,
+we raise the bottom edge and cut off the pieces that fall below this line.
+
+\startbuffer
+\startuseMPgraphic{text cutoff}
+ path tt, bb ;
+
+ tt := (ulcorner q -- urcorner q) shifted (0,-MyTopSkip) ;
+ bb := (llcorner q -- lrcorner q) shifted (0,StrutDepth) ;
+
+ l := l cutbefore (l intersectionpoint tt) ;
+ l := l cutafter (l intersectionpoint bb) ;
+ r := r cutbefore (r intersectionpoint bb) ;
+ r := r cutafter (r intersectionpoint tt) ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Because we use \type {\includeMPgraphic} to construct the graphic, we can
+redefine \type {text draw} to show the result of this effort.
+
+\startbuffer
+\startuseMPgraphic{text draw}
+ drawarrow p withpen pencircle scaled 1pt withcolor red ;
+ drawarrow l withpen pencircle scaled 1pt withcolor green ;
+ drawarrow r withpen pencircle scaled 1pt withcolor blue ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The \type {text} graphic now becomes:
+
+\startbuffer
+\startuseMPgraphic{text}
+ \includeMPgraphic{text path} \includeMPgraphic{text vars}
+ \includeMPgraphic{text move} \includeMPgraphic{text split}
+ \includeMPgraphic{text cutoff} \includeMPgraphic{text draw}
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Or, as graphic:
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+We are now ready for an attempt to calculate the shape of the text. For each
+line, we have to calculate the left and right intersection points, and since a
+line has a height and depth, we have to determine which part touches first.
+
+\startbuffer
+\startuseMPgraphic{text calc}
+ vardef found_point (expr lin, pat, sig) =
+ pair a, b ;
+ a := pat intersection_point (lin shifted (0,StrutHeight)) ;
+ if intersection_found :
+ a := a shifted (0,-StrutHeight) ;
+ else :
+ a := pat intersection_point lin ;
+ fi ;
+ b := pat intersection_point (lin shifted (0,-StrutDepth)) ;
+ if intersection_found :
+ if sig :
+ if xpart b > xpart a : a := b shifted (0,StrutDepth) fi ;
+ else :
+ if xpart b < xpart a : a := b shifted (0,StrutDepth) fi ;
+ fi ;
+ fi ;
+ a
+ enddef ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Instead of using \METAPOST's \type {intersectionpoint} macro, we use one that
+comes with \CONTEXT. That way we don't get an error message when no point is
+found, and can use a boolean flag to take further action. Since we use a \type
+{vardef}, all calculations are hidden and the~\type {a} at the end is returned,
+so that we can use this macro in an assignment. The \type {sig} variable is used
+to distinguish between the beginning and end of a line (the left and right
+subpath).
+
+\startbuffer
+\startuseMPgraphic{text step}
+ path line; pair lll, rrr ;
+
+ for i=MyTopSkip step LineHeight until vsize :
+
+ line := (ulcorner q -- urcorner q) shifted (0,-i) ;
+
+ lll := found_point(line,l,true ) ;
+ rrr := found_point(line,r,false) ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Here we divide the available space in lines. The first line starts at \type
+{StrutHeight} from the top.
+
+We can now finish our graphic by visualizing the lines. Both the height and depth
+of the lines are shown.
+
+\startbuffer
+\startuseMPgraphic{text line}
+ fill (lll--rrr--rrr shifted (0,StrutHeight)--lll
+ shifted (0,StrutHeight)--cycle) withcolor .5white ;
+ fill (lll--rrr--rrr shifted (0,-StrutDepth)--lll
+ shifted (0,-StrutDepth)--cycle) withcolor .7white ;
+ draw lll withpen pencircle scaled 2pt ;
+ draw rrr withpen pencircle scaled 2pt ;
+ draw (lll--rrr) withpen pencircle scaled .5pt ;
+\stopuseMPgraphic
+
+\startuseMPgraphic{text done}
+ endfor ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The result is still a bit disappointing.
+
+\startbuffer
+\startuseMPgraphic{text}
+ \includeMPgraphic{text path} \includeMPgraphic{text vars}
+ \includeMPgraphic{text move} \includeMPgraphic{text split}
+ \includeMPgraphic{text cutoff} \includeMPgraphic{text draw}
+ \includeMPgraphic{text calc} \includeMPgraphic{text step}
+ \includeMPgraphic{text line} \includeMPgraphic{text done}
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+In order to catch the overflow at the bottom, we need to change the \type
+{for}||loop a bit, so that the number of lines does not exceed the available
+space. The test that surrounds the assignment of \type {vvsize} makes sure that
+we get better results when we (on purpose) take a smaller height.
+
+\startbuffer
+\startuseMPgraphic{text step}
+ path line; pair lll, rrr ; numeric vvsize ;
+
+ if (StrutHeight+StrutDepth<LineHeight) :
+ vvsize := vsize ;
+ else :
+ vvsize := (vsize div LineHeight) * LineHeight ;
+ fi ;
+
+ for i=MyTopSkip step LineHeight until vvsize :
+
+ line := (ulcorner q -- urcorner q) shifted (0,-i) ;
+
+ lll := found_point(line,l,true ) ;
+ rrr := found_point(line,r,false) ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+We can manipulate the heigth and depth of the lines to give different (and maybe
+better) results.
+
+\startbuffer
+\startuseMPgraphic{text vars}
+MyOffset := .5LineHeight ;
+MyTopSkip := StrutHeight ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\startlinecorrection[blank]
+\useMPgraphic{text}
+\stoplinecorrection
+
+Now that we know a bit how this works we demonstrate the implementation in \LMTX.
+Where in \MKIV\ and \MKII\ we let \METAPOST\ pass the dimensions to \TEX\ via a
+temporary file in \LMTX\ we communicate more directly. You can take a look at the
+source code if you want to know how that works.
+
+We start by defining four shapes. They are not really beautiful, but they
+demonstrate what happens in border cases. For instance, too small first lines are
+ignored. First we define a circle. Watch how the dimensions are set in the
+graphic. The arguments passed to \type {lmt_parshape} are: path, an offset, an
+additional horizontal and vertical displacement, the baseline distance, the
+height and depth of the line, and the height of the first line (aka topskip). The
+height and depth of a line are often called strut height and depth, with a strut
+being an invisible character with maximum dimensions. Variables like \type
+{StrutHeight} refer to values at the \TEX\ end. We play safe and group so that we
+can save variables.
+
+\startbuffer
+\startuseMPgraphic{shapetest-1}
+ begingroup ;
+ save p ; path p ; p := fullcircle scaled 6cm ;
+ lmt_parshape [
+ path = p,
+ offset = BodyFontSize/2,
+ dx = 0, % default
+ dy = 0, % default
+ lineheight = LineHeight, % default
+ strutheight = StrutHeight, % default
+ strutdepth = StrutDepth, % default
+ topskip = StrutHeight, % default
+ ] ;
+ draw p withpen pencircle scaled 1pt ;
+ endgroup ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The second shape is a diamond. This is a rather useless shape, unless the text
+suits the small lines at the top and bottom.
+
+\startbuffer
+\startuseMPgraphic{shapetest-2}
+ begingroup ;
+ save p ; path p ; p := fullsquare rotated 45 scaled 5cm ;
+ lmt_parshape [
+ path = p,
+ offset = BodyFontSize/2,
+ trace = true,
+ ] ;
+ draw p withpen pencircle scaled 1pt ;
+ endgroup ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The third and fourth shape demonstrate that providing a suitable offset is not
+always trivial.
+
+\startbuffer
+\startuseMPgraphic{shapetest-3}
+ begingroup ;
+ save w, h, p ; path p ; w := h := 6cm ;
+ p := (.5w,h) -- ( 0, h) -- (0,0) -- (w,0) &
+ ( w,0) .. (.75w,.5h) .. (w,h) & (w,h) -- cycle ;
+ lmt_parshape [
+ path = p,
+ offset = BodyFontSize/2,
+ ] ;
+ draw p withpen pencircle scaled 1pt ;
+ endgroup ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Contrary to the first three shapes, here we use a different path for the
+calculations and the drawing. Watch carefully! If, instead of an offset, we pass
+a path, \METAPOST\ is able to calculate the right dimensions and offsets. This is
+needed, since we need these later on.
+
+\startbuffer
+\startuseMPgraphic{shapetest-4}
+ begingroup ;
+ save d, p, q, shape ; path p, q ; d := BodyFontSize/2;
+ vardef shape(expr w, h, o) =
+ (o,o) -- (w-o,o) & (w-o,o) .. (.75w-o,.5h) ..
+ (w-2o,h-o) & (w-2o,h-o) -- (o,h-o) -- cycle
+ enddef ;
+ p := shape(6cm, 6cm, d) ;
+ q := shape(6cm, 6cm, 0) ;
+ lmt_parshape [
+ path = p,
+ offsetpath = q,
+ dx = d,
+ dy = d,
+ trace = true,
+ ] ;
+ draw q withpen pencircle scaled 1pt ;
+ endgroup ;
+\stopuseMPgraphic
+\stopbuffer
+
+\typebuffer \getbuffer
+
+Since we also want these graphics as backgrounds, we define them as overlays. If
+you don't want to show the graphic, you may omit this step.
+
+\startbuffer
+\defineoverlay[shapetest-1][\useMPgraphic{shapetest-1}]
+\defineoverlay[shapetest-2][\useMPgraphic{shapetest-2}]
+\defineoverlay[shapetest-3][\useMPgraphic{shapetest-3}]
+\defineoverlay[shapetest-4][\useMPgraphic{shapetest-4}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+As text, we use a quote from Douglas R.~Hofstadter's book \quotation {Metamagical
+Themas, Questing for the Essence of Mind and Pattern}. Watch how we pass a list
+of shapes.
+
+\startbuffer[text]
+\startshapetext[shapetest-1,shapetest-2,shapetest-3,shapetest-4]
+ \forgetall % as it says
+ \setupalign[verytolerant,stretch,normal]%
+ \samplefile{douglas}% Douglas R. Hofstadter
+\stopshapetext
+\stopbuffer
+
+\typebuffer[text]
+
+Finally we combine text and shapes. Since we also want a background, we use \type
+{\framed}. The normal result is shown in \in {figure} [fig:shapes].
+
+\startbuffer[shapes]
+\startbuffer
+\startcombination[2*2]
+ {\framed[offset=overlay,frame=off,background=shapetest-1]{\getshapetext}} {shapetest-1}
+ {\framed[offset=overlay,frame=off,background=shapetest-2]{\getshapetext}} {shapetest-2}
+ {\framed[offset=overlay,frame=off,background=shapetest-3]{\getshapetext}} {shapetest-3}
+ {\framed[offset=overlay,frame=off,background=shapetest-4]{\getshapetext}} {shapetest-4}
+\stopcombination
+\stopbuffer
+\stopbuffer
+
+\typebuffer[shapes]
+
+\getbuffer[shapes]
+
+By using a buffer we keep \type {\placefigure} readable. You might have noticed
+that for two shapes we turned on tracing.
+
+\startbuffer[a]
+\placefigure
+ [here][fig:shapes]
+ {A continuous text, typeset in a non||standard shape,
+ spread over four areas, and right aligned.}
+ {\getbuffer}
+\stopbuffer
+
+\startbuffer[b]
+\placefigure
+ [here][fig:shapes]
+ {A continuous text, typeset in a non||standard shape,
+ spread over four areas.}
+ {\scale[factor=max,height=.9\textheight]{\getbuffer}}
+\stopbuffer
+
+\typebuffer[a]
+
+\doifmodeelse{screen}{\getbuffer[text,b]}{\getbuffer[text,a]}
+
+\blank
+
+We can combine all those tricks, although the input is somewhat fuzzy. First we
+define a quote typeset in a circular paragraph shape where we use the defaults.
+
+\startbuffer[shape]
+\startuseMPgraphic{center}
+ lmt_parshape [
+ path = fullcircle scaled 8cm,
+ ]
+\stopuseMPgraphic
+
+\startshapetext[center]
+ \samplefile{douglas}%
+\stopshapetext
+
+\defineoverlay[center][\useMPgraphic{center}]
+\stopbuffer
+
+\typebuffer[shape]
+
+We will surround this text with a circular line, that we define as follows. By
+using a buffer we keep things organized.
+
+\startbuffer
+\startuseMPgraphic{circle}
+ save p ; path p ;
+ p := reverse fullcircle rotatedaround(origin,90)
+ xscaled OverlayWidth yscaled OverlayHeight ;
+
+ draw lmt_followtext [
+ path = p,
+ text = "This is just a dummy text, kerned by \TeX\ and typeset
+ in a circle using \MetaPost.\quad",
+ spread = true,
+ trace = true,
+ ] ;
+
+% draw p ;
+\stopuseMPgraphic
+
+\defineoverlay[edge][\useMPgraphic{circle}]
+\stopbuffer
+
+\typebuffer \getbuffer
+
+The text and graphics come together in a framed text:
+
+\startbuffer
+\startplacefigure[title={One more time Hofstadter's quotation (normal).}]
+ \getbuffer[shape,quote]%
+ \framed
+ [offset=24pt,
+ background=edge,
+ frame=off,
+ backgroundoffset=-18pt]
+ {\getshapetext}
+\stopplacefigure
+\stopbuffer
+
+\typebuffer \getbuffer
+
+\stopsection
+
+\stopchapter
+
+\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text.tex
index f70f53ac306..8229e35db46 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-text.tex
@@ -1,4 +1,4 @@
-% language=uk
+% engine=luatex language=uk
%
% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa
@@ -48,7 +48,7 @@ the right auxiliary programs are executed.
In \CONTEXT\ \MKIV\ you won't notice this at all because everything is tightly
integrated with \LUATEX's \MPLIB. This has an enormous speed gain: when this
manual had about 425 pages, on my laptop with mobile 3840QM processor, one run of
-this document takes 18 seconds (14.5 with \LUAJITTEX) and that includes loadint a
+this document takes 18 seconds (14.5 with \LUAJITTEX) and that includes loading a
bunch of (outline) fonts and processing some 2200 \METAPOST\ images. While
writing the first version of this manual runtime was upto 50 times slower for
half the number of pages so compared to \MKII\ we have gained a lot.
@@ -680,7 +680,7 @@ in \MKIV\ we use a different approach. There we use a mix of \TEX, \METAPOST, an
\LUA\ to define that macro. The principles remain the same but the code is more
robust.
-\input meta-imp-txt.mkiv % we need to force a reload \useMPlibrary[txt]
+\useMPlibrary[txt]
So, how does this compare to earlier results? The original, full text as typeset
by \TEX, looks like:
@@ -974,11 +974,8 @@ define an offset too.
\startbuffer
\startuseMPgraphic{text vars}
- baselineskip := 8pt ;
- strutheight := (7.2/10) * baselineskip ;
- strutdepth := (2.8/10) * baselineskip ;
- offset := baselineskip/2 ;
- topskip := strutheight ;
+ MyOffset := LineHeight/2 ;
+ MyTopSkip := StrutHeight ;
\stopuseMPgraphic
\stopbuffer
@@ -999,8 +996,8 @@ dimensions.
hsize := xpart lrcorner p - xpart llcorner p ;
vsize := ypart urcorner p - ypart lrcorner p ;
- q := p xscaled ((hsize-2offset)/hsize)
- yscaled ((vsize-2offset)/vsize) ;
+ q := p xscaled ((hsize-2MyOffset)/hsize)
+ yscaled ((vsize-2MyOffset)/vsize) ;
hsize := xpart lrcorner q - xpart llcorner q ;
vsize := ypart urcorner q - ypart lrcorner q ;
@@ -1061,7 +1058,7 @@ Then we use \type {\useMPgraphic{text}} to call up the picture.
The offset is not optimal. Note the funny gap at the top. We could try to fix
this, but there is a better way to optimize both paths.
-We lower the top edge of \type {q}'s bounding box by \type {topskip}, then cut
+We lower the top edge of \type {q}'s bounding box by \type {MyTopSkip}, then cut
any part of the left and right pieces of \type {q} that lie above it. Similarly,
we raise the bottom edge and cut off the pieces that fall below this line.
@@ -1069,8 +1066,8 @@ we raise the bottom edge and cut off the pieces that fall below this line.
\startuseMPgraphic{text cutoff}
path tt, bb ;
- tt := (ulcorner q -- urcorner q) shifted (0,-topskip) ;
- bb := (llcorner q -- lrcorner q) shifted (0,strutdepth) ;
+ tt := (ulcorner q -- urcorner q) shifted (0,-MyTopSkip) ;
+ bb := (llcorner q -- lrcorner q) shifted (0,StrutDepth) ;
l := l cutbefore (l intersectionpoint tt) ;
l := l cutafter (l intersectionpoint bb) ;
@@ -1120,18 +1117,18 @@ line has a height and depth, we have to determine which part touches first.
\startuseMPgraphic{text calc}
vardef found_point (expr lin, pat, sig) =
pair a, b ;
- a := pat intersection_point (lin shifted (0,strutheight)) ;
+ a := pat intersection_point (lin shifted (0,StrutHeight)) ;
if intersection_found :
- a := a shifted (0,-strutheight) ;
+ a := a shifted (0,-StrutHeight) ;
else :
a := pat intersection_point lin ;
fi ;
- b := pat intersection_point (lin shifted (0,-strutdepth)) ;
+ b := pat intersection_point (lin shifted (0,-StrutDepth)) ;
if intersection_found :
if sig :
- if xpart b > xpart a : a := b shifted (0,strutdepth) fi ;
+ if xpart b > xpart a : a := b shifted (0,StrutDepth) fi ;
else :
- if xpart b < xpart a : a := b shifted (0,strutdepth) fi ;
+ if xpart b < xpart a : a := b shifted (0,StrutDepth) fi ;
fi ;
fi ;
a
@@ -1153,7 +1150,7 @@ subpath).
\startuseMPgraphic{text step}
path line; pair lll, rrr ;
- for i=topskip step baselineskip until vsize :
+ for i=MyTopSkip step LineHeight until vsize :
line := (ulcorner q -- urcorner q) shifted (0,-i) ;
@@ -1165,17 +1162,17 @@ subpath).
\typebuffer \getbuffer
Here we divide the available space in lines. The first line starts at \type
-{strutheight} from the top.
+{StrutHeight} from the top.
We can now finish our graphic by visualizing the lines. Both the height and depth
of the lines are shown.
\startbuffer
\startuseMPgraphic{text line}
- fill (lll--rrr--rrr shifted (0,strutheight)--lll
- shifted (0,strutheight)--cycle) withcolor .5white ;
- fill (lll--rrr--rrr shifted (0,-strutdepth)--lll
- shifted (0,-strutdepth)--cycle) withcolor .7white ;
+ fill (lll--rrr--rrr shifted (0,StrutHeight)--lll
+ shifted (0,StrutHeight)--cycle) withcolor .5white ;
+ fill (lll--rrr--rrr shifted (0,-StrutDepth)--lll
+ shifted (0,-StrutDepth)--cycle) withcolor .7white ;
draw lll withpen pencircle scaled 2pt ;
draw rrr withpen pencircle scaled 2pt ;
draw (lll--rrr) withpen pencircle scaled .5pt ;
@@ -1214,13 +1211,13 @@ we get better results when we (on purpose) take a smaller height.
\startuseMPgraphic{text step}
path line; pair lll, rrr ; numeric vvsize ;
- if (strutheight+strutdepth<baselineskip) :
+ if (StrutHeight+StrutDepth<LineHeight) :
vvsize := vsize ;
else :
- vvsize := (vsize div baselineskip) * baselineskip ;
+ vvsize := (vsize div LineHeight) * LineHeight ;
fi ;
- for i=topskip step baselineskip until vvsize :
+ for i=MyTopSkip step LineHeight until vvsize :
line := (ulcorner q -- urcorner q) shifted (0,-i) ;
@@ -1240,11 +1237,8 @@ better) results.
\startbuffer
\startuseMPgraphic{text vars}
-baselineskip := 8pt ;
-strutheight := 4pt ;
-strutdepth := 2pt ;
-offset := 4pt ;
-topskip := 3pt ;
+MyOffset := .5LineHeight ;
+MyTopSkip := StrutHeight ;
\stopuseMPgraphic
\stopbuffer
@@ -1261,8 +1255,8 @@ this is to let \METAPOST\ write a \type {\parshape} specification.
\startbuffer
\startuseMPgraphic{text macro}
- def provide_parshape (expr p, offset, baselineskip,
- strutheight, strutdepth, topskip) =
+ def provide_parshape (expr p, MyOffset, LineHeight,
+ StrutHeight, StrutDepth, MyTopSkip) =
\includeMPgraphic{text move}
\includeMPgraphic{text split}
@@ -1285,13 +1279,13 @@ the loop we write those values to a file using another loop.
\startuseMPgraphic{text loop}
path line; pair lll, rrr ; numeric vvsize, n ; n := 0 ;
- if (strutheight+strutdepth<baselineskip) :
+ if (StrutHeight+StrutDepth<LineHeight) :
vvsize := vsize ;
else :
- vvsize := (vsize div baselineskip) * baselineskip ;
+ vvsize := (vsize div LineHeight) * LineHeight ;
fi ;
- for i=topskip step baselineskip until vvsize :
+ for i=MyTopSkip step LineHeight until vvsize :
line := (ulcorner q -- urcorner q) shifted (0,-i) ;
@@ -1327,12 +1321,12 @@ We can call this macro using the part we used in the previous examples.
path p ; p := ((0,1)..(-1,0)..(1,0)--cycle) scaled 65pt ;
provide_parshape
- (p, % shape path
- .5*\baselinedistance, % offset
- \baselinedistance, % distance between lines
- \strutheight, % height of a line
- \strutdepth, % depth of a line
- \strutheight) ; % height of first line
+ (p, % shape path
+ .5*LineHeight, % offset
+ LineHeight, % distance between lines
+ StrutHeight, % height of a line
+ StrutDepth, % depth of a line
+ StrutHeight) ; % height of first line
\stopuseMPgraphic
\stopbuffer
@@ -1348,9 +1342,6 @@ macro gets the value of the graphic at hand.
\typefile{mfun-mp-data.txt}
-% \blank{\em todo: mp data file}\blank
-% \writestatus{!!!!}{todo: mp data file}
-
So, reading in this file at the start of a paragraph will setup \TEX\ to follow
this shape.
@@ -1389,23 +1380,22 @@ able to handle multiple shapes at once, like the next example demonstrates.
\index{graphics+libraries}
-The macro discussed in the previous section is included in one of the \METAPOST\
-libraries, so we first have to say:
+In \MKIV\ and \LMTX\ the \METAFUN\ driven text around a curve is a core
+functionality. In \LMTX\ the specific paragraph shape are available in the core
+too. Otherwise you need to load a module:
\startbuffer
\useMPlibrary[txt]
\stopbuffer
-\typebuffer
-
-\getbuffer
+\typebuffer \getbuffer
We define four shapes. They are not really beautiful, but they demonstrate what
happens in border cases. For instance, too small first lines are ignored. First
we define a circle. Watch how the dimensions are set in the graphic. The
arguments passed to \type {build_parshape} are: path, an offset, an additional
horizontal and vertical displacement, the baseline distance, the height and depth
-of the line, and the height of the first line (topskip in \TEX\ terminology). The
+of the line, and the height of the first line (MyTopSkip in \TEX\ terminology). The
height and depth of a line are often called strut height and depth, with a strut
being an invisible character with maximum dimensions.
@@ -1413,8 +1403,8 @@ being an invisible character with maximum dimensions.
\startuseMPgraphic{test 1}
path p ; p := fullcircle scaled 6cm ;
- build_parshape(p,6pt,0,0,\baselinedistance,
- \strutheight,\strutdepth,\strutheight) ;
+ build_parshape(p,6pt,0,0,LineHeight,
+ StrutHeight,StrutDepth,StrutHeight) ;
draw p withpen pencircle scaled 1pt ;
\stopuseMPgraphic
@@ -1429,8 +1419,8 @@ suits the small lines at the top and bottom.
\startuseMPgraphic{test 2}
path p ; p := fullsquare rotated 45 scaled 5cm ;
- build_parshape(p,6pt,0,0,\baselinedistance,
- \strutheight,\strutdepth,\strutheight) ;
+ build_parshape(p,6pt,0,0,LineHeight,
+ StrutHeight,StrutDepth,StrutHeight) ;
draw p withpen pencircle scaled 1pt ;
\stopuseMPgraphic
@@ -1447,8 +1437,8 @@ always trivial.
path p ; p := (.5w,h) -- (0,h) -- (0,0) -- (w,0) &
(w,0) .. (.75w,.5h) .. (w,h) & (w,h) -- cycle ;
- build_parshape(p,6pt,0,0,\baselinedistance,
- \strutheight,\strutdepth,\strutheight) ;
+ build_parshape(p,6pt,0,0,LineHeight,
+ StrutHeight,StrutDepth,StrutHeight) ;
draw p withpen pencircle scaled 1pt ;
\stopuseMPgraphic
@@ -1472,8 +1462,8 @@ needed, since we need these later on.
w := h := 6cm ; o := 6pt ; path p ; p := shape ;
w := h := 6cm ; o := 0pt ; path q ; q := shape ;
- build_parshape(p,q,6pt,6pt,\baselinedistance,
- \strutheight,\strutdepth,\strutheight) ;
+ build_parshape(p,q,6pt,6pt,LineHeight,
+ StrutHeight,StrutDepth,StrutHeight) ;
draw q withpen pencircle scaled 1pt ;
\stopuseMPgraphic
@@ -1514,14 +1504,11 @@ set to the current shape dimensions. The normal result is shown in \in {figure}
\startbuffer[shapes]
\startbuffer
-\setupframed
- [offset=overlay,align=normal,frame=off,
- width=\parwidth,height=\parheight]
\startcombination[2*2]
- {\framed[background=test 1]{\getshapetext}} {test 1}
- {\framed[background=test 2]{\getshapetext}} {test 2}
- {\framed[background=test 3]{\getshapetext}} {test 3}
- {\framed[background=test 4]{\getshapetext}} {test 4}
+ {\framed[offset=overlay,frame=off,background=test 1]{\getshapetext}} {test 1}
+ {\framed[offset=overlay,frame=off,background=test 2]{\getshapetext}} {test 2}
+ {\framed[offset=overlay,frame=off,background=test 3]{\getshapetext}} {test 3}
+ {\framed[offset=overlay,frame=off,background=test 4]{\getshapetext}} {test 4}
\stopcombination
\stopbuffer
\stopbuffer
@@ -1591,8 +1578,8 @@ define a quote typeset in a circular paragraph shape.
\startbuffer[shape]
\startuseMPgraphic{center}
- build_parshape(fullcircle scaled 8cm,0,0,0,\baselinedistance,
- \strutheight,\strutdepth,\strutheight) ;
+ build_parshape(fullcircle scaled 8cm,0,0,0,LineHeight,
+ StrutHeight,StrutDepth,StrutHeight) ;
\stopuseMPgraphic
\startshapetext[center]
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-welcome.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-welcome.tex
index 425d1579611..725d03756c4 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-welcome.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun-welcome.tex
@@ -3497,6 +3497,70 @@ line properties.
\stopsection
+\startsection[title={\UTF8}]
+
+The \METAPOST\ library used in \LUATEX\ and \LUAMETATEX\ supports \UTF8\ input.
+Actually there is not much magic needed to do this because all the engine in
+interested in is bytes and some just have a special meaning (like parenthesis,
+symbols that have a meaning in formulas etc).
+
+\startbuffer
+save p ; pen p ; p := currentpen ;
+pickup pencircle scaled .05;
+
+picture ○ ; ○ := image (draw fullcircle) ;
+picture ◎ ; ◎ := image (draw fullcircle ; draw fullcircle scaled .5) ;
+
+draw ◎ ysized 2cm withcolor darkblue ;
+draw ○ xsized 2cm shifted (3cm,0) withcolor darkgreen ;
+draw ○ xysized (3cm,2cm) shifted (7cm,0) withcolor darkred ;
+\stopbuffer
+
+\typebuffer
+
+Here we use a \UTF8\ encoded character as macro name and the next image
+demonstrate that it does work indeed:
+
+\startlinecorrection[blank] \processMPbuffer \stoplinecorrection
+
+You can do crazy things like use emoji for special operators
+
+\startbuffer
+def ✏ = withpen pencircle enddef ;
+def ✖️ = scaled enddef ;
+fill fullsquare ✖️ 1cm ✏ ✖️ 1mm withcolor darkgray ;
+draw fullsquare ✖️ 1cm ✏ ✖️ 1mm withcolor darkblue ;
+\stopbuffer
+
+\typebuffer
+
+But do we really want to go there?
+
+\startlinecorrection[blank] \processMPbuffer \stoplinecorrection
+
+Normally using \UTF8\ makes more sense in text or regular macro names, so if you
+want to use accented characters it is possible:
+
+\startbuffer
+def rændömîzèd = randomized 1/10 enddef ;
+
+draw textext ("\strut rændömîzèd") ;
+draw boundingbox currentpicture rændömîzèd
+ enlarged 2mm
+ withpen pencircle scaled 1mm
+ withcolor darkgreen ;
+\stopbuffer
+
+\typebuffer
+
+\page[preference]
+
+it really does work:
+
+\startlinecorrection[blank] \processMPbuffer \stoplinecorrection
+
+\stopsection
+
\stopchapter
\stopcomponent
diff --git a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun.tex b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun.tex
index dc90bb61157..6739b1ed537 100644
--- a/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun.tex
+++ b/Master/texmf-dist/doc/context/sources/general/manuals/metafun/metafun.tex
@@ -28,19 +28,21 @@
%
% comment : This is one of the manuals that can be ordered at http://www.h2o-books.com and
% it's actually meant to be read on paper.
+%
+% comment : Before I started updating the manual to lmtx (luametafun) I made sure that it
+% processed okay in the february 2021 version of lmtx. The runtime for 448 pages
+% (which is 20 more than the previous test) is some 16.5 seconds (just below 16
+% with compact fonts). So we can safely conclude that we're not worse off with
+% respect to performance. (I use the same machine.)
-\enabledirectives[hyphenator.optimize]
-\enabledirectives[hyphenator.flatten]
-% \setuphyphenation[method=traditional]
+% \enableexperiments[fonts.compact]
-% \enabletrackers[*defin*]
+% \enablemode[optional]
% \enablemode[screen]
\enablemode[print]
% \enablemode[book]
-% \usemodule[luacalls]
-
% todo: check startintro .. stopintro each chapter
% \showframe
@@ -75,7 +77,11 @@
\component metafun-gadgets
\component metafun-effects
\component metafun-functions
+\ifcase\contextlmtxmode
\component metafun-text
+\else
+ \component metafun-text-lmtx
+\fi
\component metafun-debugging
\component metafun-styles
\component metafun-examples