%% Circular Text
%%                PostScript Language Tutorial and Cookbook

/outsidecircletext {
  circletextdict begin
    /radius exch def
    /centerangle exch def
    /ptsize exch def
    /str exch def
    /xradius radius ptsize 4 div add def

    gsave
      centerangle str findhalfangle add rotate

      str {
        /charcode exch def
        ( ) dup 0 charcode put outsideplacechar
        } forall
      grestore
    end
  } def

/insidecircletext {
  circletextdict begin
    /radius exch def
    /centerangle exch def
    /ptsize exch def
    /str exch def
    /xradius radius ptsize 3 div add def

    gsave
      centerangle str findhalfangle sub rotate

      str {
        /charcode exch def
        ( ) dup 0 charcode put insideplacechar
        } forall
      grestore
    end
  } def

/circletextdict 16 dict def
circletextdict begin
  /findhalfangle {
    stringwidth pop 2 div
    2 xradius mul pi mul div 360 mul } def
  /outsideplacechar {
    /char exch def
    /halfangle char findhalfangle def
    gsave
      halfangle neg rotate
      radius 0 translate
      -90 rotate
      char stringwidth pop 2 div neg 0 moveto
      char show
      grestore
    halfangle 2 mul neg rotate
    } def
  /insideplacechar {
    /char exch def
    /halfangle char findhalfangle def
    gsave
      halfangle rotate
      radius 0 translate
      90 rotate
      char stringwidth pop 2 div neg 0 moveto
      char show
      grestore
    halfangle 2 mul rotate
    } def
  /pi 3.1415926535 def
  end

/Times-Bold findfont 22 scalefont setfont
306 448 translate
(Symphony No. 9 (The Choral Symphony)) 22 90 140 outsidecircletext

/Times-Roman findfont 15 scalefont setfont
(Ludwig von Beethoven) 15 90 118 outsidecircletext
(The New York Philharmonic Orchestra) 15 270 118 insidecircletext
showpage

