4

Here is the example from MetaFontBook:

beginchar ("A", 29mm# , 25mm# , 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:
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;
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); endchar;
end

It fails with the followng error:

This is METAFONT, Version 2.7182818 (TeX Live 2019/dev/Debian) (preloaded base=mf)
(logo.mf
! Value is too large (4775.19102).
l.22 c = b reflectedabout (z2, z4);

? 

What should be changed in the example to be able to view the result in online display?

3

The dimension is too big when the mode is proof (the default). Add, at the beginning of the code

mode:=canonex;
mode_setup;

or whatever mode you want, provided the resolution is not too large; canonex is for 600dpi.

The mode can also be selected on the command line; if you omit the first line in test.mf, you can call

mf '\mode=canonex;input test'

but mode_setup; is very important, because it is responsible for assigning a correct value to sharped dimensions.

To use online display, add screenchars; after mode_setup;.

  • BTW, from command line and on-line "\mode=localfont;" may be given, but in file only "mode:=localfont;" - why in file we cannot use "mode=localfont;"? – Igor Liferenko Dec 27 '18 at 1:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.