| 1 |
% Copyright 2019 by Till Tantau |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Public License. |
| 7 |
% |
| 8 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 9 |
|
| 10 |
\ProvidesFileRCS{pgfsys-tex4ht.def} |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
% Driver commands for tex4ht |
| 15 |
|
| 16 |
% |
| 17 |
% Load common pdf commands: |
| 18 |
% |
| 19 |
\input pgfsys-common-svg.def |
| 20 |
|
| 21 |
% |
| 22 |
% tex4ht-specific stuff: |
| 23 |
% |
| 24 |
\def\pgfsys@invoke#1{\pgf@sys@fail{svg code in preamble}} |
| 25 |
\def\pgfsys@body@invoke#1{\HCode{#1}} |
| 26 |
|
| 27 |
\newcount\pgf@sys@svg@picnum |
| 28 |
|
| 29 |
\def\pgfsys@pictureboxsynced#1{% |
| 30 |
\pgfsys@beginscope\pgflowlevelsynccm\box#1\pgfsys@endscope% |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
%% |
| 35 |
%% initial support of Mathml and xhtml inside svg through the svg:foreignelement tag |
| 36 |
%% |
| 37 |
%% it'll allow us to have complicated text nodes in the tex4ht driver |
| 38 |
%% |
| 39 |
|
| 40 |
|
| 41 |
%Example (to improve the display, you have to use css) |
| 42 |
% |
| 43 |
%\tikzpicture[svg text only=false] |
| 44 |
%\draw (0,0) node[inner sep=0pt,draw] {tight} |
| 45 |
%(0cm,2em) node[inner sep=5pt,draw] {loose} |
| 46 |
%(0cm,4em) node[fill=red!20] {default}; |
| 47 |
%\draw (3,0) node[inner sep=0pt,draw] {TIGHT} |
| 48 |
%(3cm,2em) node[inner sep=5pt,draw] {LOOSE} |
| 49 |
%(3cm,4em) node[fill=red!20] {DEFAULT}; |
| 50 |
%\draw (6,0) node[inner sep=0pt,draw] {$tight$} |
| 51 |
%(6cm,2em) node[inner sep=5pt,draw] {$loose$} |
| 52 |
%(6cm,4em) node[fill=red!20] {$default$}; |
| 53 |
%\draw (9,0) node[inner sep=0pt,draw] {$TIGHT$} |
| 54 |
%(9cm,2em) node[inner sep=5pt,draw] {$LOOSE$} |
| 55 |
%(9cm,4em) node[fill=red!20] {$Default$}; |
| 56 |
%\endtikzpicture |
| 57 |
% |
| 58 |
% you can use the options "svg text css=filename", "svg text id=idname", "svg text class=classname" to customize the display through the use of css |
| 59 |
% |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
%\def\pgfsys@beginpicture{% |
| 68 |
% % \Configure{[]}{$}{$} these two lines aren't needed for tex4ht and moreother they produce errors with plain tex ! |
| 69 |
% % \Configure{()}{$}{$} |
| 70 |
% \Configure{$$}{}{}{}%$$ |
| 71 |
% \Configure{$}{}{}{}%$ |
| 72 |
% \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}} |
| 73 |
% \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}} |
| 74 |
% \Configure{SUBSUP}{}{}{} |
| 75 |
% \Configure{htf} |
| 76 |
% {0}{+}{<tspan font-family="} |
| 77 |
% {\%s}{" font-size="\%s}{}{} |
| 78 |
% {">}{</tspan>} |
| 79 |
%} |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
%\def\pgfsys@endpicture{% |
| 84 |
% % undo: |
| 85 |
% \Configure{htf}{0}{+}{<span\Hnewline |
| 86 |
% class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>} |
| 87 |
%} |
| 88 |
|
| 89 |
\def\pgfsys@svg@newline{^^J} |
| 90 |
|
| 91 |
% we don't want tex4ht putting <p> and </p> tags automatically in our svg code and causing invalid xhtml in our svg pictures |
| 92 |
\newif\ifpgfsys@CssIncluded@\pgfsys@CssIncluded@false |
| 93 |
\def\pgfsys@beginpicture{% |
| 94 |
\pgfsys@svg@boxmodefalse% |
| 95 |
\EndP\HtmlParOff% |
| 96 |
\pgfkeys{/pgf/tex4ht node/escape=false}% |
| 97 |
% text only nodes are the default. Advantage : pure svg pictures are |
| 98 |
% the default, nicer for text only nodes. |
| 99 |
% Disadvantages : this rendering methods produce more invalid or degraded svg pictures than with the foreignelement tag |
| 100 |
%% we use css to control the display of foreignelement rendered text nodes |
| 101 |
\ifpgfsys@CssIncluded@ |
| 102 |
\else |
| 103 |
\Css{ |
| 104 |
.foreignobject {% |
| 105 |
line-height:100\%; |
| 106 |
font-size:120\%; % this is the trick....a font of size 100% in |
| 107 |
% a box scaled down to half size makes it a |
| 108 |
% half size font. |
| 109 |
% you'll have to double the size of things |
| 110 |
% that you want to have a regular size in |
| 111 |
% this half-scaled box though |
| 112 |
font-family:STIXgeneral,Times,Symbol,cmr10,CMSY10,CMEX10;% |
| 113 |
% can't wait for the stix font...the cmr10, etc font are |
| 114 |
% available from the mozilla site, times and symbols should be |
| 115 |
% okey |
| 116 |
padding:0; |
| 117 |
margin:0; |
| 118 |
% background-color:\#12ff55; useful for debugging positioning |
| 119 |
text-align:center; % good for centered text nodes...will have to improve that later on...with more integration with pgf options for text nodes |
| 120 |
} |
| 121 |
}% |
| 122 |
\Css{% |
| 123 |
math {%, math[mode="inline"] { |
| 124 |
vertical-align:baseline; |
| 125 |
line-height:100\%; |
| 126 |
font-size:100\%; |
| 127 |
font-family:STIXGeneral,Times,Symbol, cmr10,cmsy10,cmex10,cmmi10; |
| 128 |
font-style: normal; |
| 129 |
margin:0; |
| 130 |
% background-color:\#99ff99; |
| 131 |
padding:0; |
| 132 |
}% |
| 133 |
}% |
| 134 |
\pgfsys@CssIncluded@true |
| 135 |
\fi |
| 136 |
}% |
| 137 |
|
| 138 |
\def\pgfsys@endpicture{% |
| 139 |
\HtmlParOn |
| 140 |
\par% FIXME : was '\Par' but that seems to be undefined!? |
| 141 |
}% |
| 142 |
|
| 143 |
% this is okay for both rendering methods for text nodes (mtext or foreignelement)... |
| 144 |
\def\pgfsys@typesetpicturebox#1{% |
| 145 |
\global\advance\pgf@sys@svg@picnum by 1\relax% |
| 146 |
% Ok, compute width/height |
| 147 |
\pgf@xa=\pgf@picminx% |
| 148 |
\pgf@ya=\pgf@picminy% |
| 149 |
\pgf@xb=\pgf@picmaxx% |
| 150 |
\pgf@yb=\pgf@picmaxy% |
| 151 |
\pgf@x=\pgf@xb% |
| 152 |
\advance\pgf@x by-\pgf@xa% |
| 153 |
\pgf@y=\pgf@yb% |
| 154 |
\advance\pgf@y by-\pgf@ya% |
| 155 |
\ifdim\pgf@y<1pt% |
| 156 |
\pgf@y=1pt% |
| 157 |
\fi% |
| 158 |
\pgf@xc=\pgf@x% |
| 159 |
\pgf@yc=\pgf@y% |
| 160 |
\pgfsysprotocol@flushcurrentprotocol% |
| 161 |
\HCode{<object data="\jobname-\the\pgf@sys@[email protected]" width="}% |
| 162 |
% Calculate pixel coordinates (this does not really make sense, but |
| 163 |
% we have to do it anyway). Assume 96dpi. |
| 164 |
\pgf@x=1.3333333\pgf@x% |
| 165 |
\pgf@y=1.3333333\pgf@y% |
| 166 |
% Add one pixel for security: |
| 167 |
\advance\pgf@x by1pt% |
| 168 |
\advance\pgf@y by1pt% |
| 169 |
\pgf@sys@pt\pgf@x% |
| 170 |
\pgfsysprotocol@flushcurrentprotocol% |
| 171 |
\pgfsys@invoke{" height="}% |
| 172 |
\pgf@sys@pt\pgf@y% |
| 173 |
\pgfsysprotocol@flushcurrentprotocol% |
| 174 |
\pgfsys@invoke{" type="image/svg+xml"><p>SVG-Viewer needed.</p></object>}% |
| 175 |
\special{t4ht>\jobname-\the\pgf@sys@[email protected]}% |
| 176 |
%%%%%%%% This is necessary to control the svg through css |
| 177 |
\pgfkeys{% |
| 178 |
/pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css |
| 179 |
}% |
| 180 |
\pgfsys@invoke{<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\Hnewline% added that |
| 181 |
<?xml-stylesheet href="\pgfsys@[email protected]" type="text/css"?>\Hnewline}% added that |
| 182 |
%%%%%%%%%%%%%%% maybe I should add an option to change the css, for the whole picture |
| 183 |
\pgfsys@invoke{<svg xmlns="http://www.w3.org/2000/svg" |
| 184 |
xmlns:xlink="http://www.w3.org/1999/xlink" width="\the\pgf@xc" |
| 185 |
height="\the\pgf@yc" viewBox="}% |
| 186 |
\pgf@sys@pt{\pgf@xa}\pgf@sys@pt{\pgf@ya}\pgf@sys@pt{\pgf@xc}\pgf@sys@pt{\pgf@yc}% |
| 187 |
\pgfsysprotocol@flushcurrentprotocol% |
| 188 |
\pgf@ya=-\pgf@ya% |
| 189 |
\pgfsys@invoke{">\Hnewline <g transform="translate(0,} |
| 190 |
\pgf@sys@pt\pgf@yb\pgfsysprotocol@flushcurrentprotocol% |
| 191 |
\pgfsys@invoke{) scale(1,-1) translate(0,}% |
| 192 |
\pgf@sys@pt\pgf@ya\pgfsysprotocol@flushcurrentprotocol% |
| 193 |
\pgfsys@invoke{)">\Hnewline }% |
| 194 |
% |
| 195 |
\pgf@ya=\pgf@shift@baseline\relax% |
| 196 |
\advance\pgf@ya by-\pgf@picminy\relax% |
| 197 |
% |
| 198 |
% |
| 199 |
\advance\pgf@picmaxy by-\pgf@picminy\relax% maxy is now the height |
| 200 |
\advance\pgf@picmaxx by-\pgf@picminx\relax% maxx is now the width |
| 201 |
\setbox#1=\hbox{\hskip-\pgf@picminx\lower\pgf@picminy\box#1}% |
| 202 |
\ht#1=\pgf@picmaxy% |
| 203 |
\wd#1=\pgf@picmaxx% |
| 204 |
\dp#1=0pt% |
| 205 |
\leavevmode |
| 206 |
\pgf@xa=\pgf@trimleft@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi |
| 207 |
\raise-\pgf@ya\box#1% |
| 208 |
\pgf@xa=\pgf@trimright@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi |
| 209 |
\pgfsys@invoke{</g>\Hnewline </svg>\Hnewline }% |
| 210 |
\special{t4ht<\jobname-\the\pgf@sys@[email protected]}% |
| 211 |
}% |
| 212 |
|
| 213 |
%% we'll use this hbox for the mtext rendering method (the "text only=true" option) |
| 214 |
\def\pgfsys@hbox#1{% |
| 215 |
\pgf@x=.5\wd#1% |
| 216 |
\ifx\tikz@textcolor\relax\else\ifx\tikz@textcolor\@undefined\else% |
| 217 |
\ifx\tikz@textcolor\pgfutil@empty% |
| 218 |
\pgfsetfillcolor{.}% |
| 219 |
\else% |
| 220 |
\pgfsetfillcolor{\tikz@textcolor}% |
| 221 |
\fi% |
| 222 |
\fi\fi% tweak for TikZ |
| 223 |
\HCode{<text |
| 224 |
style="stroke:none" |
| 225 |
transform="scale(1,-1) translate(\pgf@sys@tonumber{\pgf@x},0)" |
| 226 |
text-anchor="middle" |
| 227 |
}% |
| 228 |
\ifpgfutil@format@is@latex% |
| 229 |
\ifx\f@size\pgfutil@empty% |
| 230 |
\else% |
| 231 |
\HCode{ font-size="\f@size"}% |
| 232 |
\fi% |
| 233 |
\fi% |
| 234 |
\HCode{>\Hnewline }% |
| 235 |
\wd#1=0pt% |
| 236 |
\ht#1=0pt% |
| 237 |
\dp#1=0pt% |
| 238 |
\box#1 |
| 239 |
\HCode{</text>\Hnewline }% |
| 240 |
}% |
| 241 |
|
| 242 |
%% we save this definition |
| 243 |
\let\pgfsys@mtext@hbox\pgfsys@hbox |
| 244 |
|
| 245 |
%% we have to use some "evil" ^^ tex4ht hackery |
| 246 |
% tex4ht hackery |
| 247 |
{% grouping necessary cause we change the catcode of ":" |
| 248 |
\catcode`:=11\relax |
| 249 |
%%% this is necessary to calculate the size of text nodes with |
| 250 |
%%% inline maths |
| 251 |
% (it is an improvement of tex4ht, got to ask eitan gurary if he |
| 252 |
% could put it in the tex4ht code) |
| 253 |
\gdef\DviMathAlt{% |
| 254 |
\a:DviMath\leavevmode \MathClass |
| 255 |
\ht:special{t4ht@(}\hbox\bgroup{\expandafter\ifx\csname |
| 256 |
ht:everypar\endcsname\relax\expandafter\everypar\else |
| 257 |
\expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend |
| 258 |
}% |
| 259 |
% these are configures for the foreignelement rendering method of text nodes : we let tex4ht write xhtml and mathml in the svg picture |
| 260 |
% |
| 261 |
\gdef\pgfsys@foreignobject@configure{% |
| 262 |
\Configure{$}{\Configure{@math}{%\a:mathml |
| 263 |
display="inline" }\DviMathAlt}{\EndDviMath}{}%%% we REALLY need to use \DviMathAlt here instead of \DviMath see above remark |
| 264 |
\Configure{$$}{\Configure{@math}{%\a:mathml |
| 265 |
display="block" }\IgnorePar |
| 266 |
\ifvmode\else \HCode{<!--tex4ht:inline-->}\fi\EndP |
| 267 |
\DviMath}{\EndDviMath\ShowPar\pgfsys@foreignobject@par{\csname HCondtrue\endcsname\noindent} |
| 268 |
}{\DisplayMathtrue}% |
| 269 |
\Configure{SUB}{\Send{BACK}{<\a:mathml msub><\a:mathml mrow\Hnewline>}% |
| 270 |
\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msub\Hnewline>}% |
| 271 |
\Configure{SUP}{\Send{BACK}{<\a:mathml msup><\a:mathml mrow\Hnewline>}% |
| 272 |
\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msup\Hnewline>}% |
| 273 |
\Configure{SUBSUP}{\Send{BACK}{<\a:mathml msubsup><\a:mathml mrow\Hnewline>}% |
| 274 |
\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\Tg<\a:mathml mrow\Hnewline>\trap:base}{\Tg</\a:mathml mrow>\TG</\a:mathml msubsup\Hnewline>}% |
| 275 |
\Configure{htf}{0}{+}{<span\Hnewline |
| 276 |
class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>}% |
| 277 |
}% |
| 278 |
\global\let\pgfsys@foreignobject@par=\par % use this instead of \par |
| 279 |
% -- \Configure is no \long macro (at |
| 280 |
% least in one of the older |
| 281 |
% versions). |
| 282 |
|
| 283 |
% these are the configures for the mtext rendering method of text |
| 284 |
% nodes : we turn everything into regular character (don't want math |
| 285 |
% modes or subsup) |
| 286 |
% and we hope it works (it doesn't if the text nodes aren't simple) |
| 287 |
\gdef\pgfsys@mtext@configure{% |
| 288 |
% no configures for \(\) and \[\] those might be needed for |
| 289 |
% context or Latex. Let me know ! |
| 290 |
\Configure{$$}{}{}{}% no block maths |
| 291 |
\Configure{$}{}{}{}%$ no inline maths |
| 292 |
\Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}% |
| 293 |
\Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}% |
| 294 |
\Configure{SUBSUP}{}{}{}% not both sub and sup |
| 295 |
\Configure{htf} {0}{+}{<tspan font-family="}{\%s}{" font-size="\%s}{}{}{">}{</tspan>}% |
| 296 |
}% |
| 297 |
}% |
| 298 |
|
| 299 |
% a counter to produce unique ids for each text node rendered with foreign element |
| 300 |
\newcount\pgf@sys@svg@nodenum |
| 301 |
|
| 302 |
|
| 303 |
% pgfutil@minipage |
| 304 |
% |
| 305 |
% I had to change it to make it play nice with the way tex4ht puts <p> and <\p> tags |
| 306 |
% |
| 307 |
|
| 308 |
\newif\ifpgfsys@textonly |
| 309 |
\def\pgfutil@minipage[#1]#2{% |
| 310 |
\hbox to#2\bgroup |
| 311 |
\hsize=#2\relax |
| 312 |
\vbox\bgroup |
| 313 |
% though it works, I'm disabling the above-mentioned hack to make tex4ht behave with <p> <\p>, because it blurps the positioning |
| 314 |
% (I''l try to fix that later, it's a css thing) |
| 315 |
% |
| 316 |
% \ifpgfsys@textonly\else\HtmlParOn\fi |
| 317 |
% |
| 318 |
% \noindent is better as it doesn't produce indentation AND it makes you leave vertical mode |
| 319 |
\noindent%\leavevmode |
| 320 |
}% |
| 321 |
\def\pgfutil@endminipage{% |
| 322 |
% same thing here |
| 323 |
% |
| 324 |
% \ifpgfsys@textonly\else\EndP\HtmlParOff\fi |
| 325 |
\egroup\egroup |
| 326 |
}% |
| 327 |
|
| 328 |
|
| 329 |
% I'll have to fix those names later |
| 330 |
\newbox\pgfsys@foreignobject@Box |
| 331 |
\newdimen\pgf@s |
| 332 |
\newdimen\pgf@t |
| 333 |
% this is the alternate hbox routine that renders text nodes through the foreignobject tag |
| 334 |
\def\pgfsys@foreignobject@hbox#1{% |
| 335 |
% Compute box y translation (x translation is correct). |
| 336 |
\pgf@y=-\ht#1\relax |
| 337 |
\HCode{<g transform="scale(1,-1) translate(0,\pgf@sys@tonumber{\pgf@y}) % got to translate in y |
| 338 |
scale(0.5,0.5)">\Hnewline}% scaling work around (damn dumb browsers !) |
| 339 |
% Compute box size (scaled 2 times) |
| 340 |
% this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen, |
| 341 |
% so we have to work around this by making svg scale the things down 50%, doubling the size of the text node frame (i.e. no changement there) |
| 342 |
\pgf@x=2\wd#1\relax |
| 343 |
\pgf@y=2\ht#1\relax |
| 344 |
\advance\pgf@y by 2\dp#1\relax |
| 345 |
% this is to adjust the y translation to compensate for the differences between the TeX and the Html models for lines |
| 346 |
\setbox\pgfsys@foreignobject@Box=\hbox{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ |
| 347 |
$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZf_1^1\overline D)_1^1\vec i\vec j$}% |
| 348 |
\pgf@t=\ht#1\relax |
| 349 |
\advance\pgf@t by -\ht\pgfsys@foreignobject@Box\relax |
| 350 |
\pgf@s=\pgf@t\relax |
| 351 |
\advance\pgf@s by \dp#1\relax |
| 352 |
\advance\pgf@s by -\dp\pgfsys@foreignobject@Box\relax |
| 353 |
\ifnum\pgf@s>0\relax |
| 354 |
\pgf@s=0pt |
| 355 |
\pgf@t=0pt |
| 356 |
\else |
| 357 |
\advance \pgf@y by -2\pgf@s\relax |
| 358 |
\pgf@t=2\pgf@t\relax |
| 359 |
\fi |
| 360 |
% |
| 361 |
\HCode{<foreignObject x="0" y="\pgf@sys@tonumber{\pgf@t}" |
| 362 |
width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}">}% |
| 363 |
% this is to make use of the css, class and id options through which you can control the way things display |
| 364 |
\pgfkeys{% |
| 365 |
/pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css,% |
| 366 |
/pgf/tex4ht node/class/.get=\pgfsys@foreignobject@class,% |
| 367 |
/pgf/tex4ht node/id/.get=\pgfsys@foreignobject@id |
| 368 |
}% |
| 369 |
\HCode{<head>\Hnewline |
| 370 |
<link rel="stylesheet" type="text/css" href="\pgfsys@[email protected]" />\Hnewline |
| 371 |
</head>\Hnewline |
| 372 |
% I'll have to look into this, perhaps there are better |
| 373 |
% doctype.... aren't recognised and produces invalid svg |
| 374 |
% pictures a workaround (not implemented yet) would be to make |
| 375 |
% them into entities of the svg picture. |
| 376 |
<body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline |
| 377 |
<div>\Hnewline |
| 378 |
}% |
| 379 |
\box#1% |
| 380 |
\HCode{% |
| 381 |
</div>\Hnewline |
| 382 |
</body>\Hnewline |
| 383 |
</foreignObject>\Hnewline |
| 384 |
}% |
| 385 |
% debug positioning not needed but it would be nice to let it there to control things later on |
| 386 |
% \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}" |
| 387 |
% style="fill:yellow;stroke:red; fill-opacity:0.5;stroke-opacity:0.5"/>} |
| 388 |
\HCode{</g>\Hnewline}% |
| 389 |
\global\advance\pgf@sys@svg@nodenum by 1\relax |
| 390 |
}% |
| 391 |
|
| 392 |
% the options and the code that controls it all (switches between \pgfsys@mtext@hbox and \pgfsys@foreignelement@hbox) |
| 393 |
|
| 394 |
\pgfkeys{% |
| 395 |
/pgf/.cd, |
| 396 |
tex4ht node/escape/.is choice, |
| 397 |
tex4ht node/escape/false/.code={\let\pgfsys@hbox\pgfsys@mtext@hbox\pgfsys@mtext@configure\pgfsys@textonlytrue}, |
| 398 |
tex4ht node/escape/true/.code={\let\pgfsys@hbox\pgfsys@foreignobject@hbox\pgfsys@foreignobject@configure\pgfsys@textonlyfalse}, |
| 399 |
tex4ht node/css/.initial=\jobname, |
| 400 |
tex4ht node/class/.initial=foreignobject, |
| 401 |
tex4ht node/id/.initial=\jobname\the\pgf@sys@svg@picnum-\the\pgf@sys@svg@nodenum |
| 402 |
}% |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
% this might be needed |
| 410 |
%\font\SvgText=cmr10\relax |
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
% There is something rellay wrong with the way "%" chars are used in here... you should code "}%" to avoid unnecessary spaces |
| 416 |
% and it is unnecessary to code \cs% |
| 417 |
% got to be careful with numbers though, cf the texbook...2\relax and 2 % are okey |
| 418 |
|
| 419 |
\def\pgfsys@outerinvoke{\ifpgfpicture\expandafter\pgfsys@invoke\else\expandafter\pgfutil@gobble\fi} |
| 420 |
|
| 421 |
\def\pgfsys@shadingoutsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}} |
| 422 |
\def\pgfsys@shadinginsidepgfpicture#1{\pgf@sys@fail{svg code in preamble}} |
| 423 |
|
| 424 |
\def\pgfsys@body@shadingoutsidepgfpicture#1{% |
| 425 |
\begingroup% |
| 426 |
#1% |
| 427 |
\setbox\pgfpic=\hbox to0pt{% |
| 428 |
\pgfsys@beginpicture% |
| 429 |
\pgfsys@beginscope% |
| 430 |
\pgf@sys@svg@sh@defs% |
| 431 |
\pgf@sys@svg@sh% |
| 432 |
\pgfsys@endscope% |
| 433 |
\pgfsys@endpicture% |
| 434 |
\hss% |
| 435 |
}% |
| 436 |
\pgf@process{\pgf@sys@svg@pos}% |
| 437 |
\pgf@picminx=0pt% |
| 438 |
\pgf@picminy=0pt% |
| 439 |
\pgf@picmaxx=\pgf@x% |
| 440 |
\pgf@picmaxy=\pgf@y% |
| 441 |
\def\pgf@trimleft@final{0pt}% |
| 442 |
\def\pgf@trimright@final{0pt}% |
| 443 |
\def\pgf@shift@baseline{0pt}% |
| 444 |
\pgfsys@typesetpicturebox\pgfpic% |
| 445 |
\endgroup% |
| 446 |
} |
| 447 |
|
| 448 |
\def\pgfsys@body@shadinginsidepgfpicture#1{% |
| 449 |
#1% |
| 450 |
\pgf@sys@svg@sh@defs% hmmm.... |
| 451 |
\pgf@process{\pgf@sys@svg@pos} |
| 452 |
\pgf@xa=-.5\pgf@x% |
| 453 |
\pgf@ya=-.5\pgf@y% |
| 454 |
\pgfsysprotocol@literal{<g transform="translate(\pgf@sys@tonumber{\pgf@xa},\pgf@sys@tonumber{\pgf@ya})">\Hnewline}% |
| 455 |
\pgf@sys@svg@sh% |
| 456 |
\pgfsysprotocol@literal{</g>\Hnewline}% |
| 457 |
} |
| 458 |
|
| 459 |
|
| 460 |
\ifpgfutil@format@is@latex |
| 461 |
% Protect against color.4ht evil meddling with xcolor: |
| 462 |
\RequirePackage{xcolor} |
| 463 |
\let\pgf@xcolor@declaredcolor=\@declaredcolor |
| 464 |
\let\pgf@xcolor@undeclaredcolor=\@undeclaredcolor |
| 465 |
\fi |
| 466 |
|
| 467 |
\AtBeginDocument{ |
| 468 |
\let\pgfsys@invoke=\pgfsys@body@invoke |
| 469 |
\let\pgfsys@shadingoutsidepgfpicture=\pgfsys@body@shadingoutsidepgfpicture |
| 470 |
\let\pgfsys@shadinginsidepgfpicture=\pgfsys@body@shadinginsidepgfpicture |
| 471 |
\ifpgfutil@format@is@latex |
| 472 |
\let\pgf@texht@declaredcolor=\@declaredcolor |
| 473 |
\let\pgf@texht@undeclaredcolor=\@undeclaredcolor |
| 474 |
\def\@declaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@declaredcolor\else\expandafter\pgf@texht@declaredcolor\fi} |
| 475 |
\def\@undeclaredcolor{\ifpgfpicture\expandafter\pgf@xcolor@undeclaredcolor\else\expandafter\pgf@texht@undeclaredcolor\fi} |
| 476 |
\fi |
| 477 |
\def\pgfutil@color{\pgfsetcolor} |
| 478 |
% \ConfigureEnv{pgfpicture}{}{}{}{} there is no environment in plain TeX and this produces errors |
| 479 |
% this might be needed for context or latex though....let me know ! |
| 480 |
}% |
| 481 |
|
| 482 |
\endinput |
| 483 |
|
| 484 |
|
| 485 |
%%% Local Variables: |
| 486 |
%%% mode: latex |
| 487 |
%%% End: |