| 1 |
% greenpoint.mf - "The Green Point" in METAFONT |
| 2 |
% Copyright (C) 2001, 2003 Markus Triska |
| 3 |
% |
| 4 |
% This program is free software; you can redistribute it and/or modify |
| 5 |
% it under the terms of the GNU General Public License as published by |
| 6 |
% the Free Software Foundation; either version 2 of the License, or |
| 7 |
% (at your option) any later version. |
| 8 |
% |
| 9 |
% This program is distributed in the hope that it will be useful, |
| 10 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
% GNU General Public License for more details. |
| 13 |
% |
| 14 |
% You should have received a copy of the GNU General Public License |
| 15 |
% along with this program; if not, write to the Free Software |
| 16 |
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA |
| 17 |
% |
| 18 |
% Contact me at [email protected] |
| 19 |
% |
| 20 |
|
| 21 |
font_identifier := "GPOINT"; font_size 10pt#; |
| 22 |
|
| 23 |
mode_setup; |
| 24 |
|
| 25 |
% The breadth of the tip of the arrow on either side of the stem |
| 26 |
side_breadth#:=.9pt#; |
| 27 |
% The distance from the uppermost point of the stem to the boarder |
| 28 |
boarder_dist#:=1.4pt#; |
| 29 |
% The length of the tip of the arrow |
| 30 |
tip_length#:=2.3pt#; |
| 31 |
% The significance of the curvature of the tip of the arrow |
| 32 |
curve_factor:=2.3; |
| 33 |
|
| 34 |
define_whole_vertical_pixels(boarder_dist, side_breadth); |
| 35 |
define_whole_pixels(tip_length); |
| 36 |
|
| 37 |
beginchar("G", 8pt#, 8pt#, 0); |
| 38 |
"The Green Point, version 1.0"; |
| 39 |
pickup pencircle scaled .2pt; |
| 40 |
% The surrounding circle |
| 41 |
top z1' = (.5w, h); rt z2' = (w, .5h); bot z3' = (.5w, 0); lft z4' = (0, .5h); |
| 42 |
path p; p = z1'{right}..{down}z2'..{left}z3'..{up}z4'..cycle; |
| 43 |
draw p; |
| 44 |
|
| 45 |
path arc; |
| 46 |
archeight = h - boarder_dist; |
| 47 |
z4 = (.07w, .5archeight); |
| 48 |
arc = (.5w, 0){left}..{up}z4..{right}(.5w, archeight); |
| 49 |
fill arc--cycle; |
| 50 |
|
| 51 |
% The tip of the arrow |
| 52 |
z1 = (.5w, archeight + side_breadth); |
| 53 |
z2 = (.5w + tip_length, .5[y1, y3]); |
| 54 |
z3 = (.5w, .5h - .5side_breadth); |
| 55 |
path tip; |
| 56 |
tip = z1{(curve_factor*(x2-x1), y2-y1)}..{(x2-x1, curve_factor*(y2-y1))}z2; |
| 57 |
tip := tip & z2{(x3-x2, curve_factor*(y3-y2))}..{(curve_factor*(x3-x2), y3-y2)}z3--cycle; |
| 58 |
fill tip; |
| 59 |
labels(1, 2, 3, 4); |
| 60 |
tip := tip rotatedaround ((.5w, .5h), 180); |
| 61 |
unfill tip; |
| 62 |
arc := arc rotatedaround((.5w, .5h), 180); |
| 63 |
fill arc--(.5w, 0){right}..{up}(w, .5h)..{left}(.5w, h)..cycle; |
| 64 |
endchar; |
| 65 |
end. |