% $Id: xycirc10.mf,v 3.13 2011/03/14 20:14:00 krisrose Exp $
%
% XYCIRC10: 1/8 circles with varying radii for Xy-pic at 10 point.
% Copyright (c) 1992,2011  Kristoffer H. Rose  <krisrose@tug.org>
%                    2011  Daniel Müllner <http://www.math.uni-bonn.de/people/muellner>
%
% This file is part of the Xy-pic macro package.
%
% The Xy-pic macro package 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.
%
% The Xy-pic macro package 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 macro package; if not, see http://www.gnu.org/licenses/.
%
% As a special exception, you may use this file and all files derived
% from it without restriction.  This special exception was added with
% version 3.7 of Xy-pic.
% _________________________________________________________________________
%
% CONTENTS: 1/8 circles with radii from 1 to 32pt dissected into the 1/8
% circle segments shown below
%				    6     5
%                                   .......	    _
%                              7  ..   |   ..  4    |
%                                : |   |   | :	    | radius
%                               :  |   |   |  :	    |
%       Reference point ---> ___:__|___|___|__:_____|
%                               :  |   |   |  :
%                                : |   |   | :
%                              0  .!   |   !.  3
%                                   ...|...
%				    1     2
%
% such that each group of 8 characters cc+0 to cc+7 constitute a full circle
% with the given radius when typeset on the same baseline (as shown).
%
% The bounding box of each segment is the vertical slice of the unit square
% around the circle.
%
% The radius is given for each character group g = cc mod 8 by the formula
%
%  radius [pt] = g+1,		if  0 <= g < 8
%	       	 2(g-8) + 10,	if  8 <= g < 12		[= 2g-6]
%	    	 4(g-12) + 20,	if 12 <= g < 16		[= 4g-28]
% _________________________________________________________________________
%
font_identifier "XYCIRC"; font_size 10pt#;
mode_setup;

% METANESS...
%
rulew# = .4pt#; define_whole_blacker_pixels(rulew); % line thickness

% TESTING...we redefine openit because the characters extend far to the
% left of the bounding box!
%
def openit = %let echar = endchar; def endchar = echar; stop ". " enddef;
 openwindow currentwindow from origin to (1000,800) at (-200,300)
enddef;

% FONT.
%
% Font dimension 8 is the rule thickness (cf. The TeXbook, app.G)
%
font_coding_scheme:="xycirc.enc";
fontdimen 8:	rulew#;			% default_rule_thickness

% (It's unnecessary to give the exact control points. MetaFont
% automatically chooses a good approximation to a circular arc.)
path eighthcircle;
eighthcircle = right{up} .. {left+up}(right+up)/sqrt2;

% Use the following macro that generates an entire group from character cc
% to cc+7 with radius:
%
def makeg(expr g,radius) =

 major# := radius/sqrt2;
 minor# := radius - major#;
 full#  := radius;
 define_pixels(minor,major,full);

 path arc;
 arc = eighthcircle scaled (full + rulew/2) 
    & halfcircle scaled rulew shifted (full*right) rotated 45 
    & reverse eighthcircle scaled (full - rulew/2)
    & halfcircle scaled rulew rotated 180 shifted (full*right)
    & cycle;

 beginchar(8g  ,minor#,full#,full#);
  fill arc rotated 180 shifted (full*right);
  endchar;

 beginchar(8g+1,major#,full#,full#);
  fill arc rotated 225 shifted (major*right);
  endchar;

 beginchar(8g+2,major#,full#,full#);
  fill arc rotated 270;
  endchar;

 beginchar(8g+3,minor#,full#,full#);
  fill arc rotated 315 shifted (major*left);
  endchar;

 beginchar(8g+4,minor#,full#,full#);
  fill arc shifted (major*left);
  endchar;

 beginchar(8g+5,major#,full#,full#);
  fill arc rotated 45;
  endchar;

 beginchar(8g+6,major#,full#,full#);
  fill arc rotated 90 shifted (major*right);
  endchar;

 beginchar(8g+7,minor#,full#,full#);
  fill arc rotated 135 shifted (full*right);
  endchar;

enddef;

% Make groups:
%
for g =  0 step 1 until  7: makeg(g,  (g+1)*pt#); endfor;
for g =  8 step 1 until 11: makeg(g, (2g-6)*pt#); endfor;
for g = 12 step 1 until 15: makeg(g,(4g-28)*pt#); endfor;

bye.

% $Log: xycirc10.mf,v $
% Revision 3.13  2011/03/14 20:14:00  krisrose
% Preparing for release 3.8.6.
%
% Revision 3.12  2010/07/07 16:26:39  krisrose
% Rules should be whole pixels (thanks again to Daniel).
%
% Revision 3.11  2010/07/06 21:49:55  krisrose
% Daniel's fix that works around bug in mf2pt1/fontforge script.
%
% Revision 3.10  2010/06/10 18:45:50  krisrose
% Reference to GPL by URL.
%
% Revision 3.9  2010/05/17 23:29:21  krisrose
% Experiment: generate all the Type1 fonts with METAPOST.
%
% Revision 3.8  2010/04/16 06:06:52  krisrose
% Preparing for a new release...
%
% Revision 3.7  1999/02/16 15:12:50  krisrose
% Interim release (Y&Y fonts now free).
%
% Revision 3.3  1996/12/19 03:31:56  krisrose
% Maintenance release
%
% Revision 3.0  1995/07/07 20:14:21  kris
% Major release w/new User's Guide!
%
% Revision 2.13  1995/07/04  15:11:17  kris
% Ready to release v3?
%
% Revision 2.7  1994/03/08  02:09:27  kris
% Release 3alpha.
%
% Revision 2.6.9.1  1994/03/07  04:22:46  kris
% Last internal 3alpha and pre-2.7 release.
%
% NEW file to go in version 2.7!
% Based on xymisc10.mf [Revision 2.6  1992/06/24  01:23:34  kris]
