%! /copypage {} def % Modified to make GNU Button -len Wed Jan 20 20:49:39 1988 % Cookbook Example Program from First Printing, Revised 7 Jan 1985 % Program: Circular Text Number: 16 %----------------------------------------------------------------------------- % /outsidecircletext % outsidecircletext places text { $circtextdict begin % around a circular arc. The /radius exch def % baseline of the text is placed /centerangle exch def % on the outside of the /ptsize exch def % circumference of the circle in a /str exch def % clockwise fashion. % outsidecircletext takes four % arguments: the string to be % printed, the point size of the % font being used, the angle % around which the text should be % centered and the radius of the % circular arc. It assumes that % the center of the circle is at % (0,0). /xradius radius ptsize 4 div add % A radius that is slightly larger def % than the one specified is used % for computations but not for % placement of characters. Using a % slightly larger radius in the % computations places the % characters closer together, % otherwise the interletter % spacing is too loose. gsave % Save the current graphics state. centerangle str findhalfangle % Find out how much angle the add rotate % string subtends and then rotate % to the appropriate starting % position for showing the string. % (The positive x-axis now % intersects the circle where the % text should start.) str { /charcode exch def % For each character in the ( ) dup 0 charcode put % string, determine its position outsideshowcharandrotate % on the circular arc and show it. } forall grestore % Return to the former graphics % state. end } def /insidecircletext % insidecircletext works very { $circtextdict begin % similarly to outsidecircletext /radius exch def % except that the baseline of the /centerangle exch def % text is placed on the inside of /ptsize exch def % the circumference of the circle /str exch def % in a counter-clockwise fashion. % insidecircletext takes the same % four arguments as % outsidecircletext. /xradius radius ptsize 3 div sub % Here we use a radius which is def % slightly smaller than the % desired radius for computations. % This forces the characters to be % placed farther apart to avoid % overlapping. gsave centerangle str findhalfangle sub rotate str { /charcode exch def ( ) dup 0 charcode put insideshowcharandrotate } forall grestore end } def /$circtextdict 16 dict def $circtextdict begin /findhalfangle % findhalfangle takes one { stringwidth pop 2 div % argument, a string, and finds 2 xradius mul pi mul div 360 mul % the angle subtended by that } def % string. It leaves the value of % half of that angle on the stack. % The angle is found by computing % the ratio of the width of the % string to the circumference of % the circle and then converting % that value to degrees. /outsideshowcharandrotate % This procedure shows a character { /char exch def % upright on the outside of the /halfangle char findhalfangle def % circumference and then rotates gsave % clockwise by the amount of angle % subtended by the width of the % character. halfangle neg rotate % Rotate clockwise by half the radius 0 translate % angle taken up by the width of % the character and translate out % to the circumference. -90 rotate % Position character upright on % outside of circumference. char stringwidth pop 2 div neg % Center the character around the % origin. 0 moveto char show grestore halfangle 2 mul neg rotate % Rotate clockwise by the amount } def % of angle subtended by the width % of the character. /insideshowcharandrotate % insideshowcharandrotate operates { /char exch def % in a similar manner to /halfangle char findhalfangle def % outsideshowcharandrotate except gsave % that the direction of rotation halfangle rotate % is counter-clockwise and the radius 0 translate % characters are placed upright on 90 rotate % the inside of the circle. char stringwidth pop 2 div neg 0 moveto char show grestore halfangle 2 mul rotate } def /pi 3.1415923 def end 306 448 translate 2 2 scale gsave /gnustar (GNU) def /gnustpt 52 def %/Zapf-Dingbats findfont gnustpt scalefont setfont /Times-Bold findfont gnustpt scalefont setfont %center gnustar stringwidth pop 2 div neg gnustpt 3 div neg moveto gnustar show grestore %/Zapf-DingBats findfont 10 scalefont setfont /Times-Bold findfont 10 scalefont setfont (GNU's Not Unix) 10 270 64 insidecircletext %/Zapf-Dingbats findfont 7.5 scalefont setfont /Times-Bold findfont 7.5 scalefont setfont (Copyright 1988 Free Software Foundation) 7.5 270 75 insidecircletext (This button design may be freely redistributed under the terms of the GNU General Public License.) 7.5 90 69 outsidecircletext 2 {copypage} repeat % for a 2 1/4 button