* Richard A. DeVenezia 11/24/2002; * Phases of the moon as a SAS/Graph font; * http://www.devenezia.com; %let WORKPATH = %sysfunc(pathname(WORK)); libname GFONT0 "&WORKPATH."; data fontdata (keep=char seg x y lp ptype); length char $1 seg x y 8 lp ptype $1; pi = constant ('PI'); ptype = 'V'; seg = 1; char = byte(rank('A')-1); nChar = 16; nTheta = 60; step = 1/nChar; do phase = 0 to 1-step+0.0001 by step; char = byte (rank(char)+1); lp = 'L'; do i = 0 to nTheta; theta = round (i * 2 * pi / nTheta, 1e-6); x = cos (theta); y = sin (theta); output; end; if phase = 0 then continue; seg + 1; x=.; y=.; output; lp = 'P'; if phase <= 0.5 then do; factor = 1-phase*4; i0= -nTheta/4; i1=nTheta/4; iStep=+1; end; else do; factor = 1-(phase-0.5)*4; i0=3*nTheta/4; i1=nTheta/4; iStep=-1; end; seg + 1; x=.; y=.; output; do i = i0 to i1 by iStep; theta = round (i * 2 * pi / nTheta, 1e-6); x = cos (theta); y = sin (theta); output; end; do y = 1 to -1 by -.1; y = round (y, .1); x = factor * sqrt (1 - y**2); output; end; seg + 1; x=.; y=.; output; end; stop; run; goptions reset=all target=png hsize=3in vsize=0.6in goutmode=replace; ods listing close; ods html file="&WORKPATH.\moonfont.html" gpath="&WORKPATH."; proc gfont nodisplay name=MoonPhas data=fontdata filled resolution=2; run; data anno; length h 8; vsize = scan (getoption ('vsize'),1,' '); retain xsys ysys '1' hsys '3' x 50; length style $40; * size(pct) = hsize(in)/vsize(in)*100; size = .10/vsize*100; y = 88; style = "MoonPhas"; text = 'A B C D E F G H I J K L M N O P'; output; size = .20/vsize*100; y = 75; style = '"SAS Monospace"'; output; size = .10/vsize*100; y = 35; style = "MoonPhas"; text = 'P O N M L K J I H G F E D C B A'; output; size = .20/vsize*100; y = 15; style = '"SAS Monospace"'; output; run; proc gslide anno=anno name="phases"; run; quit; ods html close;