%% BEGIN pst-text.tex
%%
%% Placing text on a path with PSTricks 97.
%% See the PSTricks User's Guide for description.
%% This uses the header file `pst-text.pro'.
%%
%%
%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu.
%%	     2006 Herbert Voss <hvoss@tug.org>
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt.
%%
%
\csname PSTextPathLoaded\endcsname
\let\PSTextPathLoaded\endinput
\ifx\PSTricksLoaded\endinput\else\input pstricks \fi
%\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey  \fi
%
\def\fileversion{1.00}
\def\filedate{2006/11/05}
\message{ v\fileversion, \filedate (tvz,hv)}

\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11

%\pst@addfams{pst-text}
\pstheader{pst-text.pro}
%
\def\pstextpath{\@ifnextchar[{\pstextpath@}{\pstextpath@[l]}}
\def\pstextpath@[#1]{%
  \@ifnextchar({\pstextpath@@[#1]}{\pstextpath@@[#1](0,\TPoffset)}}
\def\pstextpath@@[#1](#2)#3{\pst@makebox{\pstextpath@@@[#1](#2){#3}}}
\def\pstextpath@@@[#1](#2,#3)#4{%
  \pst@killglue
  \begingroup
    \ifx c#1\relax
      \def\pst@tempa{.5}%
    \else
      \ifx r#1\relax
        \def\pst@tempa{1}%
      \else
        \def\pst@tempa{0}%
      \fi
    \fi
    \def\use@pscode{%
      \pst@Verb{%
        /mtrxc CM def
        \tx@STV
        CP translate
        newpath
        \pst@code\space
        mtrxc setmatrix
        0 setgray}%
      \gdef\pst@code{}}%
    \def\psclip#1{\pst@misplaced\psclip}%
    \let\endpsclip\relax
    \def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}%
    \def\nc@object##1##2##3##4{\pst@misplaced{node connection}}%
    \def\PSTtoEPS@i##1##2{\pst@misplaced\PSTtoEPS}%
    \pssetlength\pst@dima{#2}%
    \pssetlength\pst@dimb{#3}%
    \setbox\pst@hbox\hbox{%
      \hbox to\z@{%
        \kern -\wd\pst@hbox
        % BoxWidth = CurrX - Hoffset.
        \pstVerb{tx@TextPathDict begin
          currentpoint pop /Hoffset exch def end}%
        \kern\pst@dima
        % XOffset = Voffset - Hoffset (extra horizontal skip)
        \pstVerb{tx@TextPathDict begin
          currentpoint pop /Voffset exch def end}%
        \hss
        \pstVerb{%
          /tx@TextPathSavedShow /show load def
          \pst@dict \tx@PathLength end
          dup 0 gt
          { tx@TextPathDict begin \pst@tempa\space InitTextPath end
            /show { tx@TextPathDict begin TextPathShow end } def
          }
          { pop }
          ifelse}}%
      \raise\pst@dimb\box\pst@hbox
      \pstVerb{%
        currentpoint newpath moveto
        /show /tx@TextPathSavedShow load def}}%
    \wd\pst@hbox=\z@ \dp\pst@hbox=\z@ \ht\pst@hbox=\z@
    \leavevmode
    \hbox{{#4}\box\pst@hbox}%
  \endgroup\ignorespaces}
\def\TPoffset{-.7ex}
%
\def\tx@CharPathShow{%
  /tx@CharPathSavedShow /show load def
  /show {
    % These 3 lines check whether charpath yields anything interesting.
    dup gsave newpath 0 0 moveto
    true charpath pathbbox grestore
    3 -1 roll eq 3 1 roll eq and
    % If not, just use show.
    { tx@CharPathSavedShow }
    % Otherwise, use charpath.
    { true charpath }
    ifelse }
  def }
%
\def\pscharpath{\def\pst@par{}\pst@object{pscharpath}}
\def\pscharpath@i{\pst@makebox\pscharpath@ii}
\def\pscharpath@ii{%
  \leavevmode\hbox{%
    \pstVerb{\tx@CharPathShow}%
    \box\pst@hbox
    \pstVerb{/show /tx@CharPathSavedShow load def}%
% DG/SR modification begin - Nov. 26, 1998 - Patch 2
% \if@star is true but \solid@star must not be executed in \begin@ClosedObj !
%    \begin@ClosedObj
    \let\solid@starOLD\solid@star
    \let\solid@star\relax
    \begin@ClosedObj
    \let\solid@star\solid@starOLD
% DG/SR modification end
      \def\pst@linetype{1}%
      \psdashadjustfalse
      \showpointsfalse
      \let\pst@newpath\@empty
      \def\use@pscode{%
        \pst@Verb{%
          gsave
            \tx@STV
            \pst@code
          grestore
% DG/SR modification begin - Jul.  3, 1998 / Mar. 11, 1999 - Patches 1 and 3
%          \if@star\else CP newpath moveto \fi}}%
          \if@star\else CP newpath moveto \fi}%
        \gdef\pst@code{}}%
% DG/SR modification end
    \end@ClosedObj}}
%
\def\pscharclip{\def\pst@par{}\pst@object{pscharclip}}
\def\pscharclip@i{\pst@makebox\pscharclip@ii}
\def\pscharclip@ii{%
  \leavevmode
  \begingroup
    \begin@psclip
    {\@startrue\pscharpath@ii}%
    \pstVerb{clip \if@star\else currentpoint newpath moveto\fi}%
    \def\endpscharclip{\end@psclip\endgroup}%
    \ignorespaces}
\def\endpscharclip{\pst@misplaced\endpscharclip}
%
\catcode`\@=\TheAtCode\relax

\endinput
%%
%% END pst-text.tex
