Blob
1 %2 % Stuff used to draw or set text along a baseline specified by parametric equations3 % for x and y.4 %6 /left -1 def7 /center 0 def8 /right 1 def10 /baselinedict 50 dict def12 /newbaseline {13 baselinedict begin14 /g' exch bind def15 /f' exch bind def16 /g exch bind def17 /f exch bind def19 counttomark 2 eq {/hoffset exch def} if20 /res exch def22 /t 0 def23 /s 0 def24 /voffset false def25 cleartomark26 end27 } bind def29 /drawfunnytext {30 baselinedict begin31 /t exch def32 /mode exch def33 /str exch def35 mode left eq {36 /leftstring emptystring def37 /rightstring str def38 } if40 mode right eq {41 /leftstring str reversestring def42 /rightstring emptystring def43 } if45 mode center eq {46 str splitstring47 /rightstring exch def48 /leftstring exch reversestring def49 } if51 gsave currentpoint translate leftstring left t baselineshow grestore52 gsave currentpoint translate rightstring right t baselineshow grestore54 /t 0 def55 /s 0 def56 /voffset false def57 cleartomark58 end59 } bind def61 /setfunnytext {62 baselinedict begin63 /vpos exch def64 /hpos exch def65 /str exch def67 voffset vpos ne {68 /voffset vpos def69 /t 0 def70 /s hoffset def71 } if73 gsave74 hoffset voffset translate75 0 0 moveto76 /ds hpos s sub def77 /dt ds t f' dup mul t g' dup mul add sqrt res mul div def78 /s s ds add def79 /t t dt add def80 str right t baselineshow81 grestore82 end83 } bind def85 baselinedict begin87 /f {} bind def88 /g {pop 0} bind def89 /f' {pop 1} bind def90 /g' {pop 0} bind def92 /s 0 def93 /t 0 def94 /res 72 def96 /onecharstring ( ) def97 /emptystring () def99 /baselineshow {100 /t exch def101 /mode exch def102 /str exch def104 gsave105 t f res mul t g res mul translate106 0 0 moveto107 t g' t f' atan rotate108 {109 mode right eq {pop} if110 grestore gsave111 onecharstring 0 3 -1 roll put onecharstring stringwidth pop112 /ds exch mode mul def113 /dt ds t f' dup mul t g' dup mul add sqrt res mul div def114 /t t dt add def115 /s s ds add def116 t f res mul t g res mul translate117 0 0 moveto118 t g' t f' atan rotate119 mode left eq {pop} if120 } str kshow121 grestore122 } bind def124 /reversestring {125 /str1 exch def127 /str2 str1 length string def128 /i 0 def129 /n str1 length 1 sub def131 {132 str1 n get str2 exch i exch put133 /i i 1 add def134 /n n 1 sub def135 n 0 lt {exit} if136 } loop137 str2138 } bind def140 /splitstring {141 /str1 exch def143 /len str1 stringwidth pop def144 /s 0 def145 /n 0 def146 str1 length {147 str1 n get onecharstring exch 0 exch put148 /s onecharstring stringwidth pop s add def149 s len 2 div ge {exit} if150 /n n 1 add def151 } repeat152 str1 0 n 1 add getinterval153 str1 n str1 length n sub getinterval154 } bind def156 end