% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def,v 1.16 2008/02/07 19:25:41 tantau Exp $
\RequirePackage{xcolor}
% Driver commands for tex4ht
%
% Load common pdf commands:
%
\input pgfsys-common-svg.def
%
% tex4ht-specific stuff:
%
\def\pgfsys@invoke#1{\pgf@sys@fail{svg code in preamble}}
\def\pgfsys@body@invoke#1{\HCode{#1}}
\newcount\pgf@sys@svg@picnum
\def\pgfsys@beginpicture{%
\Configure{[]}{$}{$}
\Configure{()}{$}{$}
\Configure{$$}{}{}{}%$$
\Configure{$}{}{}{}%$
\Configure{SUB}{\HCode{}}{\HCode{}}
\Configure{SUP}{\HCode{}}{\HCode{}}
\Configure{SUBSUP}{}{}{}
\Configure{htf}
{0}{+}{}{}
}
\def\pgfsys@endpicture{%
% undo:
\Configure{htf}{0}{+}{}{}
}
\def\pgfsys@typesetpicturebox#1{%
\global\advance\pgf@sys@svg@picnum by 1\relax%
% Ok, compute width/height
\pgf@xa=\pgf@picminx%
\pgf@ya=\pgf@picminy%
\pgf@xb=\pgf@picmaxx%
\pgf@yb=\pgf@picmaxy%
\pgf@x=\pgf@xb%
\advance\pgf@x by-\pgf@xa%
\pgf@y=\pgf@yb%
\advance\pgf@y by-\pgf@ya%
\ifdim\pgf@y<1pt%
\pgf@y=1pt%
\fi%
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
\pgfsysprotocol@flushcurrentprotocol%
\HCode{}%
\special{t4ht>\jobname-\the\pgf@sys@svg@picnum.svg}%
\pgfsys@invoke{\Hnewline }%
\special{t4ht<\jobname-\the\pgf@sys@svg@picnum.svg}%
}
\def\pgfsys@hbox#1{%
\pgf@x=.5\wd#1%
\ifx\tikz@textcolor\relax%
\else%
\ifx\tikz@textcolor\pgfutil@empty%
\pgfsetfillcolor{.}%
\else%
\pgfsetfillcolor{\tikz@textcolor}%
\fi%
\fi% tweak for TikZ
\HCode{\Hnewline }%
\wd#1=0pt%
\ht#1=0pt%
\dp#1=0pt%
\box#1
\HCode{\Hnewline }%
}
\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\pgfutil@gobble\fi}
\def\pgfsys@shadingoutsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}}
\def\pgfsys@shadinginsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}}
\def\pgfsys@body@shadingoutsidepgfpicture#1{%
\begingroup%
#1%
\setbox\pgfpic=\hbox to0pt{%
\pgfsys@beginpicture%
\pgfsys@beginscope%
\pgf@sys@svg@sh@defs%
\pgf@sys@svg@sh%
\pgfsys@endscope%
\pgfsys@endpicture%
\hss%
}%
\pgf@process{\pgf@sys@svg@pos}%
\pgf@picminx=0pt%
\pgf@picminy=0pt%
\pgf@picmaxx=\pgf@x%
\pgf@picmaxy=\pgf@y%
\def\pgf@shift@baseline{0pt}%
\pgfsys@typesetpicturebox\pgfpic%
\endgroup%
}
\def\pgfsys@body@shadinginsidepgfpicture#1{%
#1%
\pgf@sys@svg@sh@defs% hmmm....
\pgf@process{\pgf@sys@svg@pos}
\pgf@xa=-.5\pgf@x%
\pgf@ya=-.5\pgf@y%
\pgfsysprotocol@literal{\Hnewline}%
\pgf@sys@svg@sh%
\pgfsysprotocol@literal{\Hnewline}%
}
% Protect against color.4ht evil meddling with xcolor:
\let\pgf@xcolor@declaredcolor=\@declaredcolor
\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor
\AtBeginDocument{
\let\pgfsys@invoke=\pgfsys@body@invoke
\let\pgfsys@shadingoutsidepgfpicture=\pgfsys@body@shadingoutsidepgfpicture
\let\pgfsys@shadinginsidepgfpicture=\pgfsys@body@shadinginsidepgfpicture
\let\pgf@texht@declaredcolor=\@declaredcolor
\let\pgf@texht@undeclaredcolor=\@undeclaredcolor
\def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi}
\def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi}
\ConfigureEnv{pgfpicture}{}{}{}{}
}
\endinput
%%% Local Variables:
%%% mode: latex
%%% End: