diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:49:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:49:34 +0000 |
commit | 0bf7dc87971bc4f426fb6abdd893a26a6ae65d0b (patch) | |
tree | 4d53bded23dec78efc81b258f039469fa2832271 /Master/texmf-dist/source/metafont | |
parent | d780c57e68c80655669a3b01af46b9978f5698ef (diff) |
trunk/Master/texmf-dist/source/metafont
git-svn-id: svn://tug.org/texlive/trunk@116 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/metafont')
37 files changed, 1664 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/metafont/mftoeps/0mftoeps.doc b/Master/texmf-dist/source/metafont/mftoeps/0mftoeps.doc new file mode 100644 index 00000000000..4edfd06cd3a --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/0mftoeps.doc @@ -0,0 +1,218 @@ +This file belongs to the MFTOEPS package. + +----------------------------------------------------------------------------- + +OVERVIEW + +The package MFTOEPS belongs to the public domain. You are entitled to do with +the files of which it consists whatever you wish. If you alter a file, +however, please remove the line containing the comment + + `This file belongs to the MFTOEPS package.' + +in order to avoid a mess. + +The kernel of this little package is the METAFONT program MFTOEPS.MF written +by Bogus\l{}aw Jackowski, Piotr Pianowski and Marek Ry\'cko. The aim of the +program is to produce EPS (encapsulated PostScript) files readable by +CorelDRAW!(R), Adobe Illustrator(TM) and Fontographer(R). + +The user of the package is supposed to be familiar a bit with METAFONT and +PostScript. Donald E. Knuth's ``The METAFONTbook'' and Adobe's ``PostScript +Language Reference Manual'' (both by Addison-Wesley Publishing Company, Inc.) +should be consulted in the case of doubts. + +There is a bunch of simple examples in the subdirectory M2ESAMP. The +directory ../PROGS contains DOS batch files and other programs which, +possibly after some adjustments, can be used to generate EPS files. + +Roughly, the machinery works as follows: the resulting PostScript code +is written by METAFONT to a LOG file; the LOG file is then processed +either by AWK or by TeX (see the PROGS subdirectory) in order to extract +the PostScript code. The idea seems straightforward; however, even +a partial conciliation of the worlds of CorelDRAW! and Adobe Illustrator +was not so much straightforward. + +----------------------------------------------------------------------------- + +In addition to the main MFTOEPS package, there are two ``bonus'' packages in +directories ../EPSTOMF and ../ROEX. EPSTOMF converts ``canonical'' EPS files, +i.e., files conforming the structure of the files generated by the MFTOEPS +package, into the METAFONT lingo; ROEX is a set of METAFONT macros +accomplishing the task of removing overlaps and expanding strokes (for +details see there). + +----------------------------------------------------------------------------- + +INTERFACE SYNOPSIS + +Conventions: In the following we shall use words `number,' `pair,' `string,' +and `path' as an abbreviation for `numeric expression,' `pair expression,' +`string expression,' and `path expression,' respectively. The signs `less' +and `greater,' used for marking parameters of macros, are +``meta-characters,'' i.e., they do not belong to the METAFONT code. + +There are fifteen interface macros defined in the MFTOEPS.MF file: + eps_mode_setup + write_preamble + write_postamble + set_BB + find_BB + reset_BB + fill_C + draw_C + clip_C + fix_line_width + fix_line_join + fix_line_cap + fix_line_miter_limit + fix_fill_cmyk + fix_draw_cmyk + +COMMAND eps_mode_setup +USAGE eps_mode_setup <an optional number (0 or 1)>; +REMARKS This command should be used instead of the usual |mode_setup| + command. The forms |EPS_mode_setup| and |EPS_mode_setup 1| + are equivalent. One of them (preferably the former one) should + be used for normal processing. Invoking |EPS_mode_setup 0| + is meant primariliy for testing purposes and is supposed + to be used by experienced programmers who know what they are doing. + There are two predefined constants in MFTOEPS.MF to be used in this + context, namely, |no_export_level=0| and |compatibility_level=1|. + It is advisable to use the names of the constants rather than + bare numbers. + +COMMAND write_preamble +USAGE write_preamble <string>; +REMARKS This command initialises the process of writing of the PostScript + code. The string expression is the name (without extension) + of the resulting EPS file; the extension is always |.EPS|. + METAFONT is switched to the |batchmode| in order to avoid + slowing down the process by writing mess(ages) to the terminal. + The inspection of the log file is thus highly recommended. + +COMMAND write_postamble +USAGE write_postamble; +REMARKS This command ends writing of the PostScript code, switches METAFONT + back to the |errorstopmode|, and performs neccessary ``last minute'' + actions (see below). + +COMMANDS set_BB find_BB reset_BB +USAGE set_BB <four numbers or two pairs separated by commas>; + find_BB <a list of paths separated by commas>; + reset_BB; +REMARKS Commands |set_BB| or |find_BB| should be invoked prior to + invoking |write_preamble|. |set_BB| sets the coordinates of + the corners of the bounding box of a graphic object; it is + useful when the bounding box of a graphic object is + known in advance or if it is required to force an artificial + bounding box. |find_BB| computes the respective bounding box + for a list of paths; if several |find_BB| statements are + used, the common bounding box is calculated for all paths + that appeared in the arguments. The result is stored in the + variables |xl_crd|, |yl_crd|, |xh_crd|, and |yh_crd|. There + are two functions, |llxy| and |urxy|, returning pairs + |(xl_crd,yl_crd)| and |(xh_crd,yh_crd)|, respectively. The + last command, |reset_BB|, makes |xl_crd|, |yl_crd|, + |xh_crd|, and |yh_crd| undefined (the initial situation); + |reset_BB| is performed by the |write_postamble| macro, + which is convenient in the case of generating several + several EPS files in a single METAFONT run. + +COMMANDS fill_C draw_C +USAGE fill_C <a list of paths separated by commas>; + draw_C <a list of paths separated by commas>; +REMARKS These commands are to be used instead of the usual + METAFONT |fill| and |draw| ones. They cause that a list of paths + followed by the PostScript operation |eofill| (|fill_C|) or |stroke| + (|draw_C|) is translated to a PostScript code. The list of paths + constitutes a single curve in the sense of PostScript. + +COMMAND clip_C +USAGE clip_C <a list of paths separated by commas, possibly empty>; +REMARKS The macro |clip_C| with a non-empty parameter works similarly to + the |fill_C| command, except that the |eoclip| operator is issued + instead of |eofill|. This causes an appropriate change of + the current clipping area. According to PostScript's principles, + the resulting area is a set product of the current clipping + area and the area specified in the argument of the |eoclip| + command. The empty parameter marks the end of the scope + of the most recent |clip_C| command with a non-empty parameter. + In other words, nested |clip_C| commands form a ``stack'' structure. + If needed, the appropriate number of parameterless |clip_C| + commands is issued by the |write_postamble| macro, thus + the user needs not to care about it. + WARNING: files produced with the use of |clip_C| are + interpreted properly by Adobe Illustrator (provided paths + directions are defined properly) but not by CorelDRAW! (ver. 3.0). + +COMMANDS fix_line_width fix_line_join fix_line_cap fix_miter_limit fix_dash +USAGE fix_line_width <a non-negative number (dimension)>; + fix_line_join <a number (0, 1 or 2)>; + fix_line_cap <a number (0, 1 or 2)>; + fix_miter_limit <a number greater or equal 1>; + fix_dash (<a list of numbers (dimensions), possibly empty>) + <number (dimension)>; +REMARKS These command are to be used in connection with the |draw_C| + command. |fix_line_width| fixes the thickness of the outline. + The other three commands correspond to PostScript operations + |setlinejoin|, |setlinecap|, |setmiterlimit|, and |setdash| (see + ``PostScript Language Reference Journal'' for details). + + All commands should be used after |write_preamble|, as + |write_preamble| sets the default thickness (0.4pt), default + line join (0), default line cap (0), default miter limit (10), + and a solid line as a default for stroking (|fix_dash () 0|). + +COMMANDS fix_fill_cmyk fix_draw_cmyk +USAGE fix_fill_cmyk <four numbers separated by commas>; + fix_draw_cmyk <four numbers separated by commas>; +REMARKS These commands define the colours of the interiors of graphic + objects (|fix_fill_cmyk|) and colours of outlines (|fix_draw_cmyk|) + using cyan-magenta-yellow-black model (basic model). They should + be used after |write_preamble| (because |write_preamble| defines + the black colour as a default for both macros) and prior to invoking + the corresponding |fill_C| and |draw_C| commands, respectively. + There are also (just in case) macros |fix_fill_rgb| and + |fix_draw_rgb| using red-green-blue model; the argument to both + macros is a triple of numbers. (The user can control the process + of conversion from RGB to CMYK by the redefinition of macros + |under_color_removal| and |black_generation|.) The numbers + forming the arguments of the macros are supposed to belong to + the interval [0..1]. + +ADDITIONAL FUNCTIONS pos_turn neg_turn +USAGE pos_turn <primary path expression> + neg_turn <primary path expression> +REMARKS Each function returns the path passed as the argument, + except that the orientation of the path is changed, if + necessary: |pos_turn| returns paths oriented anti-clockwise, + |neg_turn|---oriented clockwise. This may be + usefull for creation pictures which are to be processed + further by Adobe Illustrator, because this program is + sensitive to the orientation of paths. + +CONTROL VARIABLES yeseps yesEPS YESEPS +REMARKS No EPS file will be generated unless one variable among + |yeseps| or |yesEPS| or |YESEPS| is assigned a definite value. + It is advisable to set this variable in a command line + (see M2E.BAT and M2E-ALT.BAT in the PROGS directory). + In fact, using |yeseps| is reccomended. Aliases |yesEPS| + and |YESEPS| were introduced for ``historical'' reasons. + +CONTROL VARIABLE testing +REMARKS If the variable |testing| is assigned a definite value, the whole + PostScript code is flushed to the terminal, thus slowing + down significantly the process of generation of an EPS file + (cf. the description of the |write_preamble| command). + +----------------------------------------------------------------------------- + +ENCOURAGEMENT + +The inspection of the source code of the MFTOEPS.MF program may reveal +a few more useful macros. + +----------------------------------------------------------------------------- + +END OF THE 0MFTOEPS.DOC FILE diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/0m2esamp.doc b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/0m2esamp.doc new file mode 100644 index 00000000000..fd27e761c4a --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/0m2esamp.doc @@ -0,0 +1,35 @@ +This file belongs to the MFTOEPS package. + +The directory M2ESAMP contains the following files: + 0M2ESAMP.DOC this file + CLIPCIR.MF a bogus application of clipping: a variation of CLIPSQR.MF + CLIPSQR.MF a bogus application of clipping: Sierpi\'nski's carpet + HOLECLIP.MF a nearly trivial example + HOLECLIP.TEX an example of using HOLECLIP.EPS + HOLEFILL.MF a nearly trivial example + POLYGONS.MF input for SAMPLE*.MF files + RECTAN.MF a truly trivial example + RECTAN_.BAT DOS batch file for RECTAN.MF (generates RECTAN.EPS) + SAMPLE1A.MF less trivial example + SAMPLE1B.MF modification of SAMPLE1A.MF + SAMPLE2A.MF regular polygon with circumscribed ``flex'' polygon + SAMPLE2B.MF ditto---a variation + SAMPLE2C.MF ditto---a variation + SAMPLE2D.MF ditto---a variation + SAMPLE2E.MF ditto---a variation + SAMPLE3.MF four pictures (``flowers'') + SAMPLE4.MF four pictures (``galaxies'') + SAMPLE5.MF four pictures (``shells'') + STEREO.MF two pictures that can be used for + constructing a simple stereogram + +You are entitled to do with these files whatever you wish. If you alter +a file, however, please remove the comment line: + + `This file belongs to the MFTOEPS package.' + +in order to avoid mess. + +----------------------------------------------------------------------------- + +END OF THE 0M2ESAMP.DOC FILE diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipcir.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipcir.mf new file mode 100644 index 00000000000..50cf091764a --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipcir.mf @@ -0,0 +1,39 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% CLIPCIR.MF +% --- +input mftoeps; eps_mode_setup; +% --- +def ^ = ** enddef; % syntactic sugar +primarydef i // n = % ditto + (if n=0: 0 else: i/n fi) +% why not to divide by 0? +enddef; +def shifted_accordingly(expr i,j,n,D)= + shifted ((i//n)[1/2D,w-1/2D],(j//n)[1/2D,w-1/2D]) +enddef; +% --- +w#=16mm#; h#=16mm#; define_pixels(w,h); +for N:=1,2,3,4: % 5, 6, ..., infinity + set_BB 0,0,w,h; + write_preamble jobname & decimal(N); + D:=2w; + for n:=0 for q:=1 upto N-1: , 2^q-1 endfor: +% i.e., |for n:=0, 2^1-1, 2^2-1, ..., 2^(N-1)-1:| + path p[], q[]; D:=1/2D; k:=-1; + for i:=0 upto n: for j:=0 upto n: + k:=k+1; + p[k]=fullcircle scaled D + shifted_accordingly(i,j,n,D); + q[k]=reverse fullcircle scaled 1/3D + shifted_accordingly(i,j,n,D); + endfor; endfor; + clip_C p0, q0 for i:=1 upto k: , p[i], q[i] endfor; + endfor; + fill_C unitsquare scaled w; + write_postamble; +endfor; +% --- +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf new file mode 100644 index 00000000000..266ec217ae8 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/clipsqu.mf @@ -0,0 +1,39 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% CLIPSQU.MF (Sierpi\'nski's carpet) +% --- +input mftoeps; eps_mode_setup; +% --- +def ^ = ** enddef; % syntactic sugar +primarydef i // n = % ditto + (if n=0: 0 else: i/n fi) +% why not to divide by 0? +enddef; +def shifted_accordingly(expr i,j,n,D)= + shifted ((i//n)[0,w-D],(j//n)[0,w-D]) +enddef; +% --- +w#=16mm#; h#=16mm#; define_pixels(w,h); +for N:=1,2,3: % 4, 5, 6, ..., infinity + set_BB 0,0,w,h; + write_preamble jobname & decimal(N); + D:=3w; + for n:=0 for q:=1 upto N-1: , 3^q-1 endfor: +% i.e., |for n:=0, 3^1-1, 3^2-1, ..., 3^(N-1)-1:| + path p[], q[]; D:=1/3D; k:=-1; + for i:=0 upto n: for j:=0 upto n: + k:=k+1; + p[k]=unitsquare scaled D + shifted_accordingly(i,j,n,D); + q[k]=reverse unitsquare scaled 1/3D + shifted (1/3D,1/3D) shifted_accordingly(i,j,n,D); + endfor; endfor; + clip_C p0, q0 for i:=1 upto k: , p[i], q[i] endfor; + endfor; + fill_C unitsquare scaled w; + write_postamble; +endfor; +% --- +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holeclip.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holeclip.mf new file mode 100644 index 00000000000..0b5850a8892 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holeclip.mf @@ -0,0 +1,20 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% HOLECLIP.MF---a nearly trivial example +% --- +input mftoeps; eps_mode_setup; +w#=4cm#; h#=2cm#; define_pixels(w,h); +set_BB origin, (w,h); +write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + for oper:="draw_C", "clip_C": + scantokens oper +% outer edge: + fullcircle xscaled w yscaled h shifted (.5w,.5h), +% inner edge: + reverse fullcircle xscaled .7w yscaled .7h shifted (.5w,.5h); + endfor +write_postamble; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holeclip.tex b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holeclip.tex new file mode 100644 index 00000000000..8f314a6ba89 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holeclip.tex @@ -0,0 +1,22 @@ +\input epsf + +\centerline{ +\setbox0\vbox{ + \hbox{It is a clipped text.}\hbox{It is a clipped text.} + \hbox{It is a clipped text.}\hbox{It is a clipped text.} + \vss % no depth +}% +\special{ps: + /mftoeps_save save def % the snapshoot of a current stage + /mftoeps_bhook {/q {} def /Q {} def} def + /CM matrix currentmatrix def + currentpoint /cy exch def /cx exch def + /ori@endspecial /@endspecial load def + /@endspecial {} def % neutralize /@endspecial locally +} +\hbox to\wd0{\hss\epsfysize\ht0\epsffile{holeclip.eps}\hss}% perform clipping +\special{ps:cx cy moveto CM setmatrix}\llap{\copy0}% set the text +\special{ps:ori@endspecial mftoeps_save restore}% restore a previous stage +} + +\end diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holefill.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holefill.mf new file mode 100644 index 00000000000..7478df585de --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/holefill.mf @@ -0,0 +1,21 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% HOLEFILL.MF---a nearly trivial example +% --- +input mftoeps; eps_mode_setup; +w#=4cm#; h#=2cm#; define_pixels(w,h); +set_BB origin, (w,h); +write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + fix_line_width 1pt; + for oper:="draw_C", "fill_C": + scantokens oper +% outer edge: + fullcircle xscaled w yscaled h shifted (.5w,.5h), +% inner edge: + reverse fullcircle xscaled .7w yscaled .7h shifted (.5w,.5h); + endfor +write_postamble; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf new file mode 100644 index 00000000000..29d370d8ee6 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/polygons.mf @@ -0,0 +1,32 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% POLYGONS.MF +% --- +vardef regular_polygon(expr n) = +% |n| is the number of vertices; the diameter of the circumscribed circle +% is equal to 1, its center is in the origin + (up % first vertex + for i:=1 upto n-1: + -- (up rotated (i*(360/n))) % next vertices + endfor + -- cycle) scaled .5 +enddef; +vardef flex_polygon(expr n,a,b) = +% |n| is the number of vertices, |a|, |b| are the angles (at vertices) +% between a tangent to a ``flex side'' and the corresponding secant + save zz; pair zz[ ]; % array of vertices + for i:=0 upto n-1: + zz[i]:=up rotated (i*(360/n)); + endfor + (zz[0] {(zz[1]-zz[0]) rotated a} + for i:=1 upto n-1: + .. {(zz[i]-zz[i-1]) rotated b} + zz[i] + {(zz[(i+1) mod n]-zz[i]) rotated a} + endfor + .. {(zz[0]-zz[n-1]) rotated b} cycle) + scaled .5 +enddef; +endinput diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/rectan.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/rectan.mf new file mode 100644 index 00000000000..63802ab54d0 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/rectan.mf @@ -0,0 +1,19 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% RECTAN.MF---a trivial example +% --- +input mftoeps; +EPS_mode_setup; +beginchar(48, % ASCII code (unimportant) + 2cm#, % width + 1cm#, % height + 0cm# % depth + ); + set_BB 0,-d,w,h; % coordinates of the corners of the bounding box + write_preamble "rectan"; + fill_C unitsquare xscaled w yscaled h; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/rectan_.bat b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/rectan_.bat new file mode 100644 index 00000000000..b344676ca6e --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/rectan_.bat @@ -0,0 +1,4 @@ +::
+:: This file belongs to the MFTOEPS package.
+::
+call m2e rectan
diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample1a.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample1a.mf new file mode 100644 index 00000000000..cd34bd33077 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample1a.mf @@ -0,0 +1,24 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE1A.MF +% --- +input polygons; % the definition of the |regular_polygon| function +input mftoeps; +eps_mode_setup; +beginchar(0,2cm#,2cm#,0); + path P[ ]; % ,,room'' for polygons + N:=25; % the number of polygons +% preparing: + for i:=1 upto N: + P[i]:=regular_polygon(7) + scaled ((i/N)**2*w) rotated (i/N*360) shifted (.5w,.5h); + endfor; +% exporting: + find_BB for i:=1 upto N-1: P[i], endfor P[N]; + write_preamble jobname; + draw_C for i:=1 upto N-1: P[i], endfor P[N]; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample1b.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample1b.mf new file mode 100644 index 00000000000..499650af1fa --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample1b.mf @@ -0,0 +1,28 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE1B.MF +% --- +input polygons; % the definition of the |regular_polygon| function +input mftoeps; +eps_mode_setup; +beginchar(0,2cm#,2cm#,0); + path P[ ]; % ,,room'' for polygons + N:=25; % the number of polygons +% preparing: + for i:=1 upto N: + P[i]:=regular_polygon(7) + scaled ((i/N)**2*w) rotated (i/N*360) shifted (.5w,.5h); + endfor; +% exporting: + find_BB for i:=1 upto N-1: P[i], endfor P[N]; + write_preamble jobname; +% Adobe Illustrator likes to control the orientation of paths + fill_C + for i:=1 upto N-1: + if odd(N-i+1): pos_turn else: neg_turn fi P[i], + endfor pos_turn P[N]; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2a.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2a.mf new file mode 100644 index 00000000000..ef34b34ea84 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2a.mf @@ -0,0 +1,23 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE2A.MF +% --- +input polygons; +input mftoeps; +eps_mode_setup; +beginchar(0,16mm#,16mm#,0); + path P[ ]; % ``room'' for two polygons +% preparing: + P[1]:=regular_polygon(7) scaled w shifted (.5w,.5h); + P[2]:=flex_polygon(7,0,0) scaled w shifted (.5w,.5h); +% exporting: + find_BB P[1], P[2]; + write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + fix_line_width 1pt; + fill_C P1; draw_C P2; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2b.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2b.mf new file mode 100644 index 00000000000..e6d82b3175e --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2b.mf @@ -0,0 +1,23 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE2B.MF +% --- +input polygons; +input mftoeps; +eps_mode_setup; +beginchar(0,16mm#,16mm#,0); + path P[ ]; % ``room'' for two polygons +% preparing: + P[1]:=regular_polygon(7) scaled w shifted (.5w,.5h); + P[2]:=flex_polygon(7,-180/7,180/7) scaled w shifted (.5w,.5h); +% exporting: + find_BB P[1], P[2]; + write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + fix_line_width 1pt; + fill_C P1; draw_C P2; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2c.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2c.mf new file mode 100644 index 00000000000..2a2ebffb4fb --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2c.mf @@ -0,0 +1,23 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE2C.MF +% --- +input polygons; +input mftoeps; +eps_mode_setup; +beginchar(0,16mm#,16mm#,0); + path P[ ]; % ``room'' for two polygons +% preparing: + P[1]:=regular_polygon(7) scaled w shifted (.5w,.5h); + P[2]:=flex_polygon(7,45,45) scaled w shifted (.5w,.5h); +% exporting: + find_BB P[1], P[2]; + write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + fix_line_width 1pt; + fill_C P1; draw_C P2; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2d.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2d.mf new file mode 100644 index 00000000000..8fe9f9bfb5f --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2d.mf @@ -0,0 +1,23 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE2D.MF +% --- +input polygons; +input mftoeps; +eps_mode_setup; +beginchar(0,16mm#,16mm#,0); + path P[ ]; % ``room'' for two polygons +% preparing: + P[1]:=regular_polygon(7) scaled w shifted (.5w,.5h); + P[2]:=flex_polygon(7,-45,45) scaled w shifted (.5w,.5h); +% exporting: + find_BB P[1], P[2]; + write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + fix_line_width 1pt; + fill_C P1; draw_C P2; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2e.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2e.mf new file mode 100644 index 00000000000..9411c1db405 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample2e.mf @@ -0,0 +1,23 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE2E.MF +% --- +input polygons; +input mftoeps; +eps_mode_setup; +beginchar(0,16mm#,16mm#,0); + path P[ ]; % ``room'' for two polygons +% preparing: + P[1]:=regular_polygon(7) scaled w shifted (.5w,.5h); + P[2]:=flex_polygon(7,45,-45) scaled w shifted (.5w,.5h); +% exporting: + find_BB P[1], P[2]; + write_preamble jobname; + fix_fill_cmyk 0,0,0,.25; % 25 percent of black + fix_line_width 1pt; + fill_C P1; draw_C P2; + write_postamble; +endchar; +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample3.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample3.mf new file mode 100644 index 00000000000..c58756e37a6 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample3.mf @@ -0,0 +1,53 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE3.MF +% --- +input mftoeps; +input polygons; +eps_mode_setup; +% unpercent the following line if the coloured version is needed +% coloured:=1; +% --- +def write_paths(expr name) = + find_BB elem_path1; + write_preamble name; + for i:=1 upto objects: + coeff:= + if objects=1: 0 else: .5(1-cosd(((i-1)/(objects-1))[alpha1,alpha2])) fi; + fix_fill_cmyk forsuffixes $:=cyan, magenta, yellow: coeff[$1,$2], endfor + coeff[black1,black2]; + fill_C elem_path[i]; + endfor; + write_postamble; +enddef; +% --- +ch_max:=3; +% --- +for ch:=0 upto ch_max: + beginchar(char(ASCII("a")+ch), 1in#, 1in#, 0); + path elem_path[\\]; + objects:=100; transitions:=3; + sca1:=w; sca2:=.02w; + rot1:=0; rot2:=(ch/ch_max)[25,180]; + skew1:=45; skew2:=0; + alpha1:=0; alpha2:=transitions*360; + if known coloured: + cyan1:=0; magenta1:=0; yellow1:=1; black1:=0; + cyan2:=0.35294; magenta2:=0.8353; yellow2:=0.8353; black2:=0; % brown + else: + cyan1:=0; magenta1:=0; yellow1:=0; black1:=0.7; + cyan2:=0; magenta2:=0; yellow2:=0; black2:=0.15; + fi + for i:=1 upto objects: + coeff:=if objects=1: 0 else: (i-1)/(objects-1) fi; + elem_path[i]:=flex_polygon(5,coeff[skew1,skew2],coeff[skew1,skew2]) + scaled (coeff[sca1,sca2]) + rotated (coeff[rot1,rot2]) shifted (.5w,.5h); + endfor + write_paths(jobname & char(ASCII("a")+ch)); + endchar; +endfor +% --- +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample4.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample4.mf new file mode 100644 index 00000000000..37acefb4d05 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample4.mf @@ -0,0 +1,45 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE4.MF +% --- +input mftoeps; +input polygons; +eps_mode_setup; +% --- +def write_paths(expr name) = + find_BB elem_path1; + write_preamble name; + for i:=1 upto objects: + coeff:= + if objects=1: 0 else: .5(1-cosd(((i-1)/(objects-1))[alpha1,alpha2])) fi; + fix_fill_cmyk forsuffixes $:=cyan, magenta, yellow: coeff[$1,$2], endfor + coeff[black1,black2]; + fill_C elem_path[i]; + endfor; + write_postamble; +enddef; +% --- +ch_max:=3; +% --- +for ch:=0 upto ch_max: + beginchar(char(ASCII("a")+ch), 1in#, 1in#, 0); + path elem_path[\\]; + objects:=100; transitions:=.5; % regular 2 + sca1:=w; sca2:=.05w; + rot1:=0; rot2:=(ch/ch_max)[0,-360]; + alpha1:=0; alpha2:=transitions*360; + cyan1:=0; magenta1:=0; yellow1:=0; black1:=0.05; + cyan2:=0; magenta2:=0; yellow2:=0; black2:=0.9; + for i:=1 upto objects: + coeff:=if objects=1: 0 else: (i-1)/(objects-1) fi; + elem_path[i]:= flex_polygon(6,(coeff**.1)[-30,0],(coeff**.1)[30,0]) + scaled (coeff[sca1,sca2]) + rotated (coeff[rot1,rot2]+30) shifted (.5w,.5h); + endfor + write_paths(jobname & char(ASCII("a")+ch)); + endchar; +endfor +% --- +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample5.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample5.mf new file mode 100644 index 00000000000..c7e0c7742b3 --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample5.mf @@ -0,0 +1,38 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% SAMPLE5.MF +% --- +input mftoeps; +input polygons; +eps_mode_setup; +% --- +def soft_polygon (expr n,a) = flex_polygon(n,a-180/n,a+180/n) enddef; +% --- +def write_paths(expr name) = + find_BB for i:=1 upto objects: elem_path[i], endfor elem_path[objects]; + write_preamble name; + fix_line_width .2pt; for i:=1 upto objects: draw_C elem_path[i]; endfor; + write_postamble; +enddef; +% --- +ch_max:=3; +% --- +for ch:=0 upto ch_max: + beginchar(char(ASCII("a")+ch), 1in#, 1in#, 0); + path elem_path[\\]; + objects:=17; + sca1:=.85w; sca2:=.02w; + rot1:=0; rot2:=(ch/ch_max)[5,120]; + skew1:=(ch/ch_max)[60,30]; skew2:=0; + for i:=1 upto objects: + coeff:=if objects=1: 0 else: (i-1)/(objects-1) fi; + elem_path[i]:= soft_polygon(7,coeff[skew1,skew2]) + scaled (coeff[sca1,sca2]) rotated (coeff[rot1,rot2]+30) shifted (.5w,.5h); + endfor + write_paths(jobname & char(ASCII("a")+ch)); + endchar; +endfor +% --- +end. diff --git a/Master/texmf-dist/source/metafont/mftoeps/m2esamp/stereo.mf b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/stereo.mf new file mode 100644 index 00000000000..c3e85ec53fe --- /dev/null +++ b/Master/texmf-dist/source/metafont/mftoeps/m2esamp/stereo.mf @@ -0,0 +1,53 @@ +%%%% +%%%% This file belongs to the MFTOEPS package. +%%%% +% --- +% STEREO.MF +% --- +input mftoeps; +input polygons; +eps_mode_setup; +% --- +def soft_polygon (expr n,a) = flex_polygon(n,a-180/n,a+180/n) enddef; +% --- +def write_paths(expr name) = + find_BB for i:=1 upto objects: elem_path[i], endfor elem_path[objects]; + write_preamble name; + for i:=1 upto objects: + coeff:= + if objects=1: 0 else: .5(1-cosd(((i-1)/(objects-1))[alpha1,alpha2])) fi; + coeff:=if coeff>.5: 1 else: 0 fi; + fix_fill_cmyk forsuffixes $:=cyan, magenta, yellow: coeff[$1,$2], endfor + coeff[black1,black2]; + fill_C elem_path[i]; + endfor; + write_postamble; +enddef; +% --- +for ch:=0,1: + beginchar("0",117pt#, 117pt#, 0); + path elem_path[\\]; + objects:=100; transitions:=7; + pair cent[\\]; + sca1:=.5w; sca2:=.01w; + skew1:=60; skew2:=0; + alpha1:=0; alpha2:=transitions*360; + cshift0:=-.02w; cshift1:=-cshift0; + cent1:=(.5w,.5h); + rot1:=0; rot2:=rot1+60; + cent2:=(.5w+cshift[ch],.49h); + cyan1:=0; magenta1:=0; yellow1:=0; black1:=1; + cyan2:=0; magenta2:=0; yellow2:=0; black2:=0; + for i:=1 upto objects: + if objects=1: coeff:=0; else: coeff:=(i-1)/(objects-1); fi + elem_path[i]:= soft_polygon(4,coeff[skew1,skew2]) + scaled (coeff[sca1,sca2]) + rotated (coeff[rot1,rot2]+30) + shifted (coeff[cent1,cent2]); + endfor + write_paths(jobname & decimal(ch)); +endchar; + +endfor + +end. diff --git a/Master/texmf-dist/source/metafont/roex/0roex.doc b/Master/texmf-dist/source/metafont/roex/0roex.doc new file mode 100644 index 00000000000..0887e2df6ca --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/0roex.doc @@ -0,0 +1,36 @@ +This file belongs to the ROEX package. + +----------------------------------------------------------------------------- + +OVERVIEW + +The package ROEX belongs to the public domain. You are entitled to do with +the files of which it consists whatever you wish. If you alter a file, +however, please remove the line containing the comment + + `This file belongs to the ROEX package.' + +in order to avoid a mess. + +The ROEX.MF file contains a set of METAFONT macros accomplishing the +task of removing overlaps and expanding strokes. The algorithm was +suggested by Stefan Soko\l{}owski, the implementation was done +by Bogus\l{}aw Jackowski, Piotr Pianowski and Marek Ry\'cko. + +The operations of removing overlaps and expanding strokes are especially +useful in context of PostScript, hence all examples make use of the MFTOEPS +package; however, PostScript here is not essential. + +Detailed description of the macros can be found in the file ROEX.MF, +examples of using the package can be found in the subdirectory ROEXSAMP. + +----------------------------------------------------------------------------- + +ENCOURAGEMENT + +The inspection of the source code of the ROEX.MF program may reveal +a few more useful macros. + +----------------------------------------------------------------------------- + +END OF THE 0ROEX.DOC FILE diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc b/Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc new file mode 100644 index 00000000000..86336cf613b --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/0roexsam.doc @@ -0,0 +1,69 @@ +This file belongs to the ROEX package. + +----------------------------------------------------------------------------- + +The directory ROEXSAMP contains this file (0ROEXSAM.DOC) and 14 examples +of using ROEX with the MFTOEPS package. + +WARNING: processing some of the files may last a while; in braces are +shown computing times for mf386 (version 2.71 [3c-beta5]) run on 486 Intel PC +with 66MHz clock. + + ES-01.MF, ``SQUARE'' (3 seconds): + A trivial example, expanding stroke applied to a square. + ES-02.MF, ``PARALLELOGRAM'' (4 seconds): + Another trivial example: expanding stroke applied + to a parallelogram. + ES-03.MF, ``COGWHEEL'' (7 seconds): + Expanding stroke applied to a somewhat complex object. + RO-01.MF, ``PROPELLER'' (14 seconds): + Removing overlaps applied to a circle and three rectangles; + rectangles are positively oriented, circle is negatively + oriented and has weight |2|. + RO-02.MF, ``ENCIRCLED CROSS 1'' (4 seconds): + Removing overlaps applied to a positively oriented circle + and two negatively oriented rectangles. + RO-03.MF, ``ENCIRCLED CROSS 2'' (4 seconds): + An example very similar to RO-02.MF; removing overlaps applied + to a negatively oriented circle and two positively oriented + rectangles, background colour is set to |1| (default is |0|). + RO-04.MF, ``EOFILL'' (30 seconds): + Removing overlaps performed in two stages; emulates + even-odd filling rule + RO-05.MF, ``GERBERA'' (3 minutes, 51 seconds): + Areas covered a specified number of times are collected + separately using the macro |recombine_edges| (performing + the last step of removing overlaps), and each area is painted + with a different colour, yielding a gerbera-like form. + RO-06.MF, ``EL PALO ALTO TREE'' (57 seconds): + A tough example (see remarks in the code) excerpted from + The \MF{}book, pages 124 thru 126. + RO-07.MF, ``LOGO OF JOURNAL OF ALGORITHMS'' (28 seconds): + Another example excerpted from The \MF{}book, + pages 137 thru 139. + ROES-01.MF, ``SUN'' (55 seconds): + An example making use of both expanding stroke + and removing overlaps. + ROES-02.MF, ``DOORMAT'' (1 minute, 34 seconds): + Another example making use of both expanding stroke + and removing overlaps; + ROES-03.MF, ``OLYMPIC CIRCLES'' (1 minute, 1 second): + Yet another example making use of both expanding + stroke and removing overlaps; it also demonstrates + repositioning of the picture in such a way that the lower + left corner of the bounding box coincides with the origin + of coordinate system. + ROES-04.MF, ``STAR FLOWERS'' (3 minutes, 4 seconds): + An example of removing overlaps of a single + self-intersecting curve; three EPS files are generated. + +You are entitled to do with these files whatever you wish. +If you alter a file, however, please remove the comment line: + + `This file belongs to the ROEX package.' + +in order to avoid mess. + +----------------------------------------------------------------------------- + +END OF THE 0ROEXSAMP.DOC FILE diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf new file mode 100644 index 00000000000..c2ccc77d17c --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/es-01.mf @@ -0,0 +1,29 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% ES-01.MF, ``SQUARE'': +% A trivial example, expanding stroke applied to a square. +% --- +input mftoeps; eps_mode_setup; input roex; tracingexpanding:=1; +% --- +beginchar("0",cm#,cm#,0); + expand_stroke (unitsquare xscaled w yscaled h) (1mm) R; +% find_BB make_list(1,R.num) R; + find_BB R1,R2; % R.num=2 + write_preamble jobname; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf new file mode 100644 index 00000000000..037091afe12 --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/es-02.mf @@ -0,0 +1,32 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% ES-02.MF, ``PARALLELOGRAM'': +% Another trivial example: expanding stroke applied to a parallelogram. +% --- +input mftoeps; eps_mode_setup; input roex; tracingexpanding:=1; +% --- +beginchar("0",1/10in#,in#,0); + path p; p=((1/2w,0)--(1/4w,1/4h)--(0,1/2h)--(1/2w,h)--(w,1/2h)--cycle); + miter_size:=w; + expand_stroke (p) (2/5w) R; +% change_weight (p) (2/5w) R; + find_BB make_list(1,R.num) R; + write_preamble jobname; + fix_draw_cmyk 0,0,0,1; draw_C p; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf new file mode 100644 index 00000000000..b21da0d9baf --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/es-03.mf @@ -0,0 +1,43 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% ES-03.MF, ``COGWHEEL'': +% Expanding stroke applied to a somewhat complex object, |miter_size| +% set to zero. +% --- +input mftoeps; eps_mode_setup; input roex; tracingexpanding:=1; +% --- +vardef flex_polyg(expr n,a) = + save zz; pair zz[\\]; + for i:=0 upto n-1: + zz[i]:=up rotated (i*(360/n)); + endfor + (zz0 + for i:=1 upto n: + {(zz[i mod n]-zz[i-1]) rotated a}..{(zz[i mod n]-zz[i-1]) rotated -a} + if i=n: cycle else: zz[i] fi + endfor + ) scaled .5 +enddef; +% --- +beginchar("0",in#,in#,0); + b:=.5mm; path p; p=flex_polyg(17,60) scaled w shifted (1/2w,1/2h); + miter_size:=0bp; expand_stroke (p) (b) R; +% miter_size:=0bp; change_weight(p) (b) R; + find_BB R1,R2; + write_preamble jobname; + draw_C R1,R2; + write_postamble; + for i:=1,2: + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf new file mode 100644 index 00000000000..6b4551eccdc --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-01.mf @@ -0,0 +1,26 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% RO-01.MF, ``PROPELLER'': +% Removing overlaps applied to a circle and three rectangles; rectangles +% are positively oriented, circle is negatively oriented and has weight |2|. +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +beginchar("0",in#,in#,0); + path A,B,C,D; + A=unitsquare xscaled 1/5w yscaled h shifted (2/5w,0); + B=A rotatedaround((1/2w,1/2h), 60); + C=B rotatedaround((1/2w,1/2h), 60); + D=reverse fullcircle scaled 3/4w shifted (1/2w,1/2h); + remove_overlap (A,B,C,D) ((4,2)) R; + find_BB make_list(1,R.num) R; + write_preamble jobname; + fill_C make_list(1,R.num) R; + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf new file mode 100644 index 00000000000..ce5a058219b --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-02.mf @@ -0,0 +1,33 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% RO-02.MF, ``ENCIRCLED CROSS 1'': +% Removing overlaps applied to a positively oriented circle and two +% negatively oriented rectangles. +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +beginchar("0",in#,in#,0); + path A,B,C; + A=fullcircle scaled w shifted (1/2w,1/2h); + B=reverse unitsquare xscaled 1/5w yscaled 3/5w shifted (2/5w,1/5w); + C=B rotatedaround((1/2w,1/2h), 90); + remove_overlap (A,B,C) () R; + set_BB 0,0,w,h; + write_preamble jobname; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf new file mode 100644 index 00000000000..988c018b1a1 --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-03.mf @@ -0,0 +1,34 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% RO-03.MF, ``ENCIRCLED CROSS 2'': +% An example very similar to RO-02.MF; removing overlaps applied to +% a negatively oriented circle and two positively oriented rectangles, +% background colour is set to |1| (default is |0|). +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +beginchar("0",in#,in#,0); + path A,B,C; + A=reverse fullcircle scaled w shifted (1/2w,1/2h); + B=unitsquare xscaled 1/5w yscaled 3/5w shifted (2/5w,1/5w); + C=B rotatedaround((1/2w,1/2h), 90); + background_color:=1; remove_overlap (A,B,C) () R; + set_BB 0,0,w,h; + write_preamble jobname; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf new file mode 100644 index 00000000000..7704db948af --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-04.mf @@ -0,0 +1,49 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk roex_default +% RO-04.MF, ``EOFILL'': +% Removing overlaps performed in two stages: first stage removes overlaps +% using even-odd filling rule, the second stage restores default meanings +% of |good_colors| and |touch_path| and performs ``traditional'' removing +% overlaps on the result of stage 1 and a positively oriented rectangle. +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +beginchar("0",in#,in#,0); + path A,B,C,D,E,F; + A=fullcircle scaled 1w shifted (1/2w,1/2h); + B=fullcircle scaled 4/5w shifted (1/2w,1/2h); + C=fullcircle scaled 3/5w shifted (1/2w,1/2h); + D=fullcircle scaled 2/5w shifted (1/2w,1/2h); + E=unitsquare xscaled 1/5w yscaled 9/10h shifted (2/5w,1/20h); + F=unitsquare xscaled 7/5w yscaled 1/5h shifted (-1/5w,2/5h); +% +% STAGE 1: remove overlaps for |A|, |B|, |C|, |D| and |E| using +% the `eofill' rule (the re-definition of |touch_path| is superfluous here, +% but recommended in a general case): + vardef good_colors(expr i,o) = odd(i) and odd(o+1) enddef; + vardef touch_path(expr p) = pos_turn(p) enddef; + remove_overlap (A,B,C,D,E) () R; +% STAGE 2: remove overlaps for |F| and the paths resulting from the stage 1: + roex_default good_colors, touch_path; + remove_overlap (F,make_list(1,R.num) R) () R; +% + find_BB make_list(1,R.num) R; + write_preamble jobname; + fix_fill_cmyk 0,0,0,1/10; + fill_C make_list(1,R.num) R; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor; + write_postamble; +endchar; +end. +%%\end diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf new file mode 100644 index 00000000000..bac4bb8d7d8 --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-05.mf @@ -0,0 +1,45 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% RO-05.MF, ``GERBERA'': +% Non-standard application of removing overlaps; areas covered a specified +% number of times are collected separately using the macro |recombine_edges| +% (performing the last step of removing overlaps), and each area is painted +% with a different colour, yielding a gerbera-like form. +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +beginchar("0",in#,in#,0); + path R[\\],V[\\][\\]; + N:=9; + R.num:=0; + R[incr R.num]=fullcircle xscaled 1/5w yscaled h shifted (1/2w,1/2h); + for i:=1 upto N-1: + R[incr R.num]=R[R.num-1] rotatedaround((0.5w,.5h), 180/N); + endfor +% + remove_overlap (make_list(1,R.num)R)() R; % dummy result + col.min:=infinity; col.max:=-infinity; + for i:=-EDGE_.num upto EDGE_.num : if i<>0: + col.min:=min(EDGE_.col[i],col.min); + col.max:=max(EDGE_.col[i],col.max); + fi endfor; + col.min:=max(1,col.min); + for k:=col.min upto col.max: + vardef good_colors(expr i,j) = (i=k) enddef; + message "recombine_edges: color=" & decimal(k); recombine_edges(V[k]); + endfor; + set_BB 0,0,w,h; write_preamble jobname; + for k:=col.min upto col.max: + if V[k]num>0: + fix_fill_cmyk 0,3/4((((k-col.min)/(col.max-col.min))**1/2)[1,0]),1,0; + fill_C make_list(1,V[k]num)V[k]; + fi + endfor + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf new file mode 100644 index 00000000000..7007cd233b2 --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-06.mf @@ -0,0 +1,150 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +%%% draw fix_line_join fix_line_cap fix_line_width +% RO-06.MF, ``EL PALO ALTO TREE'': +% A tough example (see remarks below) excerpted from The \MF{}book, pages +% 124 thru 126. +%% % an innocent formatting trick: the underscore character ending a name +%% % will be typeset as an superscript asterisk +%% \let\oriunderscore\_ +%% \newif\ifbgroupopen \bgroupopenfalse +%% \def\altdblbackslash#1{\bgroup\bgroupopentrue\it#1} +%% \def\optegroup{\ifbgroupopen\egroup\fi} +%% \def\underscoreasasterisk#1{% +%% \ifx#1\relax\optegroup^*\else\oriunderscore#1\fi} +%% \def\\#1{% +%% \let\_\underscoreasasterisk +%% \altdblbackslash{#1\relax}\optegroup +%% \let\_\oriunderscore} +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +% REMARKS: +% 1. There arise very close points during the intersecting process, +% hence |epsil.dist| is adjusted (see also point 2). +% 2. Note that: +% a) |turningnumber(branch1)=1| but |turningnumber(reverse branch1)=0| +% (sic!); +% b) for the second resulting path, |R2| (the tree), |turningnumber(R2)=1| +% while |check_turn(R2)=-1|, which is the desired value as the tree +% is unfilled (oh, these tiny loops!); +% c) the minimal resulting interval, i.e., the time distance +% between two neighbouring points of intersection is dangerously +% small, namely, |0.00032|; usually the value smaller than the bound, +% by default equal to |0.01|, portends a collaps of the algorithm, +% fortunately not in this case (set |tracingremoving:=2| for more +% information on intervals and secants). +epsil.dist:=1/50pt; +% show_turningnumbers_and_turn_checks:=1; +% mark_trunk_close_points:=1; +% --- +beginchar ("0",1/2in#,5/4in#,0); + path branch[\\], oval; +% +% prepare data: + branch0 = % i.e., trunk + (0,660)---(-12,70)..{curl 5}(-28,-8) + & flex((-28,-8),(-16,-4),(-10,-11)) + & flex((-10,-11),(0,-5),(14,-10)) + & flex((14,-10),(20,-6),(29,-11)) + & (29,-11){curl 4}..(10,100)---cycle; + branch1= flex((0,660),(-9,633),(-22,610)) + & flex((-22,610),(-3,622),(17,617)) + & flex((17,617),(7,637),(0,660)) & cycle; + branch2=flex((30,570),(10,590),(-1,616)) + & flex((-1,616),(-11,592),(-29,576),(-32,562)) + & flex((-32,562),(-10,577),(30,570)) & cycle; + branch3=flex((-1,570),(-17,550),(-40,535)) + & flex((-40,535),(-45,510),(-60,477)) + & flex((-60,477),(-20,510),(40,512)) + & flex((40,512),(31,532),(8,550),(-1,570)) & cycle; + branch4=flex((0,509),(-14,492),(-32,481)) + & flex((-32,481),(-42,455),(-62,430)) + & flex((-62,430),(-20,450),(42,448)) + & flex((42,448),(38,465),(4,493),(0,509)) & cycle; + branch5=flex((-22,470),(-23,435),(-44,410)) + & flex((-44,410),(-10,421),(35,420)) + & flex((35,420),(15,455),(-22,470)) & cycle; + branch6=flex((18,375),(9,396),(5,420)) + & flex((5,420),(-5,410),(-50,375),(-50,350)) + & flex((-50,350),(-25,375),(18,375)) & cycle; + branch7=flex((0,400),(-13,373),(-30,350)) + & flex((-30,350),(0,358),(30,350)) + & flex((30,350),(13,373),(0,400)) & cycle; + branch8=flex((50,275),(45,310),(3,360)) + & flex((3,360),(-20,330),(-70,300),(-100,266)) + & flex((-100,266),(-75,278),(-60,266)) + & flex((-60,266),(0,310),(50,275)) & cycle; + branch9=flex((10,333),(-15,290),(-43,256)) + & flex((-43,256),(8,262),(58,245)) + & flex((58,245),(34,275),(10,333)) & cycle; + branch10=flex((8,262),(-21,249),(-55,240)) + & flex((-55,240),(-51,232),(-53,220)) + & flex((-53,220),(-28,229),(27,235)) + & flex((27,235),(16,246),(8,262)) & cycle; + branch11=flex((0,250),(-25,220),(-70,195)) + & flex((-70,195),(-78,180),(-90,170)) + & flex((-90,170),(-5,188),(74,183)) + & flex((74,183),(34,214),(0,250)) & cycle; + branch12=flex((8,215),(-35,175),(-72,155)) + & flex((-72,155),(-75,130),(-92,110),(-95,88)) + & flex((-95,88),(-65,117),(-54,104)) + & flex((-54,104),(10,151),(35,142)) + ..flex((42,130),(60,123),(76,124)) + & flex((76,124),(62,146),(26,180),(8,215)) & cycle; +% + for i:=0 upto 12: + branch[i]:=neg_turn branch[i] shifted (150,50) scaled (w/300); + endfor + oval=superellipse((w,1/2h),(1/2w,h),(0,1/2h),(1/2w,0),4/5); +% +% remove overlaps and (optionally) show |turningnumber|s and |turn_check|s: + remove_overlap (make_list(0,12)branch,oval)() R; + if known show_turningnumbers_and_turn_checks: + begingroup + interim autorounding:=0; + show (turningnumber(branch1), turningnumber(reverse branch1)); + for i:=1 upto R.num: show i,(turningnumber R[i],check_turn R[i]); endfor; + endgroup; + fi +% +% begin export to EPS: + find_BB oval; + write_preamble jobname; + fix_line_join 1; fix_line_cap 1; + fix_line_width 1/50pt; +% paint the picture: + fix_fill_cmyk 0,0,0,1/6; + fill_C make_list(1,R.num)R; + for i:=1 upto R.num: + if proofing=0: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + else: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor +% +% mark (optionally) dangerously close points: + if known mark_trunk_close_points: + fix_fill_cmyk 0,0,0,1; fix_draw_cmyk 0,0,0,1; + for j:=13,14,17,18: + z[j]=point TIME_1tim[j] of PATH_1; + fill_C fullcircle scaled 1/50pt shifted z[j]; + endfor + z.a=(1pt,0); z.b=(1/20pt,0); z.c=(1/5pt,1/10pt); z.d=(1/5pt,-1/10pt); + for zz:=1/2[z13,z14],1/2[z17,z18]: + draw_C (zz-z.a)--(zz-z.b), (zz-z.c)--(zz-z.b)--(zz-z.d); + endfor + fi +% end export to EPS: + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf new file mode 100644 index 00000000000..5697a6462ac --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/ro-07.mf @@ -0,0 +1,102 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% RO-07.MF, ``LOGO OF JOURNAL OF ALGORITHMS'': +% Another example excerpted from The \MF{}book, pages 137 thru 139; +% |penstroke| is redefined in such a way that instead of creating a bitmap +% picture, it stores respective curves; two points were moved, |z.a8l| and +% |z.a8r| (see comments with a remark ``intrusion''), in order to avoid +% partially overlaping paths, as ROEX does not cope with such data. +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +% --- +def penstroke text t = + forsuffixes e = l,r: path_.e:=t; endfor + if cycle path_.l: R[incr R.num]:=path_.l.t_; R[incr R.num]:=path_.r.t_; + else: R[incr R.num]:=path_.l -- reverse path_.r -- cycle; fi + enddef; +% --- +beginchar("0",29mm#,25mm#,0); + path R[\\]; R.num:=0; +% + thick#:=2mm#; thin#:=5/4mm#; + define_whole_blacker_pixels(thick,thin); + forsuffixes $=a,b,c: transform $; + forsuffixes e=l,r: path $e,$'e; numeric t$[\\]e; + endfor + endfor + penpos1(thick,0); penpos2(thick,90); penpos3(thick,180); penpos4(thick,270); + penpos5(thick,0); penpos6(thick,90); penpos7(thick,180); penpos8(thick,270); + x2=x4=x6=x8=.5[x5,x7]=.5w; x1r=w; x3r=0; + x5-x7=y6-y8; + y1=y3=y5=y7=.5[y6,y8]=.5h; y2r=h; y4r=0; + y6r=.75h; + forsuffixes e=l,r: a.e=b'e=c'e=superellipse (z1e,z2e,z3e,z4e,.75); + a'e=b.e=c.e=superellipse (z5e,z6e,z7e,z8e,.72); + endfor + penpos a1(thin,0); penpos a5(whatever,-90); penpos a9(thin,180); + x.a1l-x.a9l=1/3(x5l-x7l); x.a5=.5w; y.a1=y.a9; y.a5r=4/7h; + x.a3l=x.a1l; x.a3r=x.a1r; x.a4r=1/6[x.a3r,x1l]; x0=.5w; y0=.52h; + x.a6l+x.a4l=x.a6r+x.a4r=x.a7l+x.a3l= + x.a7r+x.a3r=x.a9+x.a1=w; + y.a3r=y.a4r=y.a6r=y.a7r=.2[y2l,y0]; y.a3l=y.a4l=y.a6l=y.a7l=y.a3r-thin; + z.a4l=z.a4r+(thin,0) rotated(angle(z.a4r-z.a5r)+90)+whatever*(z.a4r-z.a5r); + z.a4l-z.a5l=whatever*(z.a4r-z.a5r); + z=a.r intersectionpoint (z0--(w,0)); + y.a1-y.a5=length(z-z0); + b=identity shifted (0,y0-y.a1) rotatedaround(z0,90-angle(z0-(w,0))); + c=b reflectedabout (z2,z4); + for n=1,3,4,5,6,7,9: forsuffixes e=l,,r: forsuffixes $=b,c: + z$[n]e=z.a[n]e transformed $; + endfor endfor endfor + forsuffixes e=l,r: forsuffixes $=a,b,c: +% intrusion: the primed entries are stored for further use (see below) + z$2e'=$l intersectionpoint (z$1e--z$3e); + z$8e'=$l intersectionpoint (z$9e--z$7e); +% end of intrusion + z$2e=$r intersectionpoint (z$1e--z$3e); + z$8e=$r intersectionpoint (z$9e--z$7e); + t$1e=xpart($e intersectiontimes (z$1l--z$3l)); + t$9e=xpart($e intersectiontimes (z$9l--z$7l)); + t$4e=xpart($'e intersectiontimes (z$5r--z$4l)); + t$6e=xpart($'e intersectiontimes (z$5r--z$6l)); + endfor endfor + penstroke subpath(t.a9e,t.b6e) of a.e; + penstroke subpath(t.b4e,t.c4e) of b'e; + penstroke subpath(t.c6e,t.a1e+8) of c'e; + penstroke subpath(t.a6e,t.b9e) of a'e; + penstroke subpath(t.b1e,t.c1e) of b.e; + penstroke subpath(t.c9e,t.a4e+8) of c.e; +% intrusion: correction of offending nodes, i.e., |z.a8l|, |z.a8r|, +% |z.a8l|, and |z.a8r| + x.a8l:=x.a8l'; x.a8r:=x.a8r'; y.a8l:=y.a8l'; y.a8r:=y.a8r'+(y2r-y2); + x.a2l:=x.a2l'; x.a2r:=x.a2r'; y.a2l:=y.a2l'; y.a2r:=y.a2r'+(y2r-y2); +% end of intrusion + forsuffixes $=a,b,c: +% |penlabels($1,$2,$3,$4,$5,$6,$7,$8,$9);| + penstroke z$2e--z$3e--z$4e--z$5e--z$6e--z$7e--z$8e; + endfor +% |penlabels(range 0 thru 8);| + vardef touch_path expr p = pos_turn p enddef; + remove_overlap (make_list(1,R.num)R) () R; + find_BB make_list(1,R.num)R; + write_preamble jobname; + fix_fill_cmyk 0,0,0,1/6; + fill_C make_list(1,R.num)R; + fix_line_width 1/10pt; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn R[i]>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + if proofing>0: + for j:=0 upto length(R[i])-1: + makelabel(decimal(j) & "/" & decimal(i),point j of R[i]); + endfor + fi + endfor + write_postamble; +endchar; +end. +%%\end + diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf new file mode 100644 index 00000000000..bac1a14bfda --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-01.mf @@ -0,0 +1,38 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% ROES-01.MF, ``SUN'': +% An example making use of both expanding stroke and removing overlaps. +% --- +input mftoeps; eps_mode_setup; input roex; +tracingexpanding:=1; tracingremoving:=1; +% --- +beginchar("0",in#,in#,0); + path Q,R[\\]; R.num:=0; + M:=12; % number of half-periods of a sine wave + N:=11; % number of gaps + H:=h/(2N); W=1.2w; + Q:=reverse for i:=0 upto M: if i>0: .. fi + ((i/M)[1/2(w-W),w-1/2(w-W)],1/2sind(90(i mod 4))*H) + endfor; +% + expand_stroke(Q)(1/2H)R; Q:=reverse R1; R.num:=0; + if proofing>0: + for j:=0 upto length(Q)-1: makelabel("Q" & decimal(j),point j of Q); endfor + fix_line_width 1; draw_C Q; + fi + for i:=1 upto N: R[incr R.num]:=Q shifted (0,(2i-1)*H); endfor + R[incr R.num]:=fullcircle scaled w shifted (.5w,.5h); +% + remove_overlap(make_list(1,R.num) R)() R; + find_BB make_list(1,R.num) R; + write_preamble jobname; + for i:=1 upto R.num: + fix_fill_cmyk 0,((i-1)/(R.num-1))[1,0],1,0; fill_C R[i]; + endfor; + write_postamble; +endchar; +end. +%%\end diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf new file mode 100644 index 00000000000..f5dda5c552e --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-02.mf @@ -0,0 +1,33 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C draw_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% ROES-02.MF, ``DOORMAT'': +% Another example making use of both expanding stroke and removing overlaps; +% --- +input mftoeps; eps_mode_setup; input roex; +tracingexpanding:=1; tracingremoving:=1; +% --- +beginchar("0",1in#,1in#,0); + path A[\\],B[\\]; + A.n:=5; B.n:=5; % large values may cause exceedingly long processing... + A.b:=(1/(2A.n+1))*w; B.b:=(1/(2B.n+1))*h; + for i:=1 upto A.n: + A[i]:=((0,0)..(-1/2A.b,1/3h)..(1/2A.b,2/3h)..(0,h)) shifted ((2i-.5)*A.b,0); + endfor + for i:=1 upto B.n: + B[i]:=((0,0)..(1/3w,-1/2B.b)..(2/3w,1/2B.b)..(w,0)) shifted (0,(2i-.5)*B.b); + endfor + expand_stroke(make_list(1,A.n)A, make_list(1,B.n)B)(1/2A.b)R; + remove_overlap(make_list(1,R.num)R)()R; + find_BB make_list(1,R.num) R; + write_preamble jobname; + for i:=1 upto R.num: + fix_draw_cmyk if check_turn(R[i])>0: 0,1,1,0 else: 1,1,0,0 fi; + draw_C R[i]; + endfor; + write_postamble; +endchar; +end. +%%\end diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf new file mode 100644 index 00000000000..7df45b013a9 --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-03.mf @@ -0,0 +1,49 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw write_preamble write_postamble find_BB set_BB fill_C clip_C +%%% draw fix_fill_cmyk fix_draw_cmyk +% ROES-03.MF, ``OLYMPIC CIRCLES'': +% Yet another example making use of both expanding stroke and removing +% overlaps; it also demonstrates repositioning of the picture in such +% a way that the lower left corner of the bounding box coincides with +% the origin of coordinate system. +input mftoeps; eps_mode_setup; input roex; +tracingremoving:=1; tracingexpanding:=1; +% --- +beginchar("0",in#,in#,0); % temporary values + path A[]; + for i:=1,2,3,4,5: + A[i]:=fullcircle scaled w shifted + (floor(i/4)*(1/2sqrt(3)*w,0)+1/2w*(up rotated (120i+60))); + endfor + expand_stroke (A1,A2,A3,A4,A5) (.5mm) R; + remove_overlap (make_list(1,R.num)R) () R; +% setting of intermediate colors: + k:=0; % the number of intermediate colors + C[incr k]=0; M[k]=1; Y[k]=1; K[k]:=0; + C[incr k]=0; M[k]=0; Y[k]=1; K[k]:=0; + C[incr k]=0.25; M[k]=0; Y[k]=0.75; K[k]:=0; + C[incr k]=1; M[k]=0.5; Y[k]=0; K[k]:=0; + C[incr k]=0.3; M[k]=1; Y[k]=0; K[k]:=0; + l:=30; % the number of interpolation steps + m=l*(k-1); % the number of strips + find_BB make_list(1,R.num)R; +% repositioning of the picture: + for i:=1 upto R.num: R[i]:=R[i] shifted -llxy; endfor + m*w'=xh_crd:=xh_crd-xl_crd; xl_crd:=0; + h'=yh_crd:=yh_crd-yl_crd; yl_crd:=0; +% exporting: + write_preamble jobname; + clip_C make_list(1,R.num)R; + n:=0; + for i:=1 upto k-1: for j:=0 upto l-1: + n:=n+1; + fix_fill_cmyk + forsuffixes $=C,M,Y,K: (j/(l-1))[$[i],$[i+1]] if str$ <> "K": , fi endfor; + fill_C unitsquare xscaled 11/10w' yscaled h' shifted ((n-1)*w'-1/20w',0); + endfor endfor + write_postamble; +endchar; +end. +%%\end diff --git a/Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf new file mode 100644 index 00000000000..04585e9416f --- /dev/null +++ b/Master/texmf-dist/source/metafont/roex/roexsamp/roes-04.mf @@ -0,0 +1,91 @@ +%%%% +%%%% This file belongs to the ROEX package. +%%%% +%%% draw find_BB fill_C fix_fill_cmyk write_preamble write_postamble +%%% length cycle join +%%% / // +% ROES-04.MF, ``STAR FLOWERS'': +% An example of removing overlaps of a single self-intersecting curve; +% the sample curves (separate EPS files are generated for different +% curves) are based upon a regular star polygon backbone; +% the first curve is just such a polygon, the remaining two are +% smooth variations (observe setting |epsil.time:=1/500| in the third case); +% after removing overlaps objects are repositioned in such a way that +% the lower left corner of the bounding box coincides with the origin +% of coordinate system. +%%%% +%% % an innocent formatting trick: the underscore character ending a name +%% % will be typeset as an superscript asterisk +%% \let\oriunderscore\_ +%% \newif\ifbgroupopen\bgroupopenfalse +%% \def\altdblbackslash#1{\bgroup\bgroupopentrue\it#1} +%% \def\optegroup{\ifbgroupopen\egroup\fi} +%% \def\underscoreasasterisk#1{% +%% \ifx#1\relax\optegroup^*\else\oriunderscore#1\fi} +%% \def\\#1{% +%% \let\_\underscoreasasterisk +%% \altdblbackslash{#1\relax}\optegroup +%% \let\_\oriunderscore} +% --- +input mftoeps; eps_mode_setup; input roex; tracingremoving:=1; +max_idx:=500; % better increase the default value +% --- +primarydef i // n = + (if n=0: 0 else: i/n fi) % why not to divide by 0? +enddef; +% --- +h#=1in#; w#=1in#; +% --- +beginchar("0",w#,h#,0); + pickup pencircle scaled 1; + for case:=0,1,2: + path p, V[\\][\\]; pair R; save x,y; numeric N, K, A, twirl; + twirl:=180; +% star polygons should fullfil |GCC(K,N)=1|, |1<K<N/2| +% (|N| is the number of nodes, |K| is a `leap') + if case=0: % A + N=9; K=4; def join = -- enddef; twirl:=0; + elseif case=1: % B + N=7; K=2; def join = .. tension 3 .. enddef; + elseif case=2: % C + N=13; K=4; def join = .. tension 3 .. enddef; epsil.time:=1/500; + fi + A=180-(360/N)*K; R=1in*right; z0=origin; + for i:=1 upto N-1: z[i]=z[i-1]+R; R:=R rotated (180-A); endfor + p:=z0 for i:=1 upto N-1: join z[i] endfor join cycle; + if twirl<>0: + p:=z0{(direction 0 of p) rotated twirl} + for i:=1 upto N-1: join {(direction i of p) rotated twirl}z[i] endfor + join cycle; + fi + remove_overlap (p)()R; % dummy recombining + col_min:=infinity; col_max:=-infinity; + for i:=-EDGE_.num upto EDGE_.num: if i<>0: + col_min:=min(EDGE_.col[i],col_min); col_max:=max(EDGE_.col[i],col_max); + fi endfor; + find_BB p; + for k:=col_min upto col_max: if k<>0: + vardef good_colors(expr i,j) = (i=k) enddef; + message "recombine_edges: color=" & decimal(k); + recombine_edges(V[k]); + for l:=1 upto V[k]num: V[k][l]:=V[k][l] shifted -llxy; endfor + fi endfor; + xh_crd:=xh_crd-xl_crd; xl_crd:=0; + yh_crd:=yh_crd-yl_crd; yl_crd:=0; + write_preamble jobname & char(ASCII("a")+case); + for k:=col_min upto col_max: if k<>0: + if V[k]num>0: + if k>0: + fix_fill_cmyk 0,3/4(((k-1)//(col_max-1))**1/2)[1,0],1,0; + else: + fix_fill_cmyk 3/4(((1+k)//(1+col_min))**1/2)[1,0],1,0,0; + fi + fill_C make_list(1,V[k]num)V[k]; + fi + fi endfor % |for k| + write_postamble; + endfor % |for case| +endchar; +% --- +end. +%%\end |