%
% Copyright (c) 2011, 2012, Sebastian Schubert <schubert.seb@googlemail.com>
%
% This Font Software is licensed under the SIL Open Font License,
% Version 1.1. This license is in the accompanying file OFL.txt, and
% is also available with a FAQ at: http://scripts.sil.org/OFL
%

beginsymbol(2dot_size# + 2side_bearing#, vcentre(2dot_size#)); "centre dot";
  fill dot((w/2, (h-d)/2), dot_size);
endchar;

for alpha = 0, 90, 45, 135:
  beginsymbol((4dot_size# + equal_spread#) * abs (cosd alpha) + 2dot_size# * abs (sind alpha) + 2side_bearing#, vcentre(2dot_size# * abs (cosd alpha) + (4dot_size# + equal_spread#) * abs (sind alpha))); "colon (" & decimal alpha & ")";
    pair centre;
    centre := (w/2, (h-d)/2);

    z1 - z0 = (2dot_size + equal_spread) * dir alpha;
    1/2[z0,z1] = centre;

    fill dot(z0, dot_size);
    fill dot(z1, dot_size);
  endchar;
endfor;

for alpha = 0, 90, 45, 135:
  beginsymbol((6dot_size# + 2equal_spread#) * abs (cosd alpha) + 2dot_size# * abs (sind alpha) + 2side_bearing#, vcentre(2dot_size# * abs (cosd alpha) + (6dot_size# + 2equal_spread#) * abs (sind alpha))); "triple colon (" & decimal alpha & ")";
    pair centre;
    centre := (w/2, (h-d)/2);

    z1 - z0 = (2dot_size + equal_spread) * dir alpha;
    z2 - z1 = (2dot_size + equal_spread) * dir alpha;
    z1      = centre;

    fill dot(z0, dot_size);
    fill dot(z1, dot_size);
    fill dot(z2, dot_size);
  endchar;
endfor;

for alpha = 0, 90, 180, 270:
  beginoperator(plus_size#, 1); "therefore (" & decimal alpha & ")";
    r := 1/2plus_size - dot_size;
    r := r * 1/3[1, sqrt 2];

    z1 = z0 + r * dir alpha;
    z2 = z0 + r * dir (alpha + 120);
    z3 = z0 + r * dir (alpha + 240);

    1/2[z1,1/2[z2,z3]] = centre;

    fill dot(z1, dot_size);
    fill dot(z2, dot_size);
    fill dot(z3, dot_size);
  endchar;
endfor;

beginoperator(plus_size#, 1); "double colon";
  r := (1/2plus_size - dot_size) * sqrt(2);

  fill dot(centre + r * dir 45, dot_size);
  fill dot(centre + r * dir 135, dot_size);
  fill dot(centre + r * dir 225, dot_size);
  fill dot(centre + r * dir 315, dot_size);
endchar;

beginoperator(plus_size#, 1); "minus";
  draw_line(centre + radius * right, centre + radius * left, true);
endchar;

beginoperator(plus_size#, 1); "medium slash";
  draw_line(centre + 4/3radius * dir 45, centre + 4/3radius * dir 225, true);
endchar;

beginoperator(plus_size#, 1); "medium backslash";
  draw_line(centre + 4/3radius * dir 135, centre + 4/3radius * dir 315, true);
endchar;

beginoperator(plus_size#, 1); "plus";
  draw_line(centre + radius * right, centre + radius * left, true);
  draw_line(centre + radius * up, centre + radius * down, true);
endchar;

beginoperator(plus_size#, 1); "times";
  r := 4/3radius;

  draw_line(centre + r * dir 45, centre + r * dir 225, true);
  draw_line(centre + r * dir 135, centre + r * dir 315, true);
endchar;

for angle = 0, 180:
  beginoperator(plus_size#, 1); "dot minus (" & decimal angle & ")";
    draw_line(centre - radius * dir angle, centre + radius * dir angle, true);
    fill dot(centre + equal_spread * dir (angle + 90), 3/4dot_size);
  endchar;
endfor;

beginoperator(plus_size#, 1); "divide";
  draw_line(centre + radius * right, centre + radius * left, true);
  fill dot(centre + equal_spread * up, 3/4dot_size);
  fill dot(centre + equal_spread * down, 3/4dot_size);
endchar;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "minus with two dots";
    draw_line(centre + radius * right, centre + radius * left, true);
    fill dot(centre + sign * (radius - 3/4dot_size) * left + equal_spread * up, 3/4dot_size);
    fill dot(centre + sign * (radius - 3/4dot_size) * right + equal_spread * down, 3/4dot_size);
  endchar;
endfor;

beginoperator(plus_size#, 1); "minus with four dots";
  draw_line(centre + radius * right, centre + radius * left, true);
  fill dot(centre + (radius - 3/4dot_size) * left + equal_spread * up, 3/4dot_size);
  fill dot(centre + (radius - 3/4dot_size) * right + equal_spread * up, 3/4dot_size);
  fill dot(centre + (radius - 3/4dot_size) * left + equal_spread * down, 3/4dot_size);
  fill dot(centre + (radius - 3/4dot_size) * right + equal_spread * down, 3/4dot_size);
endchar;

for angle = 0, 180:
  beginoperator(plus_size#, 1.25); "plus minus (" & decimal angle & ")";
    centre := centre + 0.125plus_size * dir (angle + 90);
    pair bt;
    bt := centre + (radius + 0.25plus_size) * dir (angle - 90);

    draw_line(centre + radius * right, centre + radius * left, true);
    draw_line(centre + radius * up, centre + radius * down, true);
    draw_line(bt + radius * right, bt + radius * left, true);
  endchar;
endfor;

for angle = 0, 180:
  beginoperator(plus_size#, 1.25); "dot plus (" & decimal angle & ")";
    centre := centre + 0.125plus_size * dir (angle - 90);
    pair tp;
    tp := centre + (radius + 0.25plus_size) * dir (angle + 90);

    draw_line(centre + radius * right, centre + radius * left, true);
    draw_line(centre + radius * up, centre + radius * down, true);
    fill dot(tp, 3/4dot_size);
  endchar;
endfor;

beginoperator(plus_size#, 1.25); "dot times";
  centre := centre + 0.125plus_size * down;
  pair tp;
  tp := centre + (radius + 0.2plus_size) * up;
  r := 4/3radius;

  draw_line(centre + r * dir 45, centre + r * dir 225, true);
  draw_line(centre + r * dir 135, centre + r * dir 315, true);
  fill dot(tp, 3/4dot_size);
endchar;

beginoperator(plus_size#, 1.25); "times bar";
  centre := centre + 0.125plus_size * up;
  pair bt;
  bt := centre + (radius + 0.25plus_size) * down;
  r := 4/3radius;

  draw_line(centre + r * dir 45, centre + r * dir 225, true);
  draw_line(centre + r * dir 135, centre + r * dir 315, true);
  draw_line(bt + radius * right, bt + radius * left, true);
endchar;

beginoperator(plus_size#, 1); "divide on times";
  r := 4/3radius;

  draw_line(centre + radius * right, centre + radius * left, true);
  draw_line(centre + r * dir 45, centre + r * dir 225, true);
  draw_line(centre + r * dir 135, centre + r * dir 315, true);
  fill dot(centre + equal_spread * up, 3/4dot_size);
  fill dot(centre + equal_spread * down, 3/4dot_size);
endchar;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "logical not";
    draw_line(centre + radius * left, centre + radius * right, true);
    draw_line(centre + sign * radius * right, centre + sign * radius * right + equal_spread * down, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "upside down logical not";
    draw_line(centre + radius * left, centre + radius * right, true);
    draw_line(centre + sign * radius * right, centre + sign * radius * right + equal_spread * up, true);
  endchar;
endfor;

for sign = -1, 1:
  beginoperator(plus_size#, 1); "three times";
    r := 4/3radius;

    z0 = centre + r * dir (sign * 45);
    z1 = centre + r * dir (sign * 225);
    z2 = centre + r * dir (270 + sign * 45);
    z3 = centre + 1/4line_thickness * dir (270 + sign * 45);

    draw_line(z0, z1, true);
    draw_line(z3, z2, true);
  endchar;
endfor;

for alpha = 0, 90, 180, 270:
  beginoperator(plus_size#, 1); "closed times (" & decimal alpha & ")";
    thick := line_thickness;
    r := 4/3radius;

    z0 = centre + (r + 1/2line_thickness) * dir (alpha +  45);
    z1 = centre + r * dir (alpha +  315);
    z2 = centre + r * dir (alpha +  225);
    z3 = centre + (r + 1/2line_thickness) * dir (alpha +  135);

    penpos0(thick,alpha + 315);
    penpos1(thick,alpha + 45);
    penpos2(thick,alpha + 315);
    penpos3(thick,alpha + 45);

    z5 = z1r + whatever * dir (270 + alpha - 15);
    z6 = z2l + whatever * dir (270 + alpha + 15);
    z5 = whatever[z1r + thick * dir (270 + alpha), z2l + thick * dir (270 + alpha)];
    z6 = whatever[z1r + thick * dir (270 + alpha), z2l + thick * dir (270 + alpha)];

    fill stroke z0e -- z2e;
    fill stroke z1e -- z3e;
    fill z1r -- z5 -- z6 -- z2l -- cycle;

    penlabels(0,1,2,3,5,6);
  endchar;
endfor;

for alpha = 0, 90:
  beginoperator(plus_size#, 1); "bowtie (" & decimal alpha & ")";
    thick := line_thickness;
    r := 4/3radius;

    z0 = centre + r * dir (alpha +  135);
    z1 = centre + r * dir (alpha +  45);
    z2 = centre + r * dir (alpha +  315);
    z3 = centre + r * dir (alpha +  225);

    penpos0(thick,alpha + 45);
    penpos1(thick,alpha + 135);
    penpos2(thick,alpha + 45);
    penpos3(thick,alpha + 135);

    z4 = z0r + whatever * dir (180 + alpha + 15);
    z5 = z1r + whatever * dir (alpha - 15);
    z6 = z2l + whatever * dir (alpha + 15);
    z7 = z3l + whatever * dir (180 + alpha - 15);
    z4 = whatever[z0r + thick * dir (180 + alpha), z3l + thick * dir (180 + alpha)];
    z5 = whatever[z1r + thick * dir alpha, z2l + thick * dir alpha];
    z6 = whatever[z1r + thick * dir alpha, z2l + thick * dir alpha];
    z7 = whatever[z0r + thick * dir (180 + alpha), z3l + thick * dir (180 + alpha)];

    fill stroke z0e -- z2e;
    fill stroke z1e -- z3e;
    fill z1r -- z5 -- z6 -- z2l -- cycle;
    fill z0r -- z4 -- z7 -- z3l -- cycle;

    penlabels(0,1,2,3,4,5,6,7);
  endchar;
endfor;

for alpha = 0, 90, 180, 270: 
  beginoperator(plus_size#, 1); "Y (" & decimal alpha & ")";
    s := 1/15plus_size;

    draw_line(centre - s * dir alpha, centre + radius * dir alpha, true);
    draw_line(centre - s * dir alpha, centre - s * dir alpha + (radius + s) * dir (alpha + 135), true);
    draw_line(centre - s * dir alpha, centre - s * dir alpha + (radius + s) * dir (alpha + 225), true);
  endchar;
endfor;

% operators

for sign = 1, -1:
  beginoperator(plus_size#, 1); "wedge";
    draw_less(a, centre + sign * plus_size/2 * up, centre - sign * plus_size/2 * up, 2radius, line_thickness, false, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "wedge dot";
    draw_less(a, centre + sign * plus_size/2 * up, centre - sign * plus_size/2 * up, 2radius, line_thickness, false, true);
    fill dot(centre - sign * 1/3plus_size * up, 3/4dot_size);
  endchar;
endfor;

for sign = 1, -1:
  beginsymbol(13/9plus_size# + 2side_bearing#, vcentre(plus_size#)); "double wedge";
    1/2[z0,z1] = (w/2, (h-d)/2);
    z1 - z0 = 4/9plus_size * right;

    draw_less(a, z0 + sign * plus_size/2 * up, z0 - sign * plus_size/2 * up, 2radius, line_thickness, false, true);
    draw_less(b, z1 + sign * plus_size/2 * up, z1 - sign * plus_size/2 * up, 2radius, line_thickness, false, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "curly wedge";
    draw_prec(a, centre + sign * plus_size/2 * up, centre - sign * plus_size/2 * up, 2radius, line_thickness, false);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1.25); "bar wedge";
    centre := centre - sign * 0.125plus_size * up;
    pair tp;
    tp := centre + sign * (radius + 0.25plus_size) * up;

    draw_less(a, centre + sign * plus_size/2 * up, centre - sign * plus_size/2 * up, 2radius, line_thickness, false, true);
    draw_line(tp + radius * left, tp + radius * right, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1.5); "double bar wedge";
    centre := centre - sign * 0.25plus_size * up;
    pair tpa, tpb;
    tpa := centre + sign * (radius + 0.25plus_size) * up;
    tpb := centre + sign * (radius + 0.5plus_size) * up;

    draw_less(a, centre + sign * plus_size/2 * up, centre - sign * plus_size/2 * up, 2radius, line_thickness, false, true);
    draw_line(tpa + radius * left, tpa + radius * right, true);
    draw_line(tpb + radius * left, tpb + radius * right, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "union";
    draw_subset(a,centre - sign * plus_size/2 * up, centre + sign * plus_size/2 * up, 2radius, line_thickness);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(4/3plus_size#, 1); "double union";
    draw_subset(a, centre - sign * 5/18plus_size * up, centre + sign * 2/3plus_size * up, 5/6radius, line_thickness);
    draw_subset(b, centre - sign * 2/3plus_size * up, centre + sign * 2/3plus_size * up, 2radius, line_thickness);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "union dot";
    draw_subset(a, centre - sign * plus_size/2 * up, centre + sign * plus_size/2 * up, 2radius, line_thickness);
    fill dot(centre + sign * 1/6plus_size * up, 3/4dot_size);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "union plus";
    draw_subset(a, centre - sign * plus_size/2 * up, centre + sign * plus_size/2 * up, 2radius, line_thickness);

    r := 1/6plus_size;

    draw_line(centre + sign * 1/6plus_size * up + r * right, centre + sign * 1/6plus_size * up + r * left, true);
    draw_line(centre + (r + sign * 1/6plus_size) * up, centre + (r - sign * 1/6plus_size) * down, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "square union";
    z3 - z0 = z2 - z1 = 2radius * right;
    z0 - z1 = sign * 2radius * up;
    1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;

    draw_line(z0, z1, true);
    draw_line(z1, z2, false);
    draw_line(z2, z3, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(4/3plus_size#, 1); "double square union";
    z3a - z0a = z2a - z1a = 2radius * right;
    z0a - z1a = sign * 2radius * up;
    1/2[1/2[z0a,z1a], 1/2[z2a,z3a]] = centre;
    z3b - z0b = z2b - z1b = 5/9plus_size * right;
    z0b - z1b = sign * 17/12radius * up;
    y0b = y0a;
    1/2[x0b, x3b] = xpart centre;

    draw_line(z0a, z1a, true);
    draw_line(z1a, z2a, false);
    draw_line(z2a, z3a, true);
    draw_line(z0b, z1b, true);
    draw_line(z1b, z2b, false);
    draw_line(z2b, z3b, true);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "square union dot";
    z3 - z0 = z2 - z1 = 2radius * right;
    z0 - z1 = sign * 2radius * up;
    1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;

    draw_line(z0, z1, true);
    draw_line(z1, z2, false);
    draw_line(z2, z3, true);
    fill dot(centre + sign * 1/6plus_size * up, 3/4dot_size);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "square union plus";
    z3 - z0 = z2 - z1 = 2radius * right;
    z0 - z1 = sign * 2radius * up;
    1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;

    draw_line(z0, z1, true);
    draw_line(z1, z2, false);
    draw_line(z2, z3, true);

    r := 1/6plus_size;

    draw_line(centre + sign * 1/6plus_size * up + r * right, centre + sign * 1/6plus_size * up + r * left, true);
    draw_line(centre + (r + sign * 1/6plus_size) * up, centre + (r - sign * 1/6plus_size) * down, true);
  endchar;
endfor;

for alpha = 0, 180:
  beginoperator(plus_size#, 1); "corner with dot";
    z3 - z0 = z2 - z1 = 2radius * dir alpha;
    z0 - z1 = 2radius * dir (alpha + 90);
    1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;

    draw_line(z1, z2, true);
    draw_line(z2, z3, true);
    fill dot(centre, 3/4dot_size);
  endchar;
endfor;

% triangles

for alpha = 0, 90, 180, 270:
  beginsymbol((3/4small_op_size# + 3/2line_thickness#) * abs(cosd alpha) + sqrt(3) * (small_op_size#/2 + line_thickness#) * abs(sind alpha) + 2side_bearing#, vcentre(sqrt(3) * (small_op_size#/2 + line_thickness#) * abs(cosd alpha) + (3/4small_op_size# + 3/2line_thickness#) * abs(sind alpha))); "small triangle (" & decimal alpha & ")";
    thick := line_thickness;
    radius := small_op_size/2;
    centre := (w/2, (h - d)/2) - 1/4(radius + thick) * dir alpha;

    draw_triangle(a, centre, radius, alpha, thick);
  endchar;
endfor;

for alpha = 0, 90, 180, 270:
  beginsymbol((3/4small_op_size# + 3/2line_thickness#) * abs(cosd alpha) + sqrt(3) * (small_op_size#/2 + line_thickness#) * abs(sind alpha) + 2side_bearing#, vcentre(sqrt(3) * (small_op_size#/2 + line_thickness#) * abs(cosd alpha) + (3/4small_op_size# + 3/2line_thickness#) * abs(sind alpha))); "small filled triangle (" & decimal alpha & ")";
    thick := line_thickness;
    radius := small_op_size/2;
    centre := (w/2, (h - d)/2) - 1/4(radius + thick) * dir alpha;

    filldraw_triangle(a, centre, radius, alpha, thick);
  endchar;
endfor;

for alpha = 0, 90, 180, 270:
  beginsymbol((3/4med_op_size# + 3/2line_thickness#) * abs(cosd alpha) + sqrt(3) * (med_op_size#/2 + line_thickness#) * abs(sind alpha) + 2side_bearing#, vcentre(sqrt(3) * (med_op_size#/2 + line_thickness#) * abs(cosd alpha) + (3/4med_op_size# + 3/2line_thickness#) * abs(sind alpha))); "medium triangle (" & decimal alpha & ")";
    thick := line_thickness;
    radius := med_op_size/2;
    centre := (w/2, (h - d)/2) - 1/4(radius + thick) * dir alpha;

    draw_triangle(a, centre, radius, alpha, thick);
  endchar;
endfor;

for alpha = 0, 90, 180, 270:
  beginsymbol((3/4med_op_size# + 3/2line_thickness#) * abs(cosd alpha) + sqrt(3) * (med_op_size#/2 + line_thickness#) * abs(sind alpha) + 2side_bearing#, vcentre(sqrt(3) * (med_op_size#/2 + line_thickness#) * abs(cosd alpha) + (3/4med_op_size# + 3/2line_thickness#) * abs(sind alpha))); "medium filled triangle (" & decimal alpha & ")";
    thick := line_thickness;
    radius := med_op_size/2;
    centre := (w/2, (h - d)/2) - 1/4(radius + thick) * dir alpha;

    filldraw_triangle(a, centre, radius, alpha, thick);
  endchar;
endfor;

for alpha = 90,  270:
  beginsymbol(sqrt(3) * (large_op_size#/2 + line_thickness#) + 2side_bearing#, vcentre(3/4large_op_size# + 3/2line_thickness#)); "large triangle (" & decimal alpha & ")";
    thick := line_thickness;
    radius := large_op_size/2;
    centre := (w/2, (h - d)/2) - 1/4(radius + thick) * dir alpha;

    draw_triangle(a, centre, radius, alpha, thick);
  endchar;
endfor;

% circles

beginoperator(4/5small_op_size#, 1); "small circle";
  draw_circle(centre, radius, line_thickness);
endchar;

beginoperator(4/5small_op_size#, 1); "small filled circle";
  filldraw_circle(centre, radius, line_thickness);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle";
  draw_circle(centre, radius, line_thickness);
endchar;

beginoperator(4/5med_op_size#, 1); "medium filled circle";
  filldraw_circle(centre, radius, line_thickness);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle minus";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + radius * left, centre + radius * right, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle bar";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + radius * up, centre + radius * down, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle slash";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + radius * dir  45, centre + radius * dir 225, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle backslash";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + radius * dir 135, centre + radius * dir 315, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle plus";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + radius * left, centre + radius * right, false);
  draw_line(centre + radius * up, centre + radius * down, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle times";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + radius * dir  45, centre + radius * dir 225, false);
  draw_line(centre + radius * dir 135, centre + radius * dir 315, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle dot";
  draw_circle(centre, radius, line_thickness);
  fill dot(centre, dot_size);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle circle";
  draw_circle(centre, radius, line_thickness);
  draw_circle(centre, 2/5radius, line_thickness);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle asterisk";
  thick := line_thickness;

  draw_circle(centre, radius, thick);

  penpos a0(4/3thick, 0);
  penpos a1(4/3thick, 60);
  penpos a2(4/3thick, 120);
  penpos a3(4/3thick, 180);
  penpos a4(4/3thick, 240);
  penpos a5(4/3thick, 300);

  penpos b0(2/3thick, 0);
  penpos b1(2/3thick, 60);
  penpos b2(2/3thick, 120);
  penpos b3(2/3thick, 180);
  penpos b4(2/3thick, 240);
  penpos b5(2/3thick, 300);

  reg_poly_points(a)(6, centre, radius, 90);

  z.b0 = z.b1 = z.b2 = z.b3 = z.b4 = z.b5 = centre;

  fill stroke z.a0e -- z.b0e;
  fill stroke z.a1e -- z.b1e;
  fill stroke z.a2e -- z.b2e;
  fill stroke z.a3e -- z.b3e;
  fill stroke z.a4e -- z.b4e;
  fill stroke z.a5e -- z.b5e;
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle dash";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + 2/3radius * left, centre + 2/3radius * right, false);
endchar;

beginoperator(4/5med_op_size#, 1); "medium circle equal";
  draw_circle(centre, radius, line_thickness);
  draw_line(centre + 2/5equal_spread * up + 2/3radius * left, centre + 2/5equal_spread * up + 2/3radius * right, false);
  draw_line(centre + 2/5equal_spread * down + 2/3radius * left, centre + 2/5equal_spread * down + 2/3radius * right, false);
endchar;

for sign = 1,-1:
  beginoperator(4/5med_op_size#, 1); "negated medium circle";
    r := 4/3radius;

    draw_circle(centre, radius, line_thickness);
    draw_line(centre + r * dir (sign * 45), centre + r * dir (sign * 225), true);
  endchar;
endfor;

beginoperator(4/5large_op_size#, 1); "large circle";
  draw_circle(centre, radius, line_thickness);
endchar;

beginoperator(4/5large_op_size#, 1); "large filled circle";
  filldraw_circle(centre, radius, line_thickness);
endchar;

% squares

beginoperator(small_op_size#/sqrt(2), 1); "small square";
  draw_square(centre, radius, 0, line_thickness);
endchar;

beginoperator(small_op_size#/sqrt(2), 1); "small filled square";
  filldraw_square(centre, radius, 0, line_thickness);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square";
  draw_square(centre, radius, 0, line_thickness);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium filled square";
  filldraw_square(centre, radius, 0, line_thickness);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square minus";
  draw_square(centre, radius, 0, line_thickness);
  draw_line(centre + radius * right, centre + radius * left, false);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square vert";
  draw_square(centre, radius, 0, line_thickness);
  draw_line(centre + radius * up, centre + radius * down, false);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square slash";
  r := radius * sqrt(2);

  draw_square(centre, radius, 0, line_thickness);
  draw_line(centre + r * dir 45, centre + r * dir 225, false);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square backslash";
  r := radius * sqrt(2);

  draw_square(centre, radius, 0, line_thickness);
  draw_line(centre + r * dir 135, centre + r * dir 315, false);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square plus";
  draw_square(centre, radius, 0, line_thickness);
  draw_line(centre + radius * right, centre + radius * left, false);
  draw_line(centre + radius * up, centre + radius * down, false);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square times";
  r := radius * sqrt(2);

  draw_square(centre, radius, 0, line_thickness);
  draw_line(centre + r * dir  45, centre + r * dir 225, false);
  draw_line(centre + r * dir 135, centre + r * dir 315, false);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square dot";
  draw_square(centre, radius, 0, line_thickness);
  fill dot(centre, dot_size);
endchar;

beginoperator(med_op_size#/sqrt(2), 1); "medium square square";
  draw_square(centre, radius, 0, line_thickness);
  draw_square(centre, 2/5radius, 0, 4/5line_thickness);
endchar;

beginoperator(large_op_size#/sqrt(2), 1); "large square";
  draw_square(centre, radius, 0, line_thickness);
endchar;

beginoperator(large_op_size#/sqrt(2), 1); "large filled square";
  filldraw_square(centre, radius, 0, line_thickness);
endchar;

beginoperator(small_op_size#, 1); "small diamond";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
endchar;

beginoperator(small_op_size#, 1); "small filled diamond";
  filldraw_square(centre, radius / sqrt(2), 45, line_thickness);
endchar;

beginoperator(med_op_size#, 1); "medium diamond";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
endchar;

beginoperator(med_op_size#, 1); "medium filled diamond";
  filldraw_square(centre, radius / sqrt(2), 45, line_thickness);
endchar;

beginoperator(med_op_size#, 1); "medium diamond minus";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
  draw_line(centre + radius * right, centre + radius * left, false);
endchar;

beginoperator(med_op_size#, 1); "medium diamond vert";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
  draw_line(centre + radius * up, centre + radius * down, false);
endchar;

beginoperator(med_op_size#, 1); "medium diamond slash";
  r := radius / sqrt(2);

  draw_square(centre, r, 45, line_thickness);
  draw_line(centre + r * dir 45, centre + r * dir 225, false);
endchar;

beginoperator(med_op_size#, 1); "medium diamond backslash";
  r := radius / sqrt(2);

  draw_square(centre, r, 45, line_thickness);
  draw_line(centre + r * dir 135, centre + r * dir 315, false);
endchar;

beginoperator(med_op_size#, 1); "medium diamond plus";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
  draw_line(centre + radius * right, centre + radius * left, false);
  draw_line(centre + radius * up, centre + radius * down, false);
endchar;

beginoperator(med_op_size#, 1); "medium diamond times";
  r := radius / sqrt(2);

  draw_square(centre, r, 45, line_thickness);
  draw_line(centre + r * dir  45, centre + r * dir 225, false);
  draw_line(centre + r * dir 135, centre + r * dir 315, false);
endchar;

beginoperator(med_op_size#, 1); "medium diamond dot";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
  fill dot(centre, dot_size);
endchar;

beginoperator(med_op_size#, 1); "medium diamond diamond";
  draw_square(centre, radius / sqrt(2), 45, line_thickness);
  draw_square(centre, 2/5radius / sqrt(2), 45, 4/5line_thickness);
endchar;

beginoperator(5/6small_op_size#, 8/5); "small lozenge";
  x0 = w - x2 = side_bearing;
  y0 = y2 = ypart centre;
  x1 = x3 = xpart centre;
  y1 = h;
  y3 = -d;

  theta := angle(z1 - z0);

  x0' = x0 + line_thickness / sind theta;
  x2' = x2 - line_thickness / sind theta;
  y0' = y2' = y0;
  y1' = y1 - line_thickness / cosd theta;
  y3' = y3 + line_thickness / cosd theta;
  x1' = x3' = x1;

  fill z0 -- z1 -- z2 -- z3 -- cycle;
  unfill z0' -- z1' -- z2' -- z3' -- cycle;
endchar;

beginoperator(5/6small_op_size#, 8/5); "small filled lozenge";
  x0 = w - x2 = side_bearing;
  y0 = y2 = ypart centre;
  x1 = x3 = xpart centre;
  y1 = h;
  y3 = -d;
  
  fill z0 -- z1 -- z2 -- z3 -- cycle;
endchar;

beginoperator(1/sqrt(2)*med_op_size#, 8/5); "medium lozenge";
  x0 = w - x2 = side_bearing;
  y0 = y2 = ypart centre;
  x1 = x3 = xpart centre;
  y1 = h;
  y3 = -d;

  theta := angle(z1 - z0);

  x0' = x0 + line_thickness / sind theta;
  x2' = x2 - line_thickness / sind theta;
  y0' = y2' = y0;
  y1' = y1 - line_thickness / cosd theta;
  y3' = y3 + line_thickness / cosd theta;
  x1' = x3' = x1;

  fill z0 -- z1 -- z2 -- z3 -- cycle;
  unfill z0' -- z1' -- z2' -- z3' -- cycle;
endchar;

beginoperator(1/sqrt(2)*med_op_size#, 8/5); "medium filled lozenge";
  x0 = w - x2 = side_bearing;
  y0 = y2 = ypart centre;
  x1 = x3 = xpart centre;
  y1 = h;
  y3 = -d;

  fill z0 -- z1 -- z2 -- z3 -- cycle;
endchar;

beginoperator(1/sqrt(2)*med_op_size#, 8/5); "medium lozenge minus";
  thick := line_thickness;

  x0 = w - x2 = side_bearing;
  y0 = y2 = ypart centre;
  x1 = x3 = xpart centre;
  y1 = h;
  y3 = -d;

  theta := angle(z1 - z0);

  x0' = x0 + thick / sind theta;
  x2' = x2 - thick / sind theta;
  y0' = y2' = y0;
  y1' = y1 - thick / cosd theta;
  y3' = y3 + thick / cosd theta;
  x1' = x3' = x1;

  fill z0 -- z1 -- z2 -- z3 -- cycle;
  unfill z0' -- z1' -- z2' -- z3' -- cycle;
  draw_line(z0', z2', true);
endchar;

beginoperator(5/4small_op_size#, 1); "small star";
  r := radius + line_thickness;
  t := 1/11r;

  reg_poly_points(a)(5, centre - t * up, r, 90);
  reg_poly_points(b)(5, centre - t * up, .4r, 126);

  s := r - 4/5line_thickness / sind (270 - angle (z.b0 - z.a0));
  
  reg_poly_points(c)(5, centre - t * up, s, 90);
  reg_poly_points(d)(5, centre - t * up, .4s, 126);

  fill z.a0 -- z.b0 -- z.a1 -- z.b1 -- z.a2 -- z.b2 -- z.a3 -- z.b3 -- z.a4 -- z.b4 -- cycle;
  unfill z.c0 -- z.d0 -- z.c1 -- z.d1 -- z.c2 -- z.d2 -- z.c3 -- z.d3 -- z.c4 -- z.d4 -- cycle;
endchar;

beginoperator(small_op_size#, 1); "small filled star";
  r := radius + line_thickness;
  t := 1/11r;

  reg_poly_points(a)(5, centre - t * up, r, 90);
  reg_poly_points(b)(5, centre - t * up, .4r, 126);

  fill z.a0 -- z.b0 -- z.a1 -- z.b1 -- z.a2 -- z.b2 -- z.a3 -- z.b3 -- z.a4 -- z.b4 -- cycle;
endchar;

beginoperator(med_op_size#, 1); "medium star";
  r := radius + line_thickness;
  t := 1/11r;

  reg_poly_points(a)(5, centre - t * up, r, 90);
  reg_poly_points(b)(5, centre - t * up, .4r, 126);

  s := r - line_thickness / sind (270 - angle (z.b0 - z.a0));

  reg_poly_points(c)(5, centre - t * up, s, 90);
  reg_poly_points(d)(5, centre - t * up, .4s, 126);

  fill z.a0 -- z.b0 -- z.a1 -- z.b1 -- z.a2 -- z.b2 -- z.a3 -- z.b3 -- z.a4 -- z.b4 -- cycle;
  unfill z.c0 -- z.d0 -- z.c1 -- z.d1 -- z.c2 -- z.d2 -- z.c3 -- z.d3 -- z.c4 -- z.d4 -- cycle;
endchar;

beginoperator(med_op_size#, 1); "medium filled star";
  r := radius + line_thickness;
  t := 1/11r;

  reg_poly_points(a)(5, centre - t * up, r, 90);
  reg_poly_points(b)(5, centre - t * up, .4r, 126);

  fill z.a0 -- z.b0 -- z.a1 -- z.b1 -- z.a2 -- z.b2 -- z.a3 -- z.b3 -- z.a4 -- z.b4 -- cycle;
endchar;

beginoperator(large_op_size#, 1); "large star";
  r := radius + line_thickness;
  t := 1/11r;

  reg_poly_points(a)(5, centre - t * up, r, 90);
  reg_poly_points(b)(5, centre - t * up, .4r, 126);

  s := r - line_thickness / sind (270 - angle (z.b0 - z.a0));

  reg_poly_points(c)(5, centre - t * up, s, 90);
  reg_poly_points(d)(5, centre - t * up, .4s, 126);

  fill z.a0 -- z.b0 -- z.a1 -- z.b1 -- z.a2 -- z.b2 -- z.a3 -- z.b3 -- z.a4 -- z.b4 -- cycle;
  unfill z.c0 -- z.d0 -- z.c1 -- z.d1 -- z.c2 -- z.d2 -- z.c3 -- z.d3 -- z.c4 -- z.d4 -- cycle;
endchar;

beginoperator(large_op_size#, 1); "large filled star";
  r := radius + line_thickness;
  t := 1/11r;

  reg_poly_points(a)(5, centre - t * up, r, 90);
  reg_poly_points(b)(5, centre - t * up, .4r, 126);

  fill z.a0 -- z.b0 -- z.a1 -- z.b1 -- z.a2 -- z.b2 -- z.a3 -- z.b3 -- z.a4 -- z.b4 -- cycle;
endchar;

beginoperator(small_op_size#, 1); "asterisk";
  r := w/2 - side_bearing;

  penpos a0(4/3line_thickness,   0);
  penpos a1(4/3line_thickness,  60);
  penpos a2(4/3line_thickness, 120);
  penpos a3(4/3line_thickness, 180);
  penpos a4(4/3line_thickness, 240);
  penpos a5(4/3line_thickness, 300);

  penpos b0(2/3line_thickness,   0);
  penpos b1(2/3line_thickness,  60);
  penpos b2(2/3line_thickness, 120);
  penpos b3(2/3line_thickness, 180);
  penpos b4(2/3line_thickness, 240);
  penpos b5(2/3line_thickness, 300);

  reg_poly_points(a)(6, centre, r, 90);

  z.b0 = z.b1 = z.b2 = z.b3 = z.b4 = z.b5 = centre;

  fill stroke z.a0e -- z.b0e;
  fill stroke z.a1e -- z.b1e;
  fill stroke z.a2e -- z.b2e;
  fill stroke z.a3e -- z.b3e;
  fill stroke z.a4e -- z.b4e;
  fill stroke z.a5e -- z.b5e;
endchar;

beginsymbol(18/10order_width# + 2side_bearing#, vcentre(2equal_spread# + line_thickness#)); "infinity";
  pair centre;
  centre := (w/2, (h-d)/2);
  thick := line_thickness;
  thin  := letter_line_thickness;
  alpha := 0;

  z0 = centre - (9/10order_width - 1/2thin) * dir alpha;
  z1 = centre + (9/10order_width - 1/2thin) * dir alpha;
  z6 = 1/5[z0,z1];
  z7 = 4/5[z0,z1];
  z2 = z6 + equal_spread * dir (alpha + 90);
  z3 = z6 - equal_spread * dir (alpha + 90);
  z4 = z7 + equal_spread * dir (alpha + 90);
  z5 = z7 - equal_spread * dir (alpha + 90);
  z8 = z9 = centre;

  penpos0(thin,  alpha);
  penpos1(thin,  alpha);
  penpos2(thick, alpha - 90);
  penpos3(thick, alpha + 90);
  penpos4(thick, alpha + 90);
  penpos5(thick, alpha - 90);
  penpos8(thin,  alpha - 135);
  penpos9(thin,  alpha + 135);

  fill stroke z4.e{dir (alpha + 180)}
    .. {dir (alpha + 225)}z9.e
    .. {dir (alpha + 180)}z3.e
    .. {dir (alpha + 90)}z0.e
    .. {dir alpha}z2.e
    .. {dir (alpha - 45)}z8.e
    .. {dir alpha}z5.e
    .. {dir (alpha + 90)}z1.e
    .. cycle;

  penlabels (0,1,2,3,4,5,6,7,8,9);
endchar;

for alpha = 0, 180:
  beginsymbol(16/10order_width# + 2side_bearing#, vcentre(2equal_spread# + line_thickness#)); "proportional";
    pair centre;
    centre := (w/2, (h-d)/2);
    thick := line_thickness;

    z0 = centre - (8/10order_width - 1/2thick) * dir alpha;
    z1 = centre + (7/10order_width - 1/2thick) * dir alpha;
    z4 = z1 + equal_spread * dir (alpha + 90);
    z5 = z1 - equal_spread * dir (alpha + 90);
    z6 - z4 = z7 - z5 = (1/10order_width + 1/2thick) * dir alpha;
    z10 = 1/4[z0,z1];
    z2 = z10 + equal_spread * dir (alpha + 90);
    z3 = z10 - equal_spread * dir (alpha + 90);
    z8 = z9 = centre + 1/10order_width * dir alpha;

    penpos0(thick, alpha);
    penpos2(thick, alpha - 90);
    penpos3(thick, alpha + 90);
    penpos4(thick, alpha + 90);
    penpos5(thick, alpha - 90);
    penpos6(thick, alpha + 90);
    penpos7(thick, alpha - 90);
    penpos8(thick, alpha + 225);
    penpos9(thick, alpha + 135);

    fill stroke z6.e
      -- z4.e{dir (alpha + 180)}
      .. {dir (alpha + 225)}z9.e
      .. {dir (alpha + 180)}z3.e
      .. {dir (alpha + 90)}z0.e
      .. {dir alpha}z2.e
      .. {dir (alpha - 45)}z8.e
      .. {dir alpha}z5.e
      -- z7.e;

    penlabels (0,1,2,3,4,5,6,7,8,9);
  endchar;
endfor;

beginsymbol(14/10order_width# + 2side_bearing#, vcentre(2equal_spread# + line_thickness#)); "crossing";
  pair centre;
  centre := (w/2, (h-d)/2);
  thick := line_thickness;
  alpha := 0;

  z0 = centre - (6/10order_width - 1/2thick) * dir alpha;
  z1 = centre + (6/10order_width - 1/2thick) * dir alpha;
  z2 = z0 + equal_spread * dir (alpha + 90);
  z3 = z0 - equal_spread * dir (alpha + 90);
  z4 = z1 + equal_spread * dir (alpha + 90);
  z5 = z1 - equal_spread * dir (alpha + 90);
  z6 - z4 = z7 - z5 = (1/10order_width + 1/2thick) * dir alpha;
  z2 - z8 = z3 - z9 = (1/10order_width + 1/2thick) * dir alpha;
  z10 = z11 = 1/2[z0,z1];

  penpos2(thick, alpha + 90);
  penpos3(thick, alpha + 90);
  penpos4(thick, alpha + 90);
  penpos5(thick, alpha + 90);
  penpos6(thick, alpha + 90);
  penpos7(thick, alpha + 90);
  penpos8(thick, alpha + 90);
  penpos9(thick, alpha + 90);
  penpos10(thick, alpha + 45);
  penpos11(thick, alpha + 135);

  fill stroke z6.e 
    -- z4.e{dir (alpha + 180)}
    .. {dir (alpha + 225)}z11.e
    .. {dir (alpha + 180)}z3.e
    -- z9.e;
  fill stroke z8.e
    -- z2.e{dir alpha}
    .. {dir (alpha - 45)}z10.e
    .. {dir alpha}z5.e
    -- z7.e;

   penlabels (0,1,2,3,4,5,6,7,8,9,10,11);
endchar;

beginsymbol(equal_spread# + line_thickness# + 2side_bearing#, vcentre(med_op_size#)); "between";
  pair centre;
  centre := (w/2, (h-d)/2);
  r := med_op_size/2;

  z0 = centre;
  z1 = centre;

  draw_smile(a, 1, z0 - r * up, z0 + r * up, equal_spread, line_thickness, true);
  draw_smile(b, -1, z1 - r * up, z1 + r * up, equal_spread, line_thickness, true);
endchar;

beginsymbol(2equal_spread# + 2side_bearing#, x_height#, desc_depth#); "intercalate";
  z1 - z0 = z3 - z2 = (2equal_spread - line_thickness) * right;
  z2 - z0 = (h + d - line_thickness) * up;

  1/2[1/2[z0,z1], 1/2[z2,z3]] = (w/2, (h-d)/2);

  draw_line(z2, z3, true);
  draw_line(1/2[z0,z1], 1/2[z2,z3], true);
endchar;

beginsymbol(2/3equal_spread# + line_thickness# + 2side_bearing#, vcentre(plus_size#)); "wreath";
  pair centre;
  centre := (w/2, (h-d)/2);

  draw_sim(a, centre + 1/2plus_size * up, centre - 1/2plus_size * up, 1/3equal_spread, thick);
endchar;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "angle";
    z0 = centre + (plus_size - line_thickness)/2 * down;
    z1 = z0 + sign * 1/2plus_size * right;
    z2 = z0 + sign * 1/2plus_size * left;
    x3 = xpart centre + sign * 1/2plus_size;
    y3 = ypart centre + 2/3plus_size;
    z4 = 4/5[z2,z3];
    z5 = z4l + whatever * (z2 - z4);
    z5 = z1r + whatever * right;
    z6 = z4r + whatever * (z2 - z4);
    z6 = z1r + whatever * right;
    z7 = z1l + whatever * right;
    z7 = z6 + whatever * dir (90 + sign * 17);

    penpos1(line_thickness, 90);
    penpos4(line_thickness, angle(z3 - z2) + sign * 90);

    fill z1r -- z5 -- z4l -- z4r -- z6 -- z7 -- z1l -- cycle;

    penlabels(1,2,3,4,5,6,7);
  endchar;
endfor;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "measured angle";
    z0 = centre + (plus_size - line_thickness)/2 * down;
    z1 = z0 + sign * 1/2plus_size * right;
    z2 = z0 + sign * 1/2plus_size * left;
    x3 = xpart centre + sign * 1/2plus_size;
    y3 = ypart centre + 2/3plus_size;
    z4 = 4/5[z2,z3];
    z5 = z4l + whatever * (z2 - z4);
    z5 = z1r + whatever * right;
    z6 = z4r + whatever * (z2 - z4);
    z6 = z1r + whatever * right;
    z7 = z1l + whatever * right;
    z7 = z6 + whatever * dir (90 + sign * 17);
    z8 = 2/3[z2,z1];
    z9 = z2 + sign * ((z8 - z2) rotated angle (z3 - z2));

    penpos1(line_thickness, 90);
    penpos4(line_thickness, angle(z3 - z2) + sign * 90);
    penpos8(line_thickness, 90 - sign * 90);
    penpos9(line_thickness, angle(z3 - z2));

    fill z1r -- z5 -- z4l -- z4r -- z6 -- z7 -- z1l -- cycle;
    fill stroke z8.e{up} .. {dir (angle (z3 - z2) + sign * 90)}z9.e;

    penlabels(1,2,3,4,5,6,7,8,9);
  endchar;
endfor;

for alpha = 0, 90, 180, 270:
  beginoperator(plus_size#, 1); "spherical angle (" & decimal alpha & ")";
    draw_less(a, centre - 1/2plus_size * dir alpha, centre + 1/2plus_size * dir alpha, 2radius, line_thickness, false, false);
    z3 = 2/3[z2a, z0a];
    z4 = 2/3[z2a, z1a];

    penpos3(line_thickness, alpha + 35);
    penpos4(line_thickness, alpha - 35);

    fill stroke z4.e{dir (alpha + 55)} .. {dir (alpha + 125)}z3.e;

    penlabels(3,4);
  endchar;
endfor;

beginoperator(plus_size#, 1); "right angle";
  z3 - z0 = z2 - z1 = 2radius * right;
  z0 - z1 = 2radius * up;
  1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;

  draw_line(z0, z1, true);
  draw_line(z1, z2, true);
endchar;

beginoperator(plus_size#, 1); "measured right angle";
  thick := line_thickness;

  z3 - z0 = z2 - z1 = 2radius * right;
  z0 - z1 = 2radius * up;
  1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;
  z4 = 3/5[z1,z0] + (1/2thick - eps) * right;
  z5 = 3/5[z1,z2] + (1/2thick - eps) * up;

  penpos4(thick, 90);
  penpos5(thick, 0);

  draw_line(z0, z1, true);
  draw_line(z1, z2, true);
  fill stroke z4.e{right} .. {down}z5.e;  

  penlabels(0,1,2,3,4,5);
endchar;

beginoperator(plus_size#, 1); "squared right angle";
  z3 - z0 = z2 - z1 = 2radius * right;
  z0 - z1 = 2radius * up;
  1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;
  z4 = 1/2[z1,z0];
  z5 = 1/2[z1,z2];

  penpos4(line_thickness, 90);
  penpos5(line_thickness, 0);

  draw_line(z0, z1, true);
  draw_line(z1, z2, true);
  draw_line(z4, centre, true);
  draw_line(z5, centre, true);

  penlabels(0,1,2,3,4,5);
endchar;

beginoperator(plus_size#, 1); "right angle with dot";
  thick := line_thickness;

  z3 - z0 = z2 - z1 = 2radius * right;
  z0 - z1 = 2radius * up;
  1/2[1/2[z0,z1], 1/2[z2,z3]] = centre;
  z4 = 3/5[z1,z0] + (1/2thick - eps) * right;
  z5 = 3/5[z1,z2] + (1/2thick - eps) * up;
  z6 = 1/4[z1,z3]; 

  penpos4(line_thickness, 90);
  penpos5(line_thickness, 0);

  draw_line(z0, z1, true);
  draw_line(z1, z2, true);
  fill stroke z4.e{right} .. {down}z5.e;
  fill dot(z6, 1/2dot_size); 

  penlabels(0,1,2,3,4,5);
endchar;

beginsymbol(3u# + line_thickness#, 3/5asc_height#, 0); "prime";
  z0 = (w, h);
  z1 = z0 + (3/4u + line_thickness) * left;
  z2 = (1u, 1/9h);
  z3 = z2 + 5/4line_thickness * right;

  fill z0 -- z1 -- z2 -- z3 -- cycle;
  labels(0,1,2,3);
endchar;

beginsymbol(3u# + line_thickness#, 3/5asc_height#, 0); "backprime";
  z0 = (0, h);
  z1 = z0 + (3/4u + line_thickness) * right;
  z2 = (w - 1u, 1/9h);
  z3 = z2 + 5/4line_thickness * left;

  fill z0 -- z1 -- z2 -- z3 -- cycle;
  labels(0,1,2,3);
endchar;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "product";
    draw_product(centre, plus_size, plus_size, sign, letter_line_thickness);
  endchar;
endfor;

beginsymbol(2/5asc_height# + 2side_bearing# + line_thickness#, asc_height#, 0); "small integral";
  pair centre;
  centre := (w/2, (h - d)/2);

  draw_integral(a, 1/2, centre, line_thickness);
endchar;

beginsymbol(11u# + line_thickness# + 2side_bearing#, asc_height#, 0); "check mark";
  thick := line_thickness;

  x1l = side_bearing;
  y1 = math_axis;
  x2 = side_bearing + 3u;
  y2 = -d;
  x3 = w -x2;
  y3 = h;
  x4r = w - side_bearing;
  y4l = h;
  z5r = 1/10[z4r,z1r];

  theta := angle(z3 - z2);

  penpos1(4/3thick, 30);
  penpos2(thick, 0);
  penpos3(thick, -90 + theta);
  penpos4(1/3thick, -80);
  penpos5(thick, -50);

  z6 = z1r + whatever * (z2l - z1l);
  z6 = z3l + whatever * (z3r - z2r);

  fill z1l -- z2l -- z2r{z3r - z2r} .. {dir 40}z5r .. z4r -- z4l{dir 180} ... z5l{dir 220} .. {z2l - z3l}z6 -- z1r -- cycle;

  penlabels(1,2,3,4,5,6);
endchar; 

beginsymbol(6u# + line_thickness# + 2side_bearing#, 5/4asc_height#, 1/8asc_height#); "lightning";
  thick := line_thickness;

  x3r = w - side_bearing;
  x2l = side_bearing + u;
  x4  = 1/3w;
  y1l = h;
  y3r = 14/24h;
  y4  = -d + 1/2thick;
  z6 - z5 = whatever * dir 15;

  penpos1(3/2thick, -20);
  penpos2(3/2thick, 15);
  penpos3(2thick, 15);
  penpos4(thick, -20);
  penpos5(thick, -75);
  penpos6(thick, -75);

  z1 - z2 = whatever * (z4 - z3);
  z5r = z2;
  z6l = z3;
  z7 = whatever[z1r,z2r];
  z7 = whatever[z5l,z6l];
  z8 = whatever[z4l,z3l];
  z8 = whatever[z6r,z5r];

  fill z1l -- z2l -- z8 -- z4l -- z4r -- z3r -- z7 -- z1r -- cycle;
  draw_arrowhead(z4, angle (z4l - z3l), 4/5arrow_spread, thick);

  penlabels(1,2,3,4,7,8);
endchar;

for filled = false, true:
  beginsymbol(13u#, cap_height#, 0); "diamond suit";
    thick := line_thickness;
    bend := 5;

    x0 = x2 = x4 = x6 = w/2;
    1/2[y0,y2] = 1/2[y4,y6] = h/2;
    y2 - y0 = h;
    1/2[x1,x3] = 1/2[x5,x7] = w/2;
    x3 - x1 = w - 2side_bearing;
    y1 = y3 = y5 = y7 = h/2;

    theta := angle(z2 - z1);

    y6 - y4 = h - 2thick / cosd theta;
    x7 - x5 = w - 2side_bearing - 2thick / sind theta;

    fill z0{dir (180-theta-bend)} .. {dir (180-theta+bend)}z1{dir (theta-bend)} .. {dir (theta+bend)}z2{dir (-theta-bend)} .. {dir (-theta+bend)}z3{dir (180+theta-bend)} .. {dir (180+theta+bend)}z0 & cycle;
    if not filled:
      unfill z4{dir (180-theta-bend)} .. {dir (180-theta+bend)}z5{dir (theta-bend)} .. {dir (theta+bend)}z6{dir (-theta-bend)} .. {dir (-theta+bend)}z7{dir (180+theta-bend)} .. {dir (180+theta+bend)}z4 & cycle;
    fi;
    labels(0,1,2,3,4,5,6,7);
  endchar;
endfor;

for filled = false, true:
  beginsymbol(14u#, cap_height#, 0); "heart suit";
    thick := line_thickness;

    x0 = x1l = x1'l = w/2;
    y0 = 0;
    1/2[x2l,x3l] = w/2;
    x3l - x2l = w - 2side_bearing;
    y1r = y1'r;
    y2l = y3l = 3/4h;
    x4 = 1/2[x1,x2];
    x5 = 1/2[x1',x3];
    y4l = y5l = h;
    h - y2 = 2(h - y1l);

    penpos1(thick, 180+45);
    penpos1'(thick, -45);
    penpos2(thick, 0);
    penpos3(thick, 180);
    penpos4(thick, -90);
    penpos5(thick, -90);

    path p[];
    numeric t[];

    z6 = z1r + whatever * dir (270+45);
    z6 = z1'r + whatever * dir (270-45);
    z7 = z0 + thick * dir 20;
    z8 = z0 + thick * dir (180-20);
    p1 = z7{dir (90+35)} .. {dir 90}z2r;
    p2 = z3r{dir 270} .. {dir (270-35)}z8;
    (t1,t2) = p1 intersectiontimes p2;
      
    fill z0{dir (90+35)} .. {dir 90}z2l .. {dir 0}z4l .. {dir (270+45)}z1l{dir (90-45)} .. {dir 0}z5l .. {dir 270}z3l .. {dir (270-35)}z0 & cycle;
    if not filled:
      unfill subpath (t1,1) of p1 & z2r{dir 90} .. {dir 0}z4r .. {dir (270+45)}z1r -- z6 -- z1'r{dir (90-45)} .. {dir 0}z5r .. {dir 270}z3r & subpath (0,t2) of p2 -- cycle;
    fi;

    penlabels(0,1,1',2,3,4,5,6,7,8,10);
  endchar;
endfor;

beginsymbol(13u#, cap_height#, 0); "spade suit";
  x0 = x1 = w/2;
  y0 = h;
  1/2[x2,x3] = w/2;
  x3 - x2 = w - 2side_bearing;
  y2 = y3;
  x4 = 1/2[x1,x2];
  x5 = 1/2[x1,x3];
  y4 = y5 = 1/6h;
  y2 - y4 = x4 - x2;
  y1 = 3/5[y2,y4];
  x6 = x0;
  y6 = 0;

  penpos1(2u, 0);
  penpos6(3u, 0);

  fill z0{dir (270-30)} .. z2 .. z4 .. {dir (90-30)}z1l -- z6l --
    z6r -- z1r{dir (270+30)} .. z5 .. z3 .. {dir (90+30)}z0 -- cycle;

  penlabels(0,1,2,3,4,5,6);
endchar;

beginsymbol(14u#, cap_height#, 0); "club suit";
  r := 1/4(w - 2side_bearing);

  x0 = w/2;
  y0 = h - 2.5r;
  x1 = w - x3 = side_bearing + r;
  y1 = y3 = y0;
  x2 = x4 = x0;
  y2 = h - r;
  y4 = 0;

  penpos0(3/2u, 0);
  penpos2(3/2u, 0);
  penpos4(3u, 0);

  fill circle(z1, r);
  fill circle(z2, r);
  fill circle(z3, r);
  fill stroke z2e -- z0e -- z4e;

  penlabels(0,1,2,3,4);
endchar;

beginoperator(med_op_size#, 1); "maltese";
  r := 1/2med_op_size;
  thick := line_thickness;

  1/2[z0,z1] = centre + r * left;
  1/2[z2,z3] = centre + r * down;
  1/2[z4,z5] = centre + r * right;
  1/2[z6,z7] = centre + r * up;
  z0 - z1 = z5 - z4 = r * up;
  z3 - z2 = z6 - z7 = r * right;
  1/2[z8,z9] = centre + 1/2thick * up;
  1/2[z10,z11] = centre - 1/2thick * up;
  z9 - z8 = z11 - z10 = 2thick * right;
  1/2[z12,z13] = centre + thick * up;
  1/2[z14,z15] = centre - thick * up;
  z13 - z12 = z15 - z14 = thick * right;

  fill z0 -- z1 -- z10 -- z11 -- z4 -- z5 -- z9 -- z8 -- cycle;
  fill z6 -- z7 -- z12 -- z14 -- z2 -- z3 -- z15 -- z13 -- cycle;

  labels(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
endchar;

beginoperator(med_op_size#, 2/sqrt(3)); "star of david";
  r := med_op_size/sqrt(3);

  reg_poly_points(a)(6, centre, r, 90);

  s := r - 4/5line_thickness / sind (270 - angle (z.a2 - z.a0));

  reg_poly_points(b)(6, centre, s, 90);

  z0.r = z.a0; z0.l = z.b0;
  z1.r = z.a2; z1.l = z.b2;
  z2.r = z.a4; z2.l = z.b4;
  z3.r = z.a1; z3.l = z.b1;
  z4.r = z.a3; z4.l = z.b3;
  z5.r = z.a5; z5.l = z.b5;

  fill stroke z0.e -- z1.e -- z2.e -- cycle;
  fill stroke z4.e -- z5.e -- z3.e -- cycle;

  penlabels(0,1,2,3,4,5);
endchar;

beginoperator(plus_size#, 1); "sector";
  path p;
  numeric r,s;

  thick := line_thickness;
  alpha := 90;

  z0 = centre - 1/2plus_size * dir alpha;
  z1 = z0 + 9/10plus_size * dir alpha;

  put_less(a, z0, z1, 9/10plus_size, thick, false, false);
  
  z9 = whatever[z3a.l, z0a.l] = whatever[z4a.l,z1a.l];
  
  penpos1'(thick, 90);
  
  z1'r = z9 + length(z0a.l - z9)*up;
  z4r  = z0a.l - line_thickness*(dir(angle(z0a.l-z9)));
  z5r  = z1a.l - line_thickness*(dir(angle(z1a.l-z9)));

  theta := angle(z0a.l - z9);
  
  p = (z4r{dir(theta -90)} .. z1'l .. {dir(-theta +90)}z5r);
  r = ypart ((z5a -- z0a.r) intersectiontimes p);
  s = ypart ((z5a -- z1a.r) intersectiontimes p);
  show(-theta-90);
  fill   z0a.l{dir(theta -90)} .. z1'.r .. {dir(-theta +90)}z1a.l -- z4a.l -- z3a.l -- cycle;
  unfill subpath (r,s) of p  -- z5a   -- cycle;

  penlabels(1',4,5,9);
endchar;

beginsymbol(5/4order_width# + 2side_bearing#, cap_height#, 0); "forall";
  thick := line_thickness;

  x0 = side_bearing + 1/2thick;
  x1 = w - side_bearing - 1/2thick;
  x2 = w/2 - 1/4thick;
  x3 = w/2  + 1/4thick;
  y0 = y1 = h;
  y2 = y3 = 0;

  penpos0(thick / sind(abs(angle(z2 - z0))), 0);
  penpos1(thick / sind(abs(angle(z2 - z0))), 0);

  z4 = z0l + whatever * (z2 - z0) = z2 + whatever * right;
  z5 = z1r + whatever * (z3 - z1) = z2 + whatever * right;
  z6 = z0r + whatever * (z2 - z0) = z1l + whatever * (z3 - z1);
  z7 = whatever [z0,z2];
  z8 = whatever [z1,z2];
  y7 = y8 = 0.6 * y0;

  fill z0l -- z4 -- z5 -- z1r -- z1l -- z6 -- z0r -- cycle;
  draw_line(z7, z8, false);

  penlabels(0,1,2,3,4,5,6,7,8);
endchar;

for negated = 0, 1:
  beginsymbol(order_width# + 2side_bearing#, if negated = 0: cap_height# else: cap_height# + 2/3equal_spread# fi, if negated = 0: 0 else: 2/3equal_spread# fi); "exists";
    thick := line_thickness;

    x1  = x3  = w - side_bearing - thick/2;
    y1 = cap_height;
    y3 = 0;
    x1' = x3' = w - side_bearing;
    x0 = x2 = side_bearing;
    y0 = y1' = cap_height - line_thickness/2;
    y2 = y3' = line_thickness/2;
    z4 = 1/8[1/2[z0,z2], 1/2[z1,z3]];

    draw_straight(z1, z3, thick, false);
    draw_line(z0, z1', false);
    draw_line(z4, 1/2[z1,z3], false);
    draw_line(z2, z3', false);

    if negated = 1:
      stroke_through(1/2[1/2[z0,z2], 1/2[z1,z3]], h + d - stroke_through_thickness)
    fi;
  endchar;
endfor;

beginsymbol(order_width# + 2side_bearing#, cap_height#, 0); "exists finitely many";
  thick := line_thickness;

  x1  = x3  = w - side_bearing - thick/2;
  y1 = cap_height;
  y3 = 0;
  x3'  = w - side_bearing;
  x0 = x2 = side_bearing;
  y0 = cap_height - line_thickness/2;
  y2 = y3' = line_thickness/2;
  z4 = 1/8[1/2[z0,z2], 1/2[z1,z3]];

  draw_straight(z1, z3, thick, false);
  draw_line(z4, 1/2[z1,z3], false);
  draw_line(z2, z3', false);
endchar;

beginsymbol(5/4order_width# + 2side_bearing#, cap_height#, 0); "game quantifier";
  thick := line_thickness;

  x0 = x1 = 1/2order_width + side_bearing;
  y0 = cap_height - 1/2thick;
  y1 = 1/2line_thickness;
  x2 = w - side_bearing - 1/2thick;
  y2 = (h - d)/2;
  x3r = x4r = side_bearing;
  y3 = 5/6cap_height;
  y4 = 1/6cap_height;

  penpos0(thick, 90);
  penpos1(thick, -90);
  penpos2(thick, 0);
  penpos3(thick, 125);
  penpos4(thick, -125);

  fill stroke z3.e .. z0.e .. z2.e{down} .. z1.e{left} .. z4.e;
  draw_straight(z4r + 1/2thick * right, 2/5[z4r,z3r] + 1/2thick * right, thick, false);
  draw_line(2/5[z4r,z3r], 2/5[z4r,z3r] + 1/2order_width * right, false);

  penlabels(0,1,2,3,4);
endchar;

beginsymbol(7/8order_width# + 2side_bearing#, cap_height#, 0); "complement";
  thick := line_thickness;

  z0 - z1 = (cap_height - thick) * up;
  z3 - z2 = (w - 2side_bearing - thick) * right;
  1/2[z0,z1] = 1/2[z2,z3] = (w/2,(h-d)/2);
  x4 = x6 = x2;
  x5 = x7 = x3;
  y4 = y5 = 1/4[y0,y1];
  y6 = y7 = 3/4[y0,y1];

  penpos0(thick, 90);
  penpos1(thick, -90);
  penpos4(thick, -180);
  penpos5(thick, 0);
  penpos6(thick, -180);
  penpos7(thick, 0);

  fill stroke z5.e{up} .. z0.e .. {down}z4.e -- z6.e{down} .. z1.e .. {up}z7.e;

  penlabels(0,1,2,3,4,5,6,7);
endchar;

beginsymbol(4u# + line_thickness# + 2side_bearing#, asc_height#, 0); "flat";
  thick := line_thickness;

  x0l = x1l = side_bearing;
  x4l = x5 = side_bearing + thick;
  y0 = -d;
  y1 = h;
  x2r = w - side_bearing;
  x3 = w/2;
  y3r = x_height;
  y2 = 1/2[y0,y1];
  y4r = 5/6x_height;
  y5 = thick / cosd 35 - d;

  penpos0(thick, 0);
  penpos1(thick, 0);
  penpos2(thick, 0);
  penpos3(7/8thick, 90);
  penpos4(2/3thick, 130);

  fill z1.l -- z0.l -- z0.r{dir 35} ... {up}z2.r .. {left}z3.r ..{dir 230}z4.r -- z4.l{dir 50} .. {right}z3.l .. {down}z2.l .. {dir 215}z5 -- z1.r -- cycle;

  penlabels (0,1,2,3,4,5);
endchar;

beginsymbol(4u# + line_thickness# + 2side_bearing#, asc_height#, desc_depth#); "natural";
  thick := line_thickness;

  x0l = x1l = w - x2r = w - x3r = side_bearing;
  x4 = x5 = w - x6 = w - x7 = side_bearing;
  y1 = y3 = h;
  y7r = x_height;
  y4l = 0;
  y0 = y2  = -d;
  z6 = z4 + whatever * dir 15;
  z5 = z7 + whatever * dir 15;

  penpos0(thick, 0);
  penpos1(thick, 0);
  penpos2(thick, 0);
  penpos3(thick, 0);
  penpos4(thick/cosd(15), 90);
  penpos5(thick/cosd(15), 90);
  penpos6(thick/cosd(15), 90);
  penpos7(thick/cosd(15), 90);

  z8 = whatever[z0,z1] = whatever[z4,z6];
  z9 = whatever[z2,z3] = whatever[z5,z7];

  penpos8(thick, 0);
  penpos9(thick, 0);

  fill stroke z1e -- z8e;
  fill stroke z9e -- z2e;
  fill stroke z4e -- z6e;
  fill stroke z5e -- z7e;

  penlabels(1,2,4,5,6,7);
endchar;

beginsymbol(4u# + line_thickness# + 2side_bearing#, asc_height#, desc_depth#); "sharp";
  thick := line_thickness;

  x0l - x4 = x1l - x5 = x6 - x2r = x7 - x3r;
  x2l - x0r = x3l - x1r = 2(x0l - x4);
  x4 = x5 = w - x6 = w - x7 = side_bearing;
  y3 = h;
  y7r = x_height;
  y4l = 0;
  y0  = -d;
  z2 = z0 + whatever * dir 20;
  z1 = z3 + whatever * dir 20;
  z6 = z4 + whatever * dir 15;
  z5 = z7 + whatever * dir 15;

  penpos0(thick, 0);
  penpos1(thick, 0);
  penpos2(thick, 0);
  penpos3(thick, 0);
  penpos4(thick/cosd(15), 90);
  penpos5(thick/cosd(15), 90);
  penpos6(thick/cosd(15), 90);
  penpos7(thick/cosd(15), 90);

  fill stroke z0e -- z1e;
  fill stroke z2e -- z3e;
  fill stroke z4e -- z6e;
  fill stroke z5e -- z7e;

  penlabels (0,1,2,3,4,5,6,7);
endchar;

beginsymbol(8u# + letter_line_thickness# + 2side_bearing#, cap_height#, 0); "aleph";
  thick := letter_line_thickness;

  x0l = x2l = side_bearing;
  x1r = x3r = w - side_bearing;
  y0l = h;
  y1 = h;
  y2 = 0;
  y3r = 0;

  penpos0(thick/sind(abs(angle(z3r-z0l))), 0);
  penpos1(thick, 0);
  penpos2(thick, 0);
  penpos3(thick/sind(abs(angle(z3r-z0l))), 0);

  path p;
  p = z0{dir -70} .. {dir -70}z3;

  z4 = point 3/10 of p;
  z5 = point 5/8 of p;
  z6 = point 1/2 of p;

  penpos4(8/9thick, -40);
  penpos5(8/9thick, -45);

  penpos6(thick/sind(abs(angle(z3r-z0l))),0);

  fill stroke z0.e{dir -70} .. z6.e .. {dir -70}z3.e;
  fill stroke z2.e{up} .. {dir 50}z4.e;
  fill stroke z5.e{dir 45} .. {up}z1.e;

  penlabels(0,1,2,3,4,5,6);
endchar;

beginsymbol(8u# + letter_line_thickness# + 2side_bearing#, cap_height#, 0); "beth";
  thick := letter_line_thickness;

  x0 = u + side_bearing;
  x1 = 5/8[x2,x4];
  x2 = side_bearing;
  x3 = w - side_bearing;
  y0r = h;
  y1r = h;
  y2l = 0;
  y3l = 0;
  z4r = 7/8[z2,z3];
  x5 = x4;
  y5 = 2/3h;

  penpos0(thick, 90);
  penpos1(thick, 90);
  penpos2(thick, 90);
  penpos3(thick, 90);
  penpos4(thick, 0);
  penpos5(thick, 0);

  fill stroke z2.e -- z3.e;
  fill stroke z0.e -- z1.e{right} ..tension3/4.. {down}z5.e -- z4.e;

  penlabels(0,1,2,3,4,5);
endchar;

beginsymbol(6u# + letter_line_thickness# + 2side_bearing#, cap_height#, 0); "gimel";
  thick := letter_line_thickness;

  x0 = x2 = side_bearing;
  x2'r = 1/8[x0,x1];
  x1 = x3r = w - side_bearing;
  x4 = 1/4[x0,x1];
  x5 = 1/2[x0,x1];
  x6 = 2/3[x0,x1];
  y0 = y1 = h;
  y2l = y3 = 0;
  y2' = y2;
  y4r = h + 1/4thick;
  z5 = z4 + whatever * dir -30;
  y6 = 2/3h;

  penpos2(thick, 90);
  penpos2'(thick * sind 80, 90);
  penpos3(thick, 0);
  penpos4(thick, 60);
  penpos5(thick, 60);
  penpos6(thick, 0);

  path p;
  p = z6{dir -82} .. {dir -67}z3;
  z7 = point 1/4 of p;
  x8 = 2/5[x0,x1];
  z7 = z8 + whatever * dir 60;

  penpos7(5/6thick, 150);
  penpos8(thick, 125);

  fill stroke z4.e -- z5.e{dir -30} .. {dir -82}z6.e .. {dir -67}z3.e;
  fill stroke z2.e -- z2'.e{right} ... {dir 60}z8.e -- z7.e;

  penlabels(0,1,2,2',3,4,5,6,7,8);
endchar;

beginsymbol(7u# + letter_line_thickness# + 2side_bearing#, cap_height#, 0); "daleth";
  thick := letter_line_thickness;

  x0 = side_bearing;
  x1 = w - side_bearing;
  y0r = y1r = h;
  x3r = x2r = 4/5[x0,x1];
  y2 = y0;
  y3 = 0;

  penpos0(thick, 90);
  penpos1(thick, 90);
  penpos2(thick, 0);
  penpos3(thick, 0);

  fill stroke z0.e -- z1.e;
  fill stroke z2.e -- z3.e;

  penlabels(0,1,2,3);
endchar;

begingroup;
save slant;
save currenttransform;
slant := 0.212557;
transform currenttransform;
currenttransform := identity slanted slant yscaled aspect_ratio scaled granularity shifted (-u,0);

beginsymbol(9u# + 2letter_line_thickness#, x_height#, desc_depth#); "Weierstrass p";
  numeric theta;
  theta = 90 - angle(8u,h);
  slope := -h/8u;  % angle at middle
  superness := 1/sqrt 2;
  superpull := 1/6;

  penpos2(letter_line_thickness, -60);
  penpos1(letter_line_thickness, theta);
  penpos7(letter_line_thickness, -90);

  x2 + 1/2u = x1 = x7 - 1/2u = 3u;
  y2l = h;
  y7r = -d;
  y1 = 2/5[-d, h];
  x3l = 1/2u;
  x6r = max(x7 + letter_line_thickness, 1/2w - 1/4u);
  x3r - x3l = x6r - x6l =letter_line_thickness;

  ellipse_set(2l,3l,4l,1l);
  ellipse_set(2r,3r,4r,1r);
  ellipse_set(7l,6l,5l,1l);
  ellipse_set(7r,6r,5r,1r);

  y3 = y3r;
  y6 = y6r;

  fill stroke super_arc.e(2,3) & z3e{down} .. z4e .. z5e .. z6e{down} & super_arc.e(6,7);  % flourish

  penpos8(letter_line_thickness, 180);
  penpos9(letter_line_thickness, 90);
  penpos10(letter_line_thickness, 0);
  penpos11(letter_line_thickness, -90);
  penpos12(letter_line_thickness, -100);

  x10r = w - 3/2u + 1/2letter_line_thickness;
  x8r = u;
  x9 = x11 = 1/2w + 3/2u;
  x12l = max(x6r, .5w + .5u);
  y8 = y11r = 0;
  y9r = 19/20h;
  y10 = 1/2[y9,y11];
  y12r = 1/4[y11r,y1l];

  fill stroke z7e{left} ... z8e{up} ... z9e .. z10e .. z11e .. z12.e;  % stem and bowl

  penlabels(1,2,3,4,5,6,7,8,9,10,11,12);
endchar;
endgroup;

beginsymbol(8u# + letter_line_thickness# + 2side_bearing#, cap_height#, 0); "nabla";
  thick:=letter_line_thickness;
  thin := 4/5thick;
  thicker := thick;

  y0r = y1r = h;
  y2  = 0;

  x0r = side_bearing;
  x1r = w - side_bearing;
  x2  = w/2;

  penpos0(thin, 90);
  penpos1(thin,90);
  penpos2(thicker,0);

  y3 = y4 = h-thick;
  z3 = z2r + whatever*(z0l-z2l);
  z4 = z2l + whatever*(z1l-z2r);

  z5 = whatever[z3,z2r] = whatever[z4,z2l];

  fill z0r -- z0l -- z2l -- z2r -- z1l -- z1r -- cycle;
  unfill z3 -- z4 -- z5 -- cycle;

  penlabels(0,1,2,3,4,5);
endchar;

for sign = 1, -1:
  beginoperator(plus_size#, 1); "product integral";
    draw_productintegral(centre, plus_size, plus_size, sign, letter_line_thickness);
  endchar;
endfor;
