%   greenpoint.mf - "The Green Point" in METAFONT
%   Copyright (C) 2001, 2003 Markus Triska
%
%   This program is free software; you can redistribute it and/or modify
%   it under the terms of the GNU General Public License as published by
%   the Free Software Foundation; either version 2 of the License, or
%   (at your option) any later version.
%
%   This program is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%   GNU General Public License for more details.
%
%   You should have received a copy of the GNU General Public License
%   along with this program; if not, write to the Free Software
%   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
%
%   Contact me at triska@gmx.at
%

font_identifier := "GPOINT"; font_size 10pt#;

mode_setup;

% The breadth of the tip of the arrow on either side of the stem
side_breadth#:=.9pt#;
% The distance from the uppermost point of the stem to the boarder
boarder_dist#:=1.4pt#;
% The length of the tip of the arrow
tip_length#:=2.3pt#;
% The significance of the curvature of the tip of the arrow
curve_factor:=2.3;

define_whole_vertical_pixels(boarder_dist, side_breadth);
define_whole_pixels(tip_length);

beginchar("G", 8pt#, 8pt#, 0);
"The Green Point, version 1.0";
pickup pencircle scaled .2pt;
% The surrounding circle
top z1' = (.5w, h); rt z2' = (w, .5h); bot z3' = (.5w, 0); lft z4' = (0, .5h);
path p; p = z1'{right}..{down}z2'..{left}z3'..{up}z4'..cycle;
draw p;

path arc;
archeight = h - boarder_dist;
z4 = (.07w, .5archeight);
arc = (.5w, 0){left}..{up}z4..{right}(.5w, archeight);
fill arc--cycle;

% The tip of the arrow
z1 = (.5w, archeight + side_breadth);
z2 = (.5w + tip_length, .5[y1, y3]);
z3 = (.5w, .5h - .5side_breadth);
path tip;
tip = z1{(curve_factor*(x2-x1), y2-y1)}..{(x2-x1, curve_factor*(y2-y1))}z2;
tip := tip & z2{(x3-x2, curve_factor*(y3-y2))}..{(curve_factor*(x3-x2), y3-y2)}z3--cycle;
fill tip;
labels(1, 2, 3, 4);
tip := tip rotatedaround ((.5w, .5h), 180);
unfill tip;
arc := arc rotatedaround((.5w, .5h), 180);
fill arc--(.5w, 0){right}..{up}(w, .5h)..{left}(.5w, h)..cycle;
endchar;
end.
