Debian Codegraph @

texmf-dist/tex/latex/tikz-decofonts/tikz-decofonts.sty

raw
1 % Author : C. Pierquet
2 % licences : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
3 % : CC BY-SA 4.0 (https://tex.stackexchange.com/questions/475141/simulating-paintbrush-strokes-in-tikz from user121799)
4 % : (https://tex.stackexchange.com/questions/460836/custom-line-cap-to-simulate-inked-line-in-tikz/460842#460842 from user121799)
5
6 \NeedsTeXFormat{LaTeX2e}
7 \ProvidesPackage{tikz-decofonts}[2026/04/29 0.1.8 Custom fonts, made with TikZ, with effects]
8
9 %------History
10 % 0.1.8 Pen-underline
11 % 0.1.7 AlphabetCubes (experimental)
12 % 0.1.6 New key for 'freehand' circled text
13 % 0.1.5 Small 'freehand' circled text
14 % 0.1.4 Arrow (fixed size) with text
15 % 0.1.3 Underline/surround small texts
16 % 0.1.2 Bd fonts (with callout.shapes)
17 % 0.1.1 Bicolor txt
18 % 0.1.0 Initial version
19
20 %------Packages and library
21 \RequirePackage{tikz}
22 \RequirePackage{tikz-3dplot}
23 \RequirePackage{settobox}
24 \RequirePackage{xstring}
25 \RequirePackage{xintexpr}
26 \RequirePackage{listofitems}
27 \RequirePackage{simplekv}
28 \RequirePackage{ifthen}
29 \RequirePackage{calc}
30 \usetikzlibrary{decorations,decorations.pathreplacing,decorations.pathmorphing,calc,positioning,bbox,arrows.meta,bending,shapes.callouts}
31
32 %------Paintbrush
33 \pgfmathdeclarerandomlist{randcolor}{{black}{white}}
34 \pgfkeys{/brush pars/.cd,
35 lines/.initial={\tkzbrushlines},
36 distance/.initial=0.25pt
37 }
38 \tikzset{
39 brush/.style={
40 decorate,
41 decoration={
42 show path construction,
43 lineto code={
44 \foreach\Xbrush in{1,...,\pgfkeysvalueof{/brush pars/lines}}{
45 \pgfmathrandomitem{\c}{randcolor}
46 \pgfmathtruncatemacro{\mix}{100-24*rnd}
47 \draw[color=brushcolor!\mix!\c,
48 shorten >={(3-4*rnd)*1pt
49 -0.5*\pgfkeysvalueof{/brush pars/lines}*\pgfkeysvalueof{/brush pars/distance}},
50 shorten <={(3-4*rnd)*1pt
51 -0.5*\pgfkeysvalueof{/brush pars/lines}*\pgfkeysvalueof{/brush pars/distance}}]
52 let \p1=($(\tikzinputsegmentlast)-(\tikzinputsegmentfirst)$),
53 \n1={90+atan2(\y1,\x1)} in
54 ($(\tikzinputsegmentfirst)+(\n1:{((1.02-0.04*rnd)*\Xbrush-\pgfkeysvalueof{/brush pars/lines}/2)*\pgfkeysvalueof{/brush pars/distance}})$)
55 --
56 ($(\tikzinputsegmentlast)+(\n1:{((1.02-0.04*rnd)*\Xbrush-\pgfkeysvalueof{/brush pars/lines}/2)*\pgfkeysvalueof{/brush pars/distance}})$);
57 }
58 },
59 curveto code={
60 \foreach\Xbrush in{1,...,\pgfkeysvalueof{/brush pars/lines}}{
61 \pgfmathrandomitem{\c}{randcolor}
62 \pgfmathtruncatemacro{\mix}{100-24*rnd}
63 \draw[color=brushcolor!\mix!\c,shorten >={(3-4*rnd)*1pt
64 -0.5*\pgfkeysvalueof{/brush pars/lines}*\pgfkeysvalueof{/brush pars/distance}},
65 shorten <={(3-4*rnd)*1pt
66 -0.5*\pgfkeysvalueof{/brush pars/lines}*\pgfkeysvalueof{/brush pars/distance}}]
67 let \p1=($(\tikzinputsegmentsupporta)-(\tikzinputsegmentfirst)$),
68 \p2=($(\tikzinputsegmentsupportb)-(\tikzinputsegmentsupporta)$),
69 \p3=($(\tikzinputsegmentlast)-(\tikzinputsegmentsupportb)$),
70 \n1={90+atan2(\y1,\x1)}, \n2={90+atan2(\y2,\x2)},
71 \n3={90+atan2(\y3,\x3)} in
72 ($(\tikzinputsegmentfirst)+(\n1:{((1.02-0.04*rnd)*\Xbrush-\pgfkeysvalueof{/brush pars/lines}/2)*\pgfkeysvalueof{/brush pars/distance}})$)
73 .. controls ($(\tikzinputsegmentsupporta)+(\n2:{((1.02-0.04*rnd)*\Xbrush-\pgfkeysvalueof{/brush pars/lines}/2)*\pgfkeysvalueof{/brush pars/distance}})$)
74 and ($(\tikzinputsegmentsupportb)+(\n3:{((1.02-0.04*rnd)*\Xbrush-\pgfkeysvalueof{/brush pars/lines}/2)*\pgfkeysvalueof{/brush pars/distance}})$) ..
75 ($(\tikzinputsegmentlast)+(\n3:{((1.02-0.04*rnd)*\Xbrush-\pgfkeysvalueof{/brush pars/lines}/2)*\pgfkeysvalueof{/brush pars/distance}})$);
76 }
77 },
78 }
79 }
80 }
81 \tikzset{pics/.cd,
82 brushA/.style={code={%
83 \draw[brush] (0,-0.5) -- (0.25,0.5) -- (0.5,-0.5);
84 \draw[brush] (0.125,-0.15) -- (0.375,-0.15);
85 %\path (0.725,0);%
86 %\filldraw[blue] (0,0) circle[radius=2pt] ;
87 }%
88 },
89 brushB/.style={code={%
90 \draw[brush] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=2.5] (0,0) to[out=0,in=0,looseness=3] cycle;
91 %\filldraw[blue] (0,0) circle[radius=2pt] ;
92 }
93 },
94 brushC/.style={code={%
95 \draw[brush] (0,0) to[out=90,in=180] (0.25,0.5) to[out=0,in=110] (0.5,0.325) ;
96 \draw[brush] (0,0) to[out=-90,in=180] (0.25,-0.5) to[out=0,in=-110] (0.5,-0.325) ;
97 %\draw[brush] (0,0) to[out=90,in=110,looseness=2] (0.5,0.325);
98 %\draw[brush](0,0) to[out=-90,in=-110,looseness=2] (0.5,-0.2325);
99 %\path (0.7,0);
100 %\filldraw[blue] (0,0) circle[radius=2pt] ;
101 }
102 },
103 brushD/.style={code={%
104 \draw[brush] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=1.75] cycle;
105 %\path (0.675,0);
106 %\filldraw[blue] (0,0) circle[radius=2pt] ;
107 }
108 },
109 brushE/.style={code={%
110 \draw[brush] (0.425,-0.5) --(0,-0.5) -- (0,0.5) -- (0.425,0.5);
111 \draw[brush] (0,0) -- (0.425,0);
112 \path (0.5,0);
113 %\filldraw[blue] (0,0) circle[radius=2pt] ;
114 }
115 },
116 brushF/.style={code={%
117 \draw[brush] (0,-0.5) -- (0,0.5) -- (0.425,0.5);
118 \draw[brush] (0,0) -- (0.425,0);
119 \path (0.5,0);
120 %\filldraw[blue] (0,0) circle[radius=2pt] ;
121 }
122 },
123 brushG/.style={code={%
124 \draw[brush] (0,0) to[out=90,in=180] (0.25,0.5) to[out=0,in=100] (0.475,0.325) ;
125 \draw[brush] (0,0) to[out=-90,in=180] (0.25,-0.5) to[out=0,in=-110] (0.475,-0.1) ;
126 \draw[brush] (0.475,-0.1) to (0.275,-0.1);
127 %\draw[brush] (0,0) to[out=90,in=110,looseness=2] (0.5,0.25);
128 %\draw[brush] (0,0) to[out=-90,in=-110,looseness=2] (0.5,-0.25);
129 %\draw[brush] (0.5,-0.25) to (0.25,-0.25);
130 %\path (0.7,0);
131 %\filldraw[blue] (0,0) circle[radius=2pt] ;
132 }
133 },
134 brushH/.style={code={%
135 \draw[brush] (0,-0.5) -- (0,0.5);
136 \draw[brush] (0.5,-0.5) -- (0.5,0.5);
137 \draw[brush] (0,0) -- (0.5,0);
138 %\path (0.7,0);
139 %\filldraw[blue] (0,0) circle[radius=2pt] ;
140 }
141 },
142 brushI/.style={code={%
143 \draw[brush] (0,-0.5) -- (0,0.5);
144 %\path (0.25,0);
145 %\filldraw[blue] (0,0) circle[radius=2pt] ;
146 }
147 },
148 brushJ/.style={code={%
149 \draw[brush] (0.35,0.5) -- (0.35,-0.35) to[out=-90,in=0] (0.175,-0.5) to[out=180,in=-90] (0,-0.3);
150 %\path (0.45,0);
151 %\filldraw[blue] (0,0) circle[radius=2pt] ;
152 }
153 },
154 brushK/.style={code={%
155 \draw[brush] (0,-0.5) -- (0,0.5);
156 \draw[brush] (0.4,0.475) -- (0.02,0) -- (0.4,-0.475);
157 %\path (0.6,0);
158 %\filldraw[blue] (0,0) circle[radius=2pt] ;
159 }
160 },
161 brushL/.style={code={
162 \draw[brush] (0,0.5) -- (0,-0.5) -- (0.5,-0.5);
163 %\path (0.6,0);
164 %\filldraw[blue] (0,0) circle[radius=2pt] ;
165 }
166 },
167 brushM/.style={code={
168 \draw[brush] (0,-0.5) -- (0,0.5) -- (0.25,0.25) -- (0.5,0.5) -- (0.5,-0.5);
169 %\path (0.8,0);
170 %\filldraw[blue] (0,0) circle[radius=2pt] ;
171 }
172 },
173 brushN/.style={code={
174 \draw[brush] (0,-0.5) -- (0,0.5) -- (0.5,-0.5) -- (0.5,0.5);
175 %\path (0.8,0);
176 %\filldraw[blue] (0,0) circle[radius=2pt] ;
177 }
178 },
179 brushO/.style={code={
180 \draw[brush] (0.25,0) circle(0.25 and 0.5);
181 %\path (0.8,0);
182 %\filldraw[blue] (0,0) circle[radius=2pt] ;
183 }
184 },
185 brushP/.style={code={
186 \draw[brush] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=2.5] (0,0);
187 %\path (0.6,0);
188 %\filldraw[blue] (0,0) circle[radius=2pt] ;
189 }
190 },
191 brushQ/.style={code={
192 \draw[brush] (0.25,0) circle(0.25 and 0.5);
193 \draw[brush](0.35,-0.25) -- (0.475,-0.45);
194 %\path (0.8,0);
195 %\filldraw[blue] (0,0) circle[radius=2pt] ;
196 }
197 },
198 brushR/.style={code={
199 \draw[brush] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=2.5] (0.05,0) -- (0.5,-0.5);
200 %\path (0.6,0);
201 %\filldraw[blue] (0,0) circle[radius=2pt] ;
202 }
203 },
204 brushS/.style={code={
205 \draw[brush] (0.475,0.475) to[out=150,in=165,looseness=2.25] (0.25,0) to[out=-15,in=-30,looseness=2.25] (0.025,-0.475);
206 %\path (0.65,0);
207 %\filldraw[blue] (0,0) circle[radius=2pt] ;
208 }
209 },
210 brushT/.style={code={
211 \draw[brush] (0.25,-0.5) -- (0.25,0.5) (0,0.5) -- (0.5,0.5);
212 %\path (0.85,0);
213 %\filldraw[blue] (0,0) circle[radius=2pt] ;
214 }
215 },
216 brushU/.style={code={
217 \draw[brush] (0,0.5) -- (0,0) to[out=-90,in=-90,looseness=4] (0.5,0) -- (0.5,0.5);
218 %\path (0.8,0);
219 %\filldraw[blue] (0,0) circle[radius=2pt] ;
220 }
221 },
222 brushV/.style={code={
223 \draw[brush] (0,0.5) -- (0.25,-0.5) -- (0.5,0.5);
224 %\path (0.8,0);
225 %\filldraw[blue] (0,0) circle[radius=2pt] ;
226 }
227 },
228 brushW/.style={code={
229 \draw[brush] (0,0.5) -- (0.15,-0.5) -- (0.3,-0.25) -- (0.45,-0.5) -- (0.6,0.5);
230 %\path (1.1,0);
231 %\filldraw[blue] (0,0) circle[radius=2pt] ;
232 }
233 },
234 brushX/.style={code={
235 \draw[brush] (0,0.5) -- (0.5,-0.5);
236 \draw[brush] (0.5,0.5) -- (0,-0.5);
237 %\path (0.8,0);
238 %\filldraw[blue] (0,0) circle[radius=2pt] ;
239 }
240 },
241 brushY/.style={code={
242 \draw[brush] (0,0.5) -- (0.25,0);
243 \draw[brush] (0.5,0.5) -- (0,-0.5);
244 %\path (0.8,0);
245 %\filldraw[blue] (0,0) circle[radius=2pt] ;
246 }
247 },
248 brushZ/.style={code={
249 \draw[brush] (0,0.5) --(0.5,0.5) -- (0,-0.5) -- (0.5,-0.5);
250 %\path (0.8,0);
251 %\filldraw[blue] (0,0) circle[radius=2pt] ;
252 }
253 },
254 brushspace/.style={code={\path (0,0) (0.2,0);}},
255 }
256
257
258 \defKV[tkzbrush]{%
259 scale=\def\tkzbrushscale{#1},%
260 color=\colorlet{brushcolor}{#1},%
261 lines=\def\tkzbrushlines{#1},%
262 thick=\def\tkzbrushthick{#1}
263 }
264
265 \setKVdefault[tkzbrush]{%
266 scale=1,%
267 color=black,%
268 lines=12,%
269 thick=3
270 }
271
272 %------inkbrush
273 \pgfdeclarearrow{
274 name=ink,
275 parameters= {\the\pgfarrowlength},
276 setup code={
277 \pgfarrowssettipend{0pt}
278 \pgfarrowssetlineend{-\pgfarrowlength}
279 \pgfarrowlinewidth=\pgflinewidth
280 \pgfarrowssavethe\pgfarrowlength
281 },
282 drawing code={
283 \pgfpathmoveto{\pgfpoint{-\pgfarrowlength}{0.5\pgflinewidth}}
284 \pgfpathcurveto{\pgfpoint{-0.75\pgfarrowlength}{0.6\pgflinewidth}}{%
285 \pgfpoint{-0.01\pgfarrowlength}{0.6\pgflinewidth}}{%
286 \pgfpoint{0pt}{0pt}}
287 \pgfpathcurveto{\pgfpoint{-0.01\pgfarrowlength}{-0.5\pgflinewidth}}{%
288 \pgfpoint{-0.2\pgfarrowlength}{-(1+0.3*rnd)*\pgflinewidth}}{%
289 \pgfpoint{-0.3\pgfarrowlength}{-0.8*(1+0.3*rnd)*\pgflinewidth}}
290 \pgfpathcurveto{\pgfpoint{-0.4\pgfarrowlength}{-0.6*(1+0.3*rnd)*\pgflinewidth}}{%
291 \pgfpoint{-0.6\pgfarrowlength}{-0.3*(1+0.3*rnd)*\pgflinewidth}}{%
292 \pgfpoint{-1\pgfarrowlength}{-0.5\pgflinewidth}}
293 \pgfusepathqfill
294 },
295 defaults={length=8pt}
296 }
297
298 \tikzset{pics/.cd,
299 inkA/.style={code={%
300 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,-0.5) -- (0.25,0.5) -- (0.5,-0.5);
301 \draw[line width={\tkzbrushthick}] (0.125,-0.15) -- (0.375,-0.15);
302 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.55) -- (0.3,0.4) -- (0.6,-0.55);
303 %\draw[line width=5](0.1,1/3-0.45) -- (0.5,1/3-0.45);
304 %\path (0.7,0);
305 }
306 },
307 inkB/.style={code={
308 \draw[line width={\tkzbrushthick},{ink[bend]}-{ink[bend]}] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=2.5] (0,0) to[out=0,in=0,looseness=3] cycle;
309 %\draw[line width=5] (0,-0.45) -- (0,0.45) to[out=0,in=0,looseness=2.5] (0,0) to[out=0,in=0,looseness=3] cycle;
310 }
311 },
312 inkC/.style={code={
313 \draw[line width={\tkzbrushthick}] (0,0) to[out=90,in=180] (0.25,0.5) to[out=0,in=110] (0.5,0.325) ;
314 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0) to[out=-90,in=180] (0.25,-0.5) to[out=0,in=-110] (0.5,-0.325) ;
315 %\draw[line width=5,-{ink[bend]}] (0,0) to[out=90,in=110,looseness=2] (0.5,0.25);
316 %\draw[line width=5,-{ink[bend]}] (0,0) to[out=-90,in=-110,looseness=2] (0.5,-0.25);
317 %\path (0.7,0);
318 }
319 },
320 inkD/.style={code={%
321 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=1.75] (0.075,-0.5) ;
322 %\draw[line width=5] (0,-0.45) -- (0,0.45) to[out=0,in=0,looseness=2.25] cycle;
323 %\path (0.7,0);
324 }
325 },
326 inkE/.style={code={%
327 \draw[line width={\tkzbrushthick},{ink[bend]}-] (0.5,0.5) -- (0,0.5) -- (0,-0.5) ;
328 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0) -- (0.425,0) ;
329 \draw[line width={\tkzbrushthick}] (0,-0.5) -- (0.4,-0.5);
330 %\draw[line width={\tkzbrushthick},{ink[bend]}-{ink[bend]}] (0.5,-0.45) --(0,-0.45) -- (0,0.45) -- (0.5,0.45);
331 %\draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0) -- (0.5,0);
332 %\path (0.7,0);
333 }
334 },
335 inkF/.style={code={%
336 \draw[line width={\tkzbrushthick},{ink[bend]}-] (0.5,0.5) -- (0,0.5) -- (0,-0.5) ;
337 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0) -- (0.425,0) ;
338 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45) -- (0.5,0.45);
339 %\draw[line width=5,-{ink[bend]}] (0,0) -- (0.5,0);
340 %\path (0.7,0);
341 }
342 },
343 inkG/.style={code={%
344 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0) to[out=90,in=180] (0.25,0.5) to[out=0,in=100] (0.475,0.325) ;
345 \draw[line width={\tkzbrushthick}] (0,0) to[out=-90,in=180] (0.25,-0.5) to[out=0,in=-110] (0.475,-0.1) ;
346 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0.475,-0.1) to (0.275,-0.1);
347 %\draw[line width=5,-{ink[bend]}] (0,0) to[out=90,in=110,looseness=2] (0.5,0.25);
348 %\draw[line width=5] (0,0) to[out=-90,in=-110,looseness=2] (0.5,-0.25);
349 %\draw[line width=5,-{ink[bend]}] (0.54,-0.25) to (0.3,-0.25);
350 %\path (0.7,0);
351 }
352 },
353 inkH/.style={code={%
354 \draw[line width={\tkzbrushthick},{ink[bend]}-] (0,-0.5) -- (0,0.5);
355 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0.5,-0.5) -- ([yshift=1pt]0.5,0.5);
356 \draw[line width={\tkzbrushthick}] (0,0) -- (0.5,0);
357 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.5) -- (0,0.5);
358 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.5,-0.5) -- (0.5,0.5);
359 %\draw[line width=5] (0,0) -- (0.5,0);
360 \path (0.7,0);
361 }
362 },
363 inkI/.style={code={
364 \draw[line width={\tkzbrushthick},-{ink[bend]}] ([yshift=-0.5pt]0,-0.5) -- ([yshift=1pt]0,0.5);
365 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45);
366 \path (0.075,0);
367 }
368 },
369 inkJ/.style={code={%
370 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0.35,0.5) -- (0.35,-0.35) to[out=-90,in=0] (0.175,-0.5) to[out=180,in=-90] (0,-0.3);
371 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.2,0.45) -- (0.2,-0.35) to[out=-90,in=0] (0.1,-0.45) to[out=180,in=-90] (0,-0.35);
372 %\path (0.45,0);
373 }
374 },
375 inkK/.style={code={%
376 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,-0.5) -- ([yshift=1pt]0,0.5);
377 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0.4,0.5) -- (0.02,0) -- (0.4,-0.5);
378 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45);
379 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.4,0.45) -- (0.02,0) -- (0.4,-0.45);
380 %\path (0.6,0);
381 }
382 },
383 inkL/.style={code={%
384 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) -- (0,-0.5) -- (0.5,-0.5);
385 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.5) -- (0,-0.45) -- (0.4,-0.45);
386 %\path (0.6,0);
387 }
388 },
389 inkM/.style={code={%
390 \draw[line width={\tkzbrushthick}] (0,-0.5)--(0,0.45) ;
391 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.475) -- (0.25,0.25) -- (0.5,0.45) -- (0.5,-0.5);
392 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45) -- (0.3,0.25) -- (0.6,0.45) -- (0.6,-0.45);
393 %\path (0.8,0);%
394 }
395 },
396 inkN/.style={code={%
397 \draw[line width={\tkzbrushthick}] (0,-0.5)--(0,0.45) ;
398 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.475) -- (0.5,-0.51) -- (0.5,0.515);
399 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45) -- (0.6,-0.4) -- (0.6,0.45);
400 %\path (0.8,0);
401 }
402 },
403 inkO/.style={code={%
404 \draw[line width={\tkzbrushthick}] (0.25,0) circle(0.25 and 0.5);
405 %\path (0.8,0);
406 }
407 },
408 inkP/.style={code={%
409 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=2.5] (0,0);
410 %\draw[line width=5,{ink[bend]}-] (0,-0.45) -- (0,0.45) to[out=0,in=0,looseness=2.5] (0,0);
411 %\path (0.6,0);
412 }
413 },
414 inkQ/.style={code={%
415 \draw[line width={\tkzbrushthick}] (0.25,0) circle(0.25 and 0.5);
416 \draw[line width={\tkzbrushthick},{ink[bend]}-{ink[bend]}](0.35,-0.25) -- (0.5,-0.5);
417 %\draw[line width=5] (0.3,0) circle(0.3 and 0.48);
418 %\draw[line width=5,{ink[bend]}-{ink[bend]}](0.35,-0.25) -- (0.6,-0.45);
419 %\path (0.8,0);
420 }
421 },
422 inkR/.style={code={%
423 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,-0.5) -- (0,0.5) to[out=0,in=0,looseness=2.5] (0.05,0) -- (0.5,-0.5);
424 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45) to[out=0,in=0,looseness=2.5] (0.05,0) -- (0.4,-0.45);
425 %\path (0.6,0);
426 }
427 },
428 inkS/.style={code={%
429 \draw[line width={\tkzbrushthick},{ink[bend]}-] (0.475,0.475) to[out=150,in=165,looseness=2.25] (0.25,0) to[out=-15,in=-30,looseness=2.25] (0.025,-0.475);
430 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.5,0.4) to[out=160,in=165,looseness=2] (0.3,0) to[out=-15,in=-20,looseness=2] (0.1,-0.4);
431 %\path (0.65,0);
432 }
433 },
434 inkT/.style={code={%
435 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0.25,-0.5) -- (0.25,0.5) ;
436 \draw[line width={\tkzbrushthick}] (0,0.5) -- (0.5,0.5);
437 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.35,-0.45) -- (0.35,0.45) (0,0.45) -- (0.7,0.45);
438 %\path (0.85,0);
439 }
440 },
441 inkU/.style={code={%
442 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) -- (0,0.25) to[out=-90,in=180] (0.25,-0.5) to[out=0,in=-90] (0.5,0.25) -- (0.5,0.5);
443 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.5) -- (0,0) to[out=-90,in=-90,looseness=2.5] (0.6,0) -- (0.6,0.5);
444 %\path (0.8,0);
445 }
446 },
447 inkV/.style={code={%
448 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) -- (0.25,-0.5) -- (0.5,0.5);
449 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.5) -- (0.3,-0.4) -- (0.6,0.5);
450 %\path (0.8,0);
451 }
452 },
453 inkW/.style={code={%
454 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) -- (0.15,-0.5) -- (0.3,-0.25) -- (0.45,-0.5) -- (0.6,0.5);
455 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.45) -- (0.3,-0.4) -- (0.45,-0.1) -- (0.6,-0.4) -- (0.9,0.45);
456 %\path (1.1,0);
457 }
458 },
459 inkX/.style={code={%
460 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) -- (0.5,-0.5);
461 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0.5,0.5) -- (0,-0.5);
462 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.45) -- (0.6,-0.45);
463 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.6,0.45) -- (0,-0.45);
464 %\path (0.8,0);
465 }
466 },
467 inkY/.style={code={
468 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) -- (0.25,0);
469 \draw[line width={\tkzbrushthick},{ink[bend]}-{ink[bend]}] (0.5,0.5) -- (0,-0.5);
470 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.45) -- (0.3,0);
471 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.6,0.45) -- (0,-0.45);
472 %\path (0.8,0);
473 }
474 },
475 inkZ/.style={code={%
476 \draw[line width={\tkzbrushthick},-{ink[bend]}] (0,0.5) --(0.5,0.5) -- (0,-0.5) -- (0.5,-0.45);
477 %\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.45) --(0.6,0.45) -- (0,-0.45) -- (0.6,-0.45);
478 %\path (0.8,0);
479 }
480 },
481 inkspace/.style={code={\path (0,0) (0.2,0);}},
482 }
483
484 %------macros
485 \NewDocumentCommand\tkzbrush{ O{} D<>{} m }{%
486 \restoreKV[tkzbrush]%
487 \setKV[tkzbrush]{#1}%
488 \StrChar{#3}{1}[\myfisrtchar]%
489 \StrLen{#3}[\mynbofchars]%
490 \begin{tikzpicture}%[bezier bounding box]
491 \pic[bezier bounding box,local bounding box=box1,scale={\tkzbrushscale},#2] at (0,0) {brush\myfisrtchar} ;%
492 %on boucle les lettres une par une ??
493 \foreach \i [count=\Y,evaluate=\Y as \Z using {int(\Y+1)}] in {2,...,\mynbofchars}{%
494 \StrChar{#3}{\i}[\mytmpchar]%
495 \IfStrEq{\mytmpchar}{ }%
496 {%
497 \edef\temp{\noexpand\pic[bezier bounding box,right=2mm of box\Y,local bounding box=box\Z,scale={\tkzbrushscale},#2] {brushspace};}
498 \temp%
499 }%
500 {%
501 \edef\temp{\noexpand\pic[bezier bounding box,right=2mm of box\Y,local bounding box=box\Z,scale={\tkzbrushscale},#2] {brush\mytmpchar};}
502 \temp%
503 }%
504 }%
505 \end{tikzpicture}%
506 }
507
508 \NewDocumentCommand\tkzink{ O{} D<>{} m }{%
509 \restoreKV[tkzbrush]%
510 \setKV[tkzbrush]{#1}%
511 \StrChar{#3}{1}[\myfisrtchar]%
512 \StrLen{#3}[\mynbofchars]%
513 \begin{tikzpicture}[brushcolor,line join=round,line cap=round]%,bezier bounding box]
514 \pic[bezier bounding box,local bounding box=box1,scale={\tkzbrushscale},#2] at (0,0) {ink\myfisrtchar} ;%
515 \foreach \i [count=\Y,evaluate=\Y as \Z using {int(\Y+1)}] in {2,...,\mynbofchars}{%
516 \StrChar{#3}{\i}[\mytmpchar]%
517 \IfStrEq{\mytmpchar}{ }%
518 {%
519 \edef\temp{\noexpand\pic[bezier bounding box,right=2mm of box\Y,local bounding box=box\Z,scale={\tkzbrushscale},#2] {inkspace};}
520 \temp%
521 }%
522 {%
523 \edef\temp{\noexpand\pic[bezier bounding box,right=2mm of box\Y,local bounding box=box\Z,scale={\tkzbrushscale},#2] {ink\mytmpchar};}
524 \temp%
525 }%
526 }%
527 \end{tikzpicture}%
528 }
529
530
531 %====PixlArt Words
532 \def\lsteightbittikzA{0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,0,0,1}%7C*5L
533 \def\lsteightbittikzB{1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0}%7C*5L
534 \def\lsteightbittikzC{0,1,1,1,0,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,1,0}
535 \def\lsteightbittikzD{1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,0,1,1,1,0,0}
536 \def\lsteightbittikzE{1,1,1,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1}
537 \def\lsteightbittikzF{1,1,1,1,1,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}
538 \def\lsteightbittikzG{0,1,1,1,0,1,0,0,0,1,1,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
539 \def\lsteightbittikzH{1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1}
540 \def\lsteightbittikzI{1,1,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1}
541 \def\lsteightbittikzJ{0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0}
542 \def\lsteightbittikzK{1,0,0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1}
543 \def\lsteightbittikzL{1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1}
544 \def\lsteightbittikzM{1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1}
545 \def\lsteightbittikzN{1,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,0,1,1,1,0,0,0,1,1,0,0,0,1}
546 \def\lsteightbittikzO{0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
547 \def\lsteightbittikzP{1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}
548 \def\lsteightbittikzQ{0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,1,0,1,1,0,0,1,0,0,1,1,0,1}
549 \def\lsteightbittikzR{1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1}
550 \def\lsteightbittikzS{0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0}
551 \def\lsteightbittikzT{1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0}
552 \def\lsteightbittikzU{1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
553 \def\lsteightbittikzV{1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0}
554 \def\lsteightbittikzW{1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0}
555 \def\lsteightbittikzX{1,0,0,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,1,0,0,0,1}
556 \def\lsteightbittikzY{1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0}
557 \def\lsteightbittikzZ{1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,1,1,1,1}
558 \def\lsteightbittikza{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,0,0,0,1,0,1,1,1,1}
559 \def\lsteightbittikzaaccent{0,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,0,0,0,1,0,1,1,1,1}
560 \def\lsteightbittikzaaigu{0,1,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,0,0,0,1,0,1,1,1,1}
561 \def\lsteightbittikzb{1,0,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0}
562 \def\lsteightbittikzc{0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,1,0}
563 \def\lsteightbittikzd{0,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1}
564 \def\lsteightbittikze{0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0}
565 \def\lsteightbittikzeaccent{0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0}
566 \def\lsteightbittikzeaigu{0,1,0,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0}
567 \def\lsteightbittikzf{0,0,1,1,0,0,1,0,0,1,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0}
568 \def\lsteightbittikzg{0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,1,1,0}
569 \def\lsteightbittikzh{1,0,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1}
570 \def\lsteightbittikzi{0,1,0,0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,1,1}
571 \def\lsteightbittikziaccent{1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,1,1}
572 \def\lsteightbittikziaigu{1,0,1,0,0,0,1,1,0,0,1,0,0,1,0,0,1,0,1,1,1}
573 \def\lsteightbittikzj{0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,1,0,1,1,0}
574 \def\lsteightbittikzk{1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,0,0,1,0,1,0,1,0,0,1}
575 \def\lsteightbittikzl{1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1}
576 \def\lsteightbittikzm{0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,0,0,1,1,0,0,0,1}
577 \def\lsteightbittikzn{0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1}
578 \def\lsteightbittikzo{0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
579 \def\lsteightbittikzp{0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0}
580 \def\lsteightbittikzq{0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1}
581 \def\lsteightbittikzr{0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}
582 \def\lsteightbittikzs{0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,0}
583 \def\lsteightbittikzt{0,1,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0}
584 \def\lsteightbittikzu{0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,1}
585 \def\lsteightbittikzv{0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,0}
586 \def\lsteightbittikzw{0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0}
587 \def\lsteightbittikzx{0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1}
588 \def\lsteightbittikzy{0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,1,1,0}
589 \def\lsteightbittikzz{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1}
590 \def\lsteightbittikzzero{0,1,1,1,0,1,0,0,0,1,1,0,0,1,1,1,0,1,0,1,1,1,0,0,1,1,0,0,0,1,0,1,1,1,0}
591 \def\lsteightbittikzun{0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1}
592 \def\lsteightbittikzdeux{0,1,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1}
593 \def\lsteightbittikztrois{1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
594 \def\lsteightbittikzquatre{0,0,0,1,0,0,0,1,1,0,0,1,0,1,0,1,0,0,1,0,1,1,1,1,1,0,0,0,1,0,0,0,0,1,0}
595 \def\lsteightbittikzcinq{1,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
596 \def\lsteightbittikzsix{0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
597 \def\lsteightbittikzsept{1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0}
598 \def\lsteightbittikzhuit{0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0}
599 \def\lsteightbittikzneuf{0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,1,0,0}
600 \def\lsteightbittikzapostr{1,1,0,1,1,0,0,0,0,0,0,0,0}
601 \def\lsteightbittikzparg{0,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,1}
602 \def\lsteightbittikzpard{1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0}
603 \def\lsteightbittikzfois{0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0}
604 \def\lsteightbittikzplus{0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0}
605 \def\lsteightbittikzvirgule{0,0,0,0,0,0,0,0,1,1,0,1,1,0}
606 \def\lsteightbittikzmoins{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
607 \def\lsteightbittikzpoint{0,0,0,0,0,0,0,0,0,0,1,1,1,1}
608 \def\lsteightbittikzslash{0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0}
609 \def\lsteightbittikzdeuxpoints{0,0,1,1,1,1,0,0,1,1,1,1,0,0}
610 \def\lsteightbittikzpointvirg{0,0,1,1,1,1,0,0,1,1,0,1,1,0}
611 \def\lsteightbittikzinf{0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0}
612 \def\lsteightbittikzeggal{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0}
613 \def\lsteightbittikzsup{1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0}
614 \def\lsteightbittikzinterro{0,1,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0}
615 \def\lsteightbittikzexcla{1,1,1,1,1,0,1}
616 \def\lsteightbittikzcrog{1,1,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,1}
617 \def\lsteightbittikzgrod{1,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,1,1}
618 \def\lsteightbittikzbarre{1,1,1,1,1,1,1}
619 \def\lsteightbittikzspace{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
620
621 \newlength{\eightbitpartthick}
622 \newlength{\eightbitpartheight}
623 \newlength{\eightbitpartunit}
624 \setlength{\eightbitpartthick}{0.1mm}
625 \setlength{\eightbitpartheight}{11mm}
626 \setlength{\eightbitpartunit}{1mm}
627
628 \defKV[eightbitpart]{%
629 %unit=\def\eightbitpartunit{#1},%
630 height=\setlength{\eightbitpartheight}{#1},%
631 thick=\setlength{\eightbitpartthick}{#1},%
632 color=\def\eightbitpartcolor{#1},%
633 gridcolor=\def\eightbitpartgridcolor{#1},%
634 offseth=\def\eightbitpartoffseth{#1},%
635 offsetv=\def\eightbitpartoffsetv{#1}%
636 }
637
638 \setKVdefault[eightbitpart]{%
639 height=11mm,%
640 thick=0.1mm,%
641 color=black,%
642 gridcolor=gray,
643 offseth=1,%
644 offsetv=2,%
645 gridafter=false,%
646 nospaceafter=false,%
647 border=false
648 }
649
650 \NewDocumentCommand\tkzpixletter{ }{%
651 \begingroup
652 \catcode`\;=12
653 \catcode`\:=12
654 \catcode`\!=12
655 \catcode`\?=12
656 \PixlLetterAux
657 }
658
659 \NewDocumentCommand\PixlLetterAux{ O{} D<>{} m }{%
660 \endgroup
661 \restoreKV[eightbitpart]%
662 \setKV[eightbitpart]{#1}%
663 \xdef\tmplarg{5}%
664 %MAJUSCULE
665 \IfStrEq{#3}{A}{\xdef\TMPLIST{\lsteightbittikzA}}{}%
666 \IfStrEq{#3}{B}{\xdef\TMPLIST{\lsteightbittikzB}}{}%
667 \IfStrEq{#3}{C}{\xdef\TMPLIST{\lsteightbittikzC}}{}%
668 \IfStrEq{#3}{D}{\xdef\TMPLIST{\lsteightbittikzD}}{}%
669 \IfStrEq{#3}{E}{\xdef\TMPLIST{\lsteightbittikzE}}{}%
670 \IfStrEq{#3}{F}{\xdef\TMPLIST{\lsteightbittikzF}}{}%
671 \IfStrEq{#3}{G}{\xdef\TMPLIST{\lsteightbittikzG}}{}%
672 \IfStrEq{#3}{H}{\xdef\TMPLIST{\lsteightbittikzH}}{}%
673 \IfStrEq{#3}{I}{\xdef\TMPLIST{\lsteightbittikzI}\xdef\tmplarg{3}}{}%
674 \IfStrEq{#3}{J}{\xdef\TMPLIST{\lsteightbittikzJ}}{}%
675 \IfStrEq{#3}{K}{\xdef\TMPLIST{\lsteightbittikzK}}{}%
676 \IfStrEq{#3}{L}{\xdef\TMPLIST{\lsteightbittikzL}}{}%
677 \IfStrEq{#3}{M}{\xdef\TMPLIST{\lsteightbittikzM}}{}%
678 \IfStrEq{#3}{N}{\xdef\TMPLIST{\lsteightbittikzN}}{}%
679 \IfStrEq{#3}{O}{\xdef\TMPLIST{\lsteightbittikzO}}{}%
680 \IfStrEq{#3}{P}{\xdef\TMPLIST{\lsteightbittikzP}}{}%
681 \IfStrEq{#3}{Q}{\xdef\TMPLIST{\lsteightbittikzQ}}{}%
682 \IfStrEq{#3}{R}{\xdef\TMPLIST{\lsteightbittikzR}}{}%
683 \IfStrEq{#3}{S}{\xdef\TMPLIST{\lsteightbittikzS}}{}%
684 \IfStrEq{#3}{T}{\xdef\TMPLIST{\lsteightbittikzT}}{}%
685 \IfStrEq{#3}{U}{\xdef\TMPLIST{\lsteightbittikzU}}{}%
686 \IfStrEq{#3}{V}{\xdef\TMPLIST{\lsteightbittikzV}}{}%
687 \IfStrEq{#3}{W}{\xdef\TMPLIST{\lsteightbittikzW}}{}%
688 \IfStrEq{#3}{X}{\xdef\TMPLIST{\lsteightbittikzX}}{}%
689 \IfStrEq{#3}{Y}{\xdef\TMPLIST{\lsteightbittikzY}}{}%
690 \IfStrEq{#3}{Z}{\xdef\TMPLIST{\lsteightbittikzZ}}{}%
691 %minuscule
692 \IfStrEq{#3}{a}{\xdef\TMPLIST{\lsteightbittikza}}{}%
693 \IfStrEq{#3}{à}{\xdef\TMPLIST{\lsteightbittikzaaccent}}{}%
694 \IfStrEq{#3}{ä}{\xdef\TMPLIST{\lsteightbittikzaaigu}}{}%
695 \IfStrEq{#3}{b}{\xdef\TMPLIST{\lsteightbittikzb}}{}%
696 \IfStrEq{#3}{c}{\xdef\TMPLIST{\lsteightbittikzc}}{}%
697 \IfStrEq{#3}{d}{\xdef\TMPLIST{\lsteightbittikzd}}{}%
698 \IfStrEq{#3}{e}{\xdef\TMPLIST{\lsteightbittikze}}{}%
699 \IfStrEq{#3}{é}{\xdef\TMPLIST{\lsteightbittikzeaccent}}{}%
700 \IfStrEq{#3}{è}{\xdef\TMPLIST{\lsteightbittikzeaccent}}{}%
701 \IfStrEq{#3}{ê}{\xdef\TMPLIST{\lsteightbittikzeaccent}}{}%
702 \IfStrEq{#3}{ë}{\xdef\TMPLIST{\lsteightbittikzeaigu}}{}%
703 \IfStrEq{#3}{f}{\xdef\TMPLIST{\lsteightbittikzf}}{}%
704 \IfStrEq{#3}{g}{\xdef\TMPLIST{\lsteightbittikzg}}{}%
705 \IfStrEq{#3}{h}{\xdef\TMPLIST{\lsteightbittikzh}}{}%
706 \IfStrEq{#3}{i}{\xdef\TMPLIST{\lsteightbittikzi}\xdef\tmplarg{3}}{}%
707 \IfStrEq{#3}{î}{\xdef\TMPLIST{\lsteightbittikziaccent}\xdef\tmplarg{3}}{}%
708 \IfStrEq{#3}{ï}{\xdef\TMPLIST{\lsteightbittikziaigu}\xdef\tmplarg{3}}{}%
709 \IfStrEq{#3}{j}{\xdef\TMPLIST{\lsteightbittikzj}\xdef\tmplarg{4}}{}%
710 \IfStrEq{#3}{k}{\xdef\TMPLIST{\lsteightbittikzk}\xdef\tmplarg{4}}{}%
711 \IfStrEq{#3}{l}{\xdef\TMPLIST{\lsteightbittikzl}\xdef\tmplarg{3}}{}%
712 \IfStrEq{#3}{m}{\xdef\TMPLIST{\lsteightbittikzm}}{}%
713 \IfStrEq{#3}{n}{\xdef\TMPLIST{\lsteightbittikzn}}{}%
714 \IfStrEq{#3}{o}{\xdef\TMPLIST{\lsteightbittikzo}}{}%
715 \IfStrEq{#3}{p}{\xdef\TMPLIST{\lsteightbittikzp}}{}%
716 \IfStrEq{#3}{q}{\xdef\TMPLIST{\lsteightbittikzq}}{}%
717 \IfStrEq{#3}{r}{\xdef\TMPLIST{\lsteightbittikzr}}{}%
718 \IfStrEq{#3}{s}{\xdef\TMPLIST{\lsteightbittikzs}}{}%
719 \IfStrEq{#3}{t}{\xdef\TMPLIST{\lsteightbittikzt}}{}%
720 \IfStrEq{#3}{u}{\xdef\TMPLIST{\lsteightbittikzu}}{}%
721 \IfStrEq{#3}{v}{\xdef\TMPLIST{\lsteightbittikzv}}{}%
722 \IfStrEq{#3}{w}{\xdef\TMPLIST{\lsteightbittikzw}}{}%
723 \IfStrEq{#3}{x}{\xdef\TMPLIST{\lsteightbittikzx}}{}%
724 \IfStrEq{#3}{y}{\xdef\TMPLIST{\lsteightbittikzy}}{}%
725 \IfStrEq{#3}{z}{\xdef\TMPLIST{\lsteightbittikzz}}{}%
726 %chiffres
727 \IfStrEq{#3}{0}{\xdef\TMPLIST{\lsteightbittikzzero}}{}%
728 \IfStrEq{#3}{1}{\xdef\TMPLIST{\lsteightbittikzun}\xdef\tmplarg{3}}{}%
729 \IfStrEq{#3}{2}{\xdef\TMPLIST{\lsteightbittikzdeux}}{}%
730 \IfStrEq{#3}{3}{\xdef\TMPLIST{\lsteightbittikztrois}}{}%
731 \IfStrEq{#3}{4}{\xdef\TMPLIST{\lsteightbittikzquatre}}{}%
732 \IfStrEq{#3}{5}{\xdef\TMPLIST{\lsteightbittikzcinq}}{}%
733 \IfStrEq{#3}{6}{\xdef\TMPLIST{\lsteightbittikzsix}}{}%
734 \IfStrEq{#3}{7}{\xdef\TMPLIST{\lsteightbittikzsept}}{}%
735 \IfStrEq{#3}{8}{\xdef\TMPLIST{\lsteightbittikzhuit}}{}%
736 \IfStrEq{#3}{9}{\xdef\TMPLIST{\lsteightbittikzneuf}}{}%
737 %ponctuation
738 \IfStrEq{#3}{'}{\xdef\TMPLIST{\lsteightbittikzapostr}\xdef\tmplarg{2}}{}%
739 \IfStrEq{#3}{(}{\xdef\TMPLIST{\lsteightbittikzparg}\xdef\tmplarg{3}}{}%
740 \IfStrEq{#3}{)}{\xdef\TMPLIST{\lsteightbittikzpard}\xdef\tmplarg{3}}{}%
741 \IfStrEq{#3}{*}{\xdef\TMPLIST{\lsteightbittikzfois}}{}%
742 \IfStrEq{#3}{+}{\xdef\TMPLIST{\lsteightbittikzplus}}{}%
743 \IfStrEq{#3}{,}{\xdef\TMPLIST{\lsteightbittikzvirgule}\xdef\tmplarg{2}}{}%
744 \IfStrEq{#3}{-}{\xdef\TMPLIST{\lsteightbittikzmoins}}{}%
745 \IfStrEq{#3}{.}{\xdef\TMPLIST{\lsteightbittikzpoint}\xdef\tmplarg{2}}{}%
746 \IfStrEq{#3}{/}{\xdef\TMPLIST{\lsteightbittikzslash}}{}%
747 \IfStrEq{#3}{:}{\xdef\TMPLIST{\lsteightbittikzdeuxpoints}\xdef\tmplarg{2}}{}%
748 \IfStrEq{#3}{;}{\xdef\TMPLIST{\lsteightbittikzpointvirg}\xdef\tmplarg{2}}{}%
749 \IfStrEq{#3}{<}{\xdef\TMPLIST{\lsteightbittikzinf}}{}%
750 \IfStrEq{#3}{=}{\xdef\TMPLIST{\lsteightbittikzeggal}}{}%
751 \IfStrEq{#3}{>}{\xdef\TMPLIST{\lsteightbittikzsup}}{}%
752 \IfStrEq{#3}{?}{\xdef\TMPLIST{\lsteightbittikzinterro}}{}%
753 \IfStrEq{#3}{!}{\xdef\TMPLIST{\lsteightbittikzexcla}\xdef\tmplarg{1}}{}%
754 \IfStrEq{#3}{[}{\xdef\TMPLIST{\lsteightbittikzcrog}\xdef\tmplarg{3}}{}%
755 \IfStrEq{#3}{]}{\xdef\TMPLIST{\lsteightbittikzgrod}\xdef\tmplarg{3}}{}%
756 \IfStrEq{#3}{|}{\xdef\TMPLIST{\lsteightbittikzbarre}\xdef\tmplarg{1}}{}%
757 \IfStrEq{#3}{ }{\xdef\TMPLIST{\lsteightbittikzspace}\xdef\tmplarg{3}}{}%
758 %la case !
759 \xdef\tmpnumbercasesv{\inteval{7+2*\eightbitpartoffsetv}}%
760 \pgfmathsetlength{\eightbitpartunit}{\eightbitpartheight/\tmpnumbercasesv}%
761 %tikzpicture
762 \begin{tikzpicture}[line cap=rect,x=\eightbitpartunit,y=\eightbitpartunit,line width=\eightbitpartthick,#2]
763 %clipping ?
764 %\clip ([shift={(-0.5\eightbitpartthick,-0.5\eightbitpartthick)}]{-\eightbitpartoffseth},{-\eightbitpartoffsetv}) rectangle ([shift={(0.5\eightbitpartthick,0.5\eightbitpartthick)}]{\tmplarg+\eightbitpartoffseth},{7+\eightbitpartoffsetv}) ;
765 %gridbefore
766 \ifboolKV[eightbitpart]{gridafter}%
767 {}%
768 {%
769 \foreach \x in {-\eightbitpartoffseth,...,\numexpr\tmplarg+\eightbitpartoffseth\relax}
770 {%
771 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] (\x,{-\eightbitpartoffsetv}) --++ (0,{7+2*\eightbitpartoffsetv}) ;
772 }%
773 \foreach \y in {-\eightbitpartoffsetv,...,\numexpr7+\eightbitpartoffseth+\eightbitpartoffseth\relax}
774 {%
775 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] ({-\eightbitpartoffseth},\y) --++ ({\tmplarg+2*\eightbitpartoffseth},0) ;
776 }%
777 }%
778 \ifnum\tmplarg=1%
779 \foreach \i [count=\j] in \TMPLIST {%
780 \ifnum\i=1%
781 \fill[\eightbitpartcolor] (0,{7-\j}) rectangle++ (1,1) ;
782 \fi%
783 }%
784 \fi%
785 \ifnum\tmplarg=2%
786 \foreach \i [count=\j] in \TMPLIST {%
787 \ifnum\i=1%
788 \xintifboolexpr{ \xintiiOdd{\j} == 1 }%
789 {%si c'est impair
790 \xdef\tmpX{0}%
791 \xdef\tmpY{\xintieval{(\j-1)/2}}%
792 }%
793 {%si c'est pair
794 \xdef\tmpX{1}%
795 \xdef\tmpY{\xintieval{(\j)/2-1}}%
796 }%
797 \fill[\eightbitpartcolor] ({\tmpX},{6-\tmpY}) rectangle++ (1,1) ;
798 \fi%
799 }%
800 \fi%
801 \ifnum\tmplarg>2%
802 \foreach \i [count=\j] in \TMPLIST {%
803 \ifnum\i=1%
804 \xdef\tmpX{\xintiiRem{\j-1}{\tmplarg}}%
805 \xdef\tmpY{\xintiiQuo{\j-1}{\tmplarg}}%
806 \fill[\eightbitpartcolor] ({\tmpX},{6-\tmpY}) rectangle++ (1,1) ;
807 \fi%
808 }%
809 \fi%
810 %gridafter
811 \ifboolKV[eightbitpart]{gridafter}%
812 {%
813 \foreach \x in {-\eightbitpartoffseth,...,\numexpr\tmplarg+\eightbitpartoffseth\relax}
814 {%
815 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] (\x,{-\eightbitpartoffsetv}) --++ (0,{7+2*\eightbitpartoffsetv}) ;
816 }%
817 \foreach \y in {-\eightbitpartoffsetv,...,\numexpr7+\eightbitpartoffseth+\eightbitpartoffseth\relax}
818 {%
819 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] ({-\eightbitpartoffseth},\y) --++ ({\tmplarg+2*\eightbitpartoffseth},0) ;
820 }%
821 }%
822 {}%
823 \end{tikzpicture}%
824 \ifboolKV[eightbitpart]{nospaceafter}{\hspace*{-\eightbitpartthick}}{}%
825 }
826
827 \NewDocumentCommand\tkzpixlquote{ O{} D<>{} }{%
828 \restoreKV[eightbitpart]%
829 \setKV[eightbitpart]{#1}%
830 \xdef\tmplarg{2}%
831 \xdef\tmpnumbercasesv{\inteval{7+2*\eightbitpartoffsetv}}%
832 \pgfmathsetlength{\eightbitpartunit}{\eightbitpartheight/\tmpnumbercasesv}%
833 \begin{tikzpicture}[line cap=rect,x=\eightbitpartunit,y=\eightbitpartunit,line width=\eightbitpartthick,#2]
834 %clipping ?
835 %\clip ({-\eightbitpartoffseth},{-\eightbitpartoffsetv}) rectangle ({\tmplarg+\eightbitpartoffseth},{7+\eightbitpartoffsetv}) ;
836 %gridbefore
837 \ifboolKV[eightbitpart]{gridafter}%
838 {}%
839 {%
840 \foreach \x in {-\eightbitpartoffseth,...,\numexpr\tmplarg+\eightbitpartoffseth\relax}
841 {%
842 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] (\x,{-\eightbitpartoffsetv}) --++ (0,{7+2*\eightbitpartoffsetv}) ;
843 }%
844 \foreach \y in {-\eightbitpartoffsetv,...,\numexpr7+\eightbitpartoffseth+\eightbitpartoffseth\relax}
845 {%
846 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] ({-\eightbitpartoffseth},\y) --++ ({\tmplarg+2*\eightbitpartoffseth},0) ;
847 }%
848 }%
849 \fill[\eightbitpartcolor] ({0},{6}) rectangle++ (1,1) ;
850 \fill[\eightbitpartcolor] ({1},{6}) rectangle++ (1,1) ;
851 \fill[\eightbitpartcolor] ({1},{5}) rectangle++ (1,1) ;
852 \fill[\eightbitpartcolor] ({0},{4}) rectangle++ (1,1) ;
853 %gridafter
854 \ifboolKV[eightbitpart]{gridafter}%
855 {%
856 \foreach \x in {-\eightbitpartoffseth,...,\numexpr\tmplarg+\eightbitpartoffseth\relax}
857 {%
858 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] (\x,{-\eightbitpartoffsetv}) --++ (0,{7+2*\eightbitpartoffsetv}) ;
859 }%
860 \foreach \y in {-\eightbitpartoffsetv,...,\numexpr7+\eightbitpartoffseth+\eightbitpartoffseth\relax}
861 {%
862 \draw[line width=\eightbitpartthick,\eightbitpartgridcolor] ({-\eightbitpartoffseth},\y) --++ ({\tmplarg+2*\eightbitpartoffseth},0) ;
863 }%
864 }%
865 {}%
866 \end{tikzpicture}%
867 \ifboolKV[eightbitpart]{nospaceafter}{\hspace*{-2\eightbitpartthick}}{}%
868 }
869
870 \NewDocumentCommand\tkzpixl{ }{%
871 \begingroup
872 \catcode`\;=12
873 \catcode`\:=12
874 \catcode`\!=12
875 \catcode`\?=12
876 \PixlLettersAux
877 }
878
879 \NewDocumentCommand\PixlLettersAux{ O{} D<>{} m }{%
880 \endgroup
881 \setKV[eightbitpart]{#1}%
882 \StrLen{#3}[\tmpnbcaract]%
883 \ifboolKV[eightbitpart]{border}%
884 {%
885 \setlength{\fboxrule}{1.75\eightbitpartthick}%
886 \setlength{\fboxsep}{-\eightbitpartthick}%
887 \fbox{%
888 \foreach \i in {1,...,\tmpnbcaract}{%
889 \StrChar{#3}{\i}[\tmpcaract]%
890 \tkzpixletter[#1]<#2>{\tmpcaract}%
891 \ifnum\i<\tmpnbcaract\hspace*{-\eightbitpartthick}\fi%
892 }%
893 }%
894 \ifboolKV[eightbitpart]{nospaceafter}{\hspace*{-\eightbitpartthick}}{}%
895 \fboxrule=0.4pt%
896 \fboxsep=3.0pt%
897 }%
898 {%
899 \foreach \i in {1,...,\tmpnbcaract}{%
900 \StrChar{#3}{\i}[\tmpcaract]%
901 \tkzpixletter[#1]<#2>{\tmpcaract}%
902 \ifnum\i<\tmpnbcaract\hspace*{-\eightbitpartthick}\fi%
903 \ifboolKV[eightbitpart]{nospaceafter}{\hspace*{-\eightbitpartthick}}{}%
904 }%
905 }%
906 }
907
908 %====BICOLORTXT
909 \defKV[bicolortxt]{colors=\def\bicolortxtcols{#1},style=\def\bicolortxtsttyle{#1},intdelta=\def\bicolortxtdelta{#1},paralcolors=\def\bicolortxtcolstrapez{#1}}
910 \setKVdefault[bicolortxt]{colors={red/blue},style=midh,intdelta=0.66,paralcolors={red/blue/orange/gray}}
911
912 \NewDocumentCommand\tkzbicolor{ O{} m }{%
913 \restoreKV[bicolortxt]%
914 \setKV[bicolortxt]{#1}%
915 \IfStrEq{\bicolortxtsttyle}{paral}%
916 {%
917 \setsepchar[.]{/}%
918 \readlist*\bicolortrapez{\bicolortxtcolstrapez}%
919 }%
920 {%
921 \StrCut{\bicolortxtcols}{/}{\bicolorabove}{\bicolorbelow}%
922 }%
923 \tikz[baseline=(l.base),inner sep=0pt,outer sep=0pt]{%
924 \node[inner sep=0pt,outer sep=0pt](l){\phantom{#2}};
925 \coordinate (lnw) at ([shift={(-0.5\pgflinewidth,0.5\pgflinewidth)}]l.north west) ;
926 \coordinate (ln) at ([shift={(0,0.5\pgflinewidth)}]l.north) ;
927 \coordinate (lne) at ([shift={(0.5\pgflinewidth,0.5\pgflinewidth)}]l.north east) ;
928 \coordinate (le) at ([shift={(0.5\pgflinewidth,0)}]l.east) ;
929 \coordinate (lse) at ([shift={(0.5\pgflinewidth,-0.5\pgflinewidth)}]l.south east) ;
930 \coordinate (ls) at ([shift={(0,-0.5\pgflinewidth)}]l.south) ;
931 \coordinate (lsw) at ([shift={(-0.5\pgflinewidth,-0.5\pgflinewidth)}]l.south west) ;
932 \coordinate (lw) at ([shift={(-0.5\pgflinewidth,0)}]l.west) ;
933 \IfStrEqCase{\bicolortxtsttyle}{%
934 {ellips}%
935 {%
936 \coordinate (lcircn) at ($(l.center)!\bicolortxtdelta!(l.north)$) ;
937 \coordinate (lcirce) at ($(l.center)!\bicolortxtdelta!(l.east)$) ;
938 }%
939 {rect}%
940 {%
941 \coordinate (lrectnw) at ($(l.center)!\bicolortxtdelta!(l.north west)$) ;
942 \coordinate (lrectse) at ($(l.center)!\bicolortxtdelta!(l.south east)$) ;
943 }%
944 {paral}%
945 {%
946 \coordinate (ltrapna) at ($(l.north west)!0.333!(l.north east)$) ;
947 \coordinate (ltrapnb) at ($(l.north west)!0.666!(l.north east)$) ;
948 \coordinate (ltrapsa) at ($(l.south west)!0.333!(l.south east)$) ;
949 \coordinate (ltrapsb) at ($(l.south west)!0.666!(l.south east)$) ;
950 }%
951 }%
952 \begin{scope}
953 \IfStrEqCase{\bicolortxtsttyle}{%
954 {midh}{\clip(ls)rectangle(lnw);\node[\bicolorabove]at(l){#2};}%
955 {midv}{\clip(lnw)rectangle(le);\node[\bicolorabove]at(l){#2};}%
956 {ndiag}{\clip(lnw)--(lne)--(lse)--cycle;\node[\bicolorabove]at(l){#2};}%
957 {sdiag}{\clip(lsw)--(lnw)--(lne)--cycle;\node[\bicolorabove]at(l){#2};}%
958 {ellips}{\clip(lsw)rectangle(lne);\node[\bicolorabove]at(l){#2};}%
959 {rect}{\clip(lsw)rectangle(lne);\node[\bicolorabove]at(l){#2};}%
960 {paral}{\clip(lsw)--(lnw)--(ltrapna)--cycle;\node[{\bicolortrapez[1]}]at(l){#2};}%
961 }%
962 \end{scope}
963 \begin{scope}
964 \IfStrEqCase{\bicolortxtsttyle}{%
965 {midh}{\clip(ls)rectangle(lne);\node[\bicolorbelow]at(l){#2};}%
966 {midv}{\clip(lsw)rectangle(le);\node[\bicolorbelow]at(l){#2};}%
967 {ndiag}{\clip(lsw)--(lnw)--(lse)--cycle;\node[\bicolorbelow]at(l){#2};}%
968 {sdiag}{\clip(lsw)--(lne)--(lse)--cycle;\node[\bicolorbelow]at(l){#2};}%
969 {ellips}{\clip(lsw)rectangle(lne);\pgfpathellipse{\pgfpointanchor{l}{center}}{\pgfpointanchor{lcirce}{center}}{\pgfpointanchor{lcircn}{center}}\pgfusepath{clip}\node[\bicolorbelow]at(l){#2};}%
970 {rect}{\clip(lrectnw)rectangle(lrectse);\node[\bicolorbelow]at(l){#2};}%
971 {paral}{\clip(lsw)--(ltrapna)--(ltrapnb)--(ltrapsa)--cycle;\node[{\bicolortrapez[2]}]at(l){#2};}%
972 }%
973 \end{scope}
974 \IfStrEq{\bicolortxtsttyle}{paral}%
975 {%
976 \begin{scope}%3
977 \clip(ltrapsa)--(ltrapnb)--(lne)--(ltrapsb)--cycle;\node[{\bicolortrapez[3]}]at(l){#2};
978 \end{scope}
979 \begin{scope}%
980 \clip(ltrapsb)--(lne)--(lse)--cycle;\node[{\bicolortrapez[4]}]at(l){#2};
981 \end{scope}
982 }%
983 {}%
984 }%
985 }
986
987 %===CALLOUT
988 \newlength\comicbubblelgt
989 \defKV[comicbubble]{width=\setlength\comicbubblelgt{#1},coltxt=\def\comicbubblecolfont{#1},colbg=\def\comicbubblecolgb{#1},colframe=\def\comicbubblecolframe{#1},pospointer=\def\comicbubblepospointer{#1},font=\def\comicbubblefont{#1}}
990 \setKVdefault[comicbubble]{width=4cm,coltxt=black,colbg={},colframe=black,pospointer=(-150:0.75),font={},rcorners=false}
991
992 \tikzset{comicbubble/.style args={#1#2}{inner sep=1mm,line join=round,rectangle callout,draw,very thick,text width=#1,align=flush center,callout relative pointer=#2}}
993
994 \NewDocumentCommand\tkzcomicbubble{ s O{} D<>{} m }{%
995 \restoreKV[comicbubble]%
996 \setKV[comicbubble]{#2}%
997 \ifboolKV[comicbubble]{rcorners}%
998 {%
999 \tikzset{comicbubble/.append style={rounded corners}}%
1000 }%
1001 {}%
1002 \IfEq{\comicbubblecolgb}{}%
1003 {%
1004 \tikzset{comicbubblebg/.style={}}%
1005 }%
1006 {%
1007 \tikzset{comicbubblebg/.style={fill=\comicbubblecolgb}}%
1008 }%
1009 \IfBooleanTF{#1}%independant macro
1010 {%
1011 \node[comicbubble={\comicbubblelgt}{\comicbubblepospointer},comicbubblebg,text=\comicbubblecolfont,font=\comicbubblefont,#3]{#4}%
1012 }%
1013 {%
1014 {\tikz\node[comicbubble={\comicbubblelgt}{\comicbubblepospointer},comicbubblebg,text=\comicbubblecolfont,font=\comicbubblefont,#3]{#4};}%
1015 }%
1016 }
1017
1018 %====UNDERLINE/SURROUND
1019 \newcommand\calcwidthnodetikz[2]{%
1020 \pgfpointdiff{\pgfpointanchor{#1}{east}}{\pgfpointanchor{#1}{west}}%
1021 \pgf@xa=\pgf@x
1022 \pgf@ya=\pgf@y
1023 % to convert from pt to cm
1024 \pgfmathparse{veclen(\pgf@xa,\pgf@ya)/28.45274}%
1025 \global\let#2\pgfmathresult%
1026 }
1027 \newcommand\calcheightnodetikz[2]{%
1028 \pgfpointdiff{\pgfpointanchor{#1}{south}}{\pgfpointanchor{#1}{north}}%
1029 \pgf@xa=\pgf@x
1030 \pgf@ya=\pgf@y
1031 % to convert from pt to cm
1032 \pgfmathparse{veclen(\pgf@xa,\pgf@ya)/28.45274}%
1033 \global\let#2\pgfmathresult%
1034 }
1035
1036 \newlength\tkzheightunderline
1037 \newlength\tkzheightwidth
1038
1039 \defKV[tkzundersurr]{%
1040 width=\setlength\tkzheightwidth{#1},%
1041 color=\def\tkzsurroundcolor{#1},%
1042 node=\def\tkzsurroundnode{#1},%
1043 height=\setlength\tkzheightunderline{#1}
1044 }
1045 \setKVdefault[tkzundersurr]{%
1046 width=1.25pt,%
1047 color=red,%
1048 node=AAAAZ,%
1049 height=10mm
1050 }
1051
1052 \NewDocumentCommand\tkzsurround{ O{} m }{%
1053 %#1=options
1054 %#2=text
1055 \restoreKV[tkzundersurr]%
1056 \setKV[tkzundersurr]{#1}%
1057 {\tikz[remember picture,baseline=(\tkzsurroundnode.base)]%
1058 {\node[shape=rectangle,inner sep=0pt](\tkzsurroundnode){#2};}%
1059 }%
1060 \begin{tikzpicture}[remember picture,overlay]
1061 \calcwidthnodetikz{\tkzsurroundnode}{\mytmpwidthnode}%
1062 \xdef\offsettmpdecoh{\fpeval{-(0.125+0.15*rand())*\mytmpwidthnode}}%
1063 \xdef\offsettmpdecohb{\fpeval{(0.1+0.25*rand())*\mytmpwidthnode}}%
1064 \path[draw,line width=\tkzheightwidth,\tkzsurroundcolor,{ink[bend]}-{ink[bend]}] plot[smooth] coordinates {%
1065 ([yshift=\fpeval{1.2+0.3*rand()}mm]\tkzsurroundnode.north)
1066 ([xshift=-0.15mm,yshift=0.1mm]\tkzsurroundnode.north west)
1067 ([xshift=-0.1mm,yshift=-0.25mm]\tkzsurroundnode.south west)
1068 ([xshift=-\offsettmpdecoh cm,yshift=-1mm]\tkzsurroundnode.south)
1069 ([yshift=-0.15mm]\tkzsurroundnode.south east)
1070 ([xshift=0.05mm,yshift=0.15mm]\tkzsurroundnode.north east)
1071 ([xshift=\offsettmpdecohb cm,yshift=\fpeval{0.8+0.1*rand()}mm]\tkzsurroundnode.north)
1072 ([xshift=\offsettmpdecoh cm,yshift=\fpeval{-0.1*rand()}mm]\tkzsurroundnode.north)
1073 };%
1074 \end{tikzpicture}%
1075 }
1076
1077 \NewDocumentCommand\tkzunderline{ O{} m }{%
1078 %#1=options
1079 %#4=text
1080 \restoreKV[tkzundersurr]%
1081 \setKV[tkzundersurr]{#1}%
1082 {\tikz[remember picture,baseline=(\tkzsurroundnode.base)]%
1083 {\node[shape=rectangle,inner sep=0pt](\tkzsurroundnode){#2};}%
1084 }%
1085 \begin{tikzpicture}[remember picture,overlay]
1086 \calcwidthnodetikz{\tkzsurroundnode}{\mytmpwidthnode}%
1087 \xdef\offsettmpdecoha{\fpeval{0.25*\mytmpwidthnode}}%
1088 \xdef\offsettmpdecohb{\fpeval{0.175*\mytmpwidthnode}}%
1089 \xdef\offsettmpdecohc{\fpeval{0.1*\mytmpwidthnode}}%
1090 \xdef\offsettmpdecohd{\fpeval{0.005*\mytmpwidthnode}}%
1091 \path[draw,line width=\tkzheightwidth,\tkzsurroundcolor,{ink[bend]}-{ink[bend]}] plot[smooth]
1092 coordinates {%
1093 ([yshift=-0.5\tkzheightwidth]\tkzsurroundnode.south west)
1094 ([yshift=-\tkzheightwidth]\tkzsurroundnode.south east)
1095 ([xshift=-\offsettmpdecoha cm,yshift=-0.15\tkzheightunderline]\tkzsurroundnode.south)
1096 ([xshift=\offsettmpdecohb cm,yshift=-0.275\tkzheightunderline]\tkzsurroundnode.south)
1097 ([xshift=-\offsettmpdecohc cm,yshift=-0.4\tkzheightunderline]\tkzsurroundnode.south)
1098 ([yshift=-0.525\tkzheightunderline]\tkzsurroundnode.south)}
1099 to ([xshift=\offsettmpdecohd cm,yshift=-\tkzheightunderline]\tkzsurroundnode.south) ;
1100 \end{tikzpicture}%
1101 }
1102
1103 %----arrow with fitted text
1104 %data lengths
1105 \newlength\tikzdecoarrowsmallheight
1106 \newlength\tikzdecoarrowbigheight
1107 \newlength\tikzdecoarrowrounded
1108 \newlength\tikzdecoarrowwidth
1109 \newlength\tikzdecoarrowwidtharrow
1110 \newlength\tikzdecoarrowhoffset
1111 \newlength\tikzdecoarrowtextwidth
1112 %data boxes
1113 \newsavebox{\tikzdecoarrowtextvstretch}
1114 \newsavebox{\tikzdecoarrowtexthstretch}
1115
1116 \setlength\tikzdecoarrowhoffset{0.5mm}
1117 \setlength\tikzdecoarrowsmallheight{4mm}
1118 \setlength\tikzdecoarrowbigheight{8mm}
1119 \setlength\tikzdecoarrowrounded{0.05\tikzdecoarrowbigheight}%
1120 \setlength\tikzdecoarrowwidth{2cm}
1121
1122 \defKV[txtarrowfit]{%
1123 color=\colorlet{arrowcolor}{#1},%
1124 txtcolor=\colorlet{arrowtxtcolor}{#1},%
1125 width=\setlength\tikzdecoarrowwidth{#1},%
1126 bheight=\setlength\tikzdecoarrowbigheight{#1},%
1127 sheight=\setlength\tikzdecoarrowsmallheight{#1},%
1128 hoffset=\setlength\tikzdecoarrowhoffset{#1}
1129 }
1130 \setKVdefault[txtarrowfit]{%
1131 color=gray,%
1132 txtcolor=white,%
1133 width=2cm,%
1134 bheight=8mm,%
1135 sheight=4mm,%
1136 hoffset=0.2mm,%
1137 shadow=true,%
1138 shownodes=false,%
1139 expand=false,%
1140 globalwidth=false
1141 }
1142
1143 \tikzset{txtarrow main/.style={rounded corners=\tikzdecoarrowrounded}}
1144 \tikzset{txtarrow shift shadow/.style={xshift=-0.1mm,rotate around={1.5:(arrow-end)}}}
1145 \tikzset{txtarrow shadow/.style={gray,opacity=0.5,rounded corners=\tikzdecoarrowrounded}}
1146
1147 \NewDocumentCommand\tkzfittextinarrow{ O{} D<>{} m }{%
1148 \restoreKV[txtarrowfit]%
1149 \setKV[txtarrowfit]{#1}%
1150 %lengths calc
1151 \ifboolKV[txtarrowfit]{globalwidth}%
1152 {%
1153 \setlength\tikzdecoarrowwidth{\tikzdecoarrowwidth-0.866\tikzdecoarrowbigheight}%
1154 }%
1155 {}%
1156 \savebox{\tikzdecoarrowtextvstretch}{\resizebox*{!}{\tikzdecoarrowsmallheight}{\textcolor{arrowtxtcolor}{#3}}}%
1157 \ifboolKV[txtarrowfit]{expand}%
1158 {%
1159 \savebox{\tikzdecoarrowtexthstretch}{\resizebox*{\dimexpr\tikzdecoarrowwidth+0.866\tikzdecoarrowbigheight-0.866\tikzdecoarrowsmallheight-2\tikzdecoarrowhoffset\relax}{!}{\textcolor{arrowtxtcolor}{#3}}}%
1160 }%
1161 {%
1162 \savebox{\tikzdecoarrowtexthstretch}{\resizebox*{\dimexpr\tikzdecoarrowwidth-2\tikzdecoarrowhoffset\relax}{!}{\textcolor{arrowtxtcolor}{#3}}}%
1163 }%
1164 \settowidth\tikzdecoarrowtextwidth{\usebox{\tikzdecoarrowtextvstretch}}%
1165 \setlength\tikzdecoarrowrounded{0.075\tikzdecoarrowbigheight}%
1166 %tikzpicture
1167 \begin{tikzpicture}[transform shape,#2]
1168 %nodes
1169 \coordinate (arrow-bottomleft) at ({0},{0}) ;
1170 \coordinate (arrow-topleft) at ({0},{\tikzdecoarrowbigheight}) ;
1171 \coordinate (arrow-begin) at ({0},{0.5\tikzdecoarrowbigheight}) ;
1172 \coordinate (arrow-end) at ({\tikzdecoarrowwidth+0.866\tikzdecoarrowbigheight},{0.5\tikzdecoarrowbigheight}) ;
1173 \ifboolKV[txtarrowfit]{expand}%
1174 {%
1175 \coordinate (arrow-textcenter) at ({0.5\tikzdecoarrowwidth+0.433\tikzdecoarrowbigheight-0.433\tikzdecoarrowsmallheight},0.5\tikzdecoarrowbigheight) ;
1176 \coordinate (arrow-textright) at ({\tikzdecoarrowwidth+0.866\tikzdecoarrowbigheight-0.866\tikzdecoarrowsmallheight},0.5\tikzdecoarrowbigheight) ;
1177 }%
1178 {%
1179 \coordinate (arrow-textcenter) at (0.5\tikzdecoarrowwidth,0.5\tikzdecoarrowbigheight) ;
1180 \coordinate (arrow-textright) at (\tikzdecoarrowwidth,0.5\tikzdecoarrowbigheight) ;
1181 }%
1182 \coordinate (arrow-bottom) at ({\tikzdecoarrowwidth},{0}) ;
1183 \coordinate (arrow-top) at ({\tikzdecoarrowwidth},{\tikzdecoarrowbigheight}) ;
1184 \coordinate (arrow-smallbottom) at ({\tikzdecoarrowwidth},{0.5\tikzdecoarrowbigheight-0.5\tikzdecoarrowsmallheight}) ;
1185 \coordinate (arrow-smalltop) at ({\tikzdecoarrowwidth},{0.5\tikzdecoarrowbigheight+0.5\tikzdecoarrowsmallheight}) ;
1186 %shadow arrow
1187 \begin{scope}[txtarrow shift shadow]
1188 \fill[draw=none,txtarrow shadow] (0,0) -- (\tikzdecoarrowwidth,{0.5\tikzdecoarrowbigheight-0.5\tikzdecoarrowsmallheight}) -- (\tikzdecoarrowwidth,0) --++ (0.866\tikzdecoarrowbigheight,0.5\tikzdecoarrowbigheight) --++ (-0.866\tikzdecoarrowbigheight,0.5\tikzdecoarrowbigheight) --++ (0,{-0.5\tikzdecoarrowbigheight+0.5\tikzdecoarrowsmallheight}) -- (0,\tikzdecoarrowbigheight) -- cycle;
1189 \end{scope}
1190 %main arrow
1191 \fill[draw=none,arrowcolor,txtarrow main] (0,0) -- (\tikzdecoarrowwidth,{0.5\tikzdecoarrowbigheight-0.5\tikzdecoarrowsmallheight}) -- (\tikzdecoarrowwidth,0) --++ (0.866\tikzdecoarrowbigheight,0.5\tikzdecoarrowbigheight) --++ (-0.866\tikzdecoarrowbigheight,0.5\tikzdecoarrowbigheight) --++ (0,{-0.5\tikzdecoarrowbigheight+0.5\tikzdecoarrowsmallheight}) -- (0,\tikzdecoarrowbigheight) -- cycle;
1192 %label
1193 \ifboolKV[txtarrowfit]{expand}%
1194 {%
1195 \ifthenelse{\tikzdecoarrowtextwidth < \dimexpr\tikzdecoarrowwidth+0.866\tikzdecoarrowbigheight-0.866\tikzdecoarrowsmallheight-2\tikzdecoarrowhoffset\relax}%
1196 {%width ok
1197 \node[inner sep=0pt,align=center] at (arrow-textcenter) {\usebox{\tikzdecoarrowtextvstretch}} ;
1198 }%
1199 {%width ko => h-stretch
1200 \node[inner sep=0pt,align=center] at (arrow-textcenter) {\usebox{\tikzdecoarrowtexthstretch}} ;
1201 }%
1202 }%
1203 {%
1204 \ifthenelse{\tikzdecoarrowtextwidth < \dimexpr\tikzdecoarrowwidth-2\tikzdecoarrowhoffset\relax}%
1205 {%width ok
1206 \node[inner sep=0pt,align=center] at (arrow-textcenter) {\usebox{\tikzdecoarrowtextvstretch}} ;
1207 }%
1208 {%width ko => h-stretch
1209 \node[inner sep=0pt,align=center] at (arrow-textcenter) {\usebox{\tikzdecoarrowtexthstretch}} ;
1210 }%
1211 }%
1212 %shownodes
1213 \ifboolKV[txtarrowfit]{shownodes}%
1214 {%
1215 \foreach \nodepos in {arrow-bottomleft,arrow-topleft,arrow-begin,arrow-end,arrow-textcenter,arrow-bottom,arrow-textright,arrow-top,arrow-smallbottom,arrow-smalltop}{%
1216 \fill[line width=0.1\tikzdecoarrowrounded,draw=black,fill=red] (\nodepos) circle[radius=0.5\tikzdecoarrowrounded] ;
1217 }
1218 }%
1219 {}%
1220 \end{tikzpicture}%
1221 }
1222
1223 %----freehand simple circled text
1224 \newlength\mytmpwidthfreehandnode
1225 \newlength\mytmpheightfreehandnode
1226 \newlength\mytmpthickfreehandnode
1227
1228 \ExplSyntaxOn
1229 \tl_new:N \c_tikzdecocct_alphabet_tl
1230 \box_new:N \l__tikzdecocct_widest_box
1231 \dim_new:N \l__tikzdecocct_widest_dim
1232 \tl_new:N \l__tikzdecocct_widest_tl
1233 \dim_new:N \mytmpmaxdimfreehandnode
1234
1235 \NewDocumentCommand{\tikzdecocctcomputewidest}{O{}m}
1236 {
1237 \group_begin:
1238 \tl_set:Nn \c_tikzdecocct_alphabet_tl { #2 } %samples characters
1239 #1 % optionally select a font
1240 \dim_zero:N \l__tikzdecocct_widest_dim
1241 \tl_clear:N \l__tikzdecocct_widest_tl
1242 \tl_map_inline:Nn \c_tikzdecocct_alphabet_tl
1243 {
1244 \hbox_set:Nn \l__tikzdecocct_widest_box { ##1 }
1245 \dim_compare:nT { \box_wd:N \l__tikzdecocct_widest_box > \l__tikzdecocct_widest_dim }
1246 {
1247 \dim_set:Nn \l__tikzdecocct_widest_dim { \box_wd:N \l__tikzdecocct_widest_box }
1248 \tl_set:Nn \l__tikzdecocct_widest_tl { ##1 }
1249 }
1250 }
1251 \dim_gset_eq:NN \mytmpmaxdimfreehandnode \l__tikzdecocct_widest_dim
1252 \group_end:
1253 }
1254 \ExplSyntaxOff
1255
1256 \defKV[customcircletxt]{%
1257 height=\setlength\mytmpheightfreehandnode{#1},%
1258 width=\setlength\mytmpwidthfreehandnode{#1},%
1259 fill color=\colorlet{fillcolorcustomcircletxt}{#1},%
1260 rule color=\colorlet{rulecolorcustomcircletxt}{#1},%
1261 thickness=\def\mytmpthicknessfreehandnode{#1},%
1262 absolute thickness=\def\mytmpabsthicknessfreehandnode{#1}
1263 }
1264
1265 \setKVdefault[customcircletxt]{%
1266 height=2em,
1267 width=2.3em,
1268 absolute thickness={},%
1269 thickness=0.05,
1270 fill color=lightgray!30,%
1271 rule color=black,%
1272 rotate=0,
1273 auto=0,
1274 fill=true,%
1275 font={},
1276 vstretch=1.5,%
1277 hoffset=0.8,%
1278 random=false,%
1279 arabic=false,%
1280 alph=false,%
1281 Alph=false
1282 }
1283
1284 \NewDocumentCommand\tkzcircledtxt{O{}D<>{}m}{%
1285 \restoreKV[customcircletxt]%
1286 \setKV[customcircletxt]{#1}%
1287 \ifboolKV[customcircletxt]{random}%
1288 {%
1289 \xdef\mytmprandfreehandnode{\fpeval{randint(5,15)}}%
1290 }%
1291 {%
1292 \def\mytmprandfreehandnode{7}%
1293 }%
1294 \begingroup\useKV[customcircletxt]{font}%
1295 \ifnum\useKV[customcircletxt]{auto}=0\relax%
1296 %thickness
1297 \ifthenelse{\equal{\mytmpabsthicknessfreehandnode}{}}%
1298 {%
1299 \setlength\mytmpthickfreehandnode{\mytmpthicknessfreehandnode\mytmpheightfreehandnode}%
1300 }%
1301 {%
1302 \setlength\mytmpthickfreehandnode{\mytmpabsthicknessfreehandnode}%
1303 }%
1304 %
1305 \begin{tikzpicture}[rotate={\useKV[customcircletxt]{rotate}},line cap=round,#2]
1306 \else%
1307 \settototalheight\mytmpheightfreehandnode{\hbox{0123456789}}%
1308 \tikzdecocctcomputewidest{0123456789}%
1309 \ifboolKV[customcircletxt]{arabic}%samples with 0123456789
1310 {%
1311 \settototalheight\mytmpheightfreehandnode{\hbox{0123456789}}%
1312 \tikzdecocctcomputewidest{0123456789}%
1313 }%
1314 {}%
1315 \ifboolKV[customcircletxt]{alph}%
1316 {%
1317 \settototalheight\mytmpheightfreehandnode{\hbox{abcdefghijklmnopqrstuvwxyz}}%
1318 \tikzdecocctcomputewidest{abcdefghijklmnopqrstuvwxyz}%
1319 }%
1320 {}%
1321 \ifboolKV[customcircletxt]{Alph}%
1322 {%
1323 \settototalheight\mytmpheightfreehandnode{\hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ}}%
1324 \tikzdecocctcomputewidest{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
1325 }%
1326 {}%
1327 \setlength\mytmpheightfreehandnode{\useKV[customcircletxt]{vstretch}\mytmpheightfreehandnode}%
1328 \setlength\mytmpwidthfreehandnode{\fpeval{\useKV[customcircletxt]{auto}+\useKV[customcircletxt]{hoffset}}\mytmpmaxdimfreehandnode}%
1329 %thickness
1330 \ifthenelse{\equal{\mytmpabsthicknessfreehandnode}{}}%
1331 {%
1332 \setlength\mytmpthickfreehandnode{\mytmpthicknessfreehandnode\mytmpheightfreehandnode}%
1333 }%
1334 {%
1335 \setlength\mytmpthickfreehandnode{\mytmpabsthicknessfreehandnode}%
1336 }%
1337 %
1338 \begin{tikzpicture}[rotate={\useKV[customcircletxt]{rotate}},line cap=round,baseline=(ZZZ-TXT.base),#2]
1339 \fi%
1340 \ifboolKV[customcircletxt]{fill}%
1341 {%
1342 %fill bg
1343 \begin{scope}
1344 \fill[fillcolorcustomcircletxt] (0,0.5\mytmpheightfreehandnode) to[out=\fpeval{180-\mytmprandfreehandnode},in=\fpeval{90+\mytmprandfreehandnode}] ++ ({-0.5\mytmpwidthfreehandnode},{-0.5\mytmpheightfreehandnode}) to[out=\fpeval{-90+\mytmprandfreehandnode},in=\fpeval{180+\mytmprandfreehandnode}] ++ ({0.5\mytmpwidthfreehandnode},{-0.5\mytmpheightfreehandnode}) to[out=\mytmprandfreehandnode,in=\fpeval{-90-\mytmprandfreehandnode}] ++ (0.5\mytmpwidthfreehandnode,0.5\mytmpheightfreehandnode) to[out=\fpeval{90-\mytmprandfreehandnode},in=1.5\mytmprandfreehandnode] cycle ;
1345 \end{scope}
1346 }%
1347 {}%
1348 %border
1349 \begin{scope}
1350 \draw[rulecolorcustomcircletxt,line width=\mytmpthickfreehandnode] ([xshift=0.0275\mytmpmaxdimfreehandnode,yshift=\fpeval{-0.75*\mytmpthicknessfreehandnode}\mytmpheightfreehandnode]0,0.5\mytmpheightfreehandnode) to[out=\fpeval{180-\mytmprandfreehandnode},in=\fpeval{90+\mytmprandfreehandnode}] ++ ({-0.5\mytmpwidthfreehandnode},{-0.5\mytmpheightfreehandnode}) to[out=\fpeval{-90+\mytmprandfreehandnode},in=\fpeval{180+\mytmprandfreehandnode}] ++ ({0.5\mytmpwidthfreehandnode},{-0.5\mytmpheightfreehandnode}) to[out=\mytmprandfreehandnode,in=\fpeval{-90-\mytmprandfreehandnode}] ++ (0.5\mytmpwidthfreehandnode,0.5\mytmpheightfreehandnode) to[out=\fpeval{90-\mytmprandfreehandnode},in=\fpeval{1.5*\mytmprandfreehandnode}] ++ ([xshift=-0.155\mytmpwidthfreehandnode,yshift=\fpeval{2*\mytmpthicknessfreehandnode}\mytmpheightfreehandnode]{-0.5\mytmpwidthfreehandnode},{0.5\mytmpheightfreehandnode}) ;
1351 \end{scope}
1352 %node
1353 \begin{scope}
1354 \clip (0,0.5\mytmpheightfreehandnode) to[out=\fpeval{180-\mytmprandfreehandnode},in=\fpeval{90+\mytmprandfreehandnode}] ++ ({-0.5\mytmpwidthfreehandnode},{-0.5\mytmpheightfreehandnode}) to[out=\fpeval{-90+\mytmprandfreehandnode},in=\fpeval{180+\mytmprandfreehandnode}] ++ ({0.5\mytmpwidthfreehandnode},{-0.5\mytmpheightfreehandnode}) to[out=\mytmprandfreehandnode,in=\fpeval{-90-\mytmprandfreehandnode}] ++ (0.5\mytmpwidthfreehandnode,0.5\mytmpheightfreehandnode) to[out=\fpeval{90-\mytmprandfreehandnode},in=-\mytmprandfreehandnode] cycle ;
1355 \node[inner sep=0pt] (ZZZ-TXT) at (0,0) {#3} ;
1356 \end{scope}
1357 \end{tikzpicture}%
1358 \endgroup%
1359 }
1360
1361 %----alphacubes
1362 \newlength\tmpheightalphacubes
1363 \newlength\tmpdepthalphacubes
1364 \newlength\tmpstrutalphacubes
1365 \newsavebox{\tmpalphacubes}
1366
1367 \newcommand\intalphacube[4]{%
1368 \begin{scope}[shift={(#4)}]
1369 \fill[draw=#1!20!black,fill=#1!85!lightgray] (0,1,0)--(1,1,0)--(1,1,1)--(0,1,1)--cycle ;
1370 \fill[draw=#1!20!black,fill=#1!90!lightgray] (0,0,0)--(1,0,0)--(1,1,0)--(0,1,0)--cycle ;
1371 \fill[draw=#1!20!black,fill=#1!65!lightgray] (0,0,0)--(0,1,0)--(0,1,1)--(0,0,1)--cycle ;
1372 \fill[draw=#1!20!black,fill=#1!90!lightgray] (1,0,0)--(1,1,0)--(1,1,1)--(1,0,1)--cycle ;
1373 \fill[draw=#1!20!black,fill=#1!80!lightgray] (0,0,0)--(1,0,0)--(1,0,1)--(0,0,1)--cycle ;
1374 \fill[draw=#1!20!black,fill=#1!85!lightgray] (0,0,1)--(1,0,1)--(1,1,1)--(0,1,1)--cycle ;
1375 \begin{scope}[canvas is xz plane at y=0]
1376 \draw[] ([xshift=-0.2pt,yshift=0.2pt]0.5,0.5) node[font=\cubealphabetfont,text=#1!25!black] {#2} ;
1377 \draw[] (0.5,0.5,1) node[font=\cubealphabetfont,text=#3] {#2} ;
1378 \end{scope}
1379 \end{scope}
1380 }
1381
1382 \newcommand\intalphablocks{%
1383 \foreach \i in {1,...,\listelettrescubealphalen}{%
1384 \xdef\j{\inteval{\listelettrescubealphalen-\i+1}}%
1385 \itemtomacro\listelettrescubealpha[\j,1]\tmplettre%
1386 \itemtomacro\listelettrescubealpha[\j,2]\tmpcouleur%
1387 \itemtomacro\listelettrescubealpha[\j,3]\tmpcouleurlettre%
1388 \ifthenelse{\equal{\tmplettre}{*}}%
1389 {%
1390 \xdef\tmpalphacubesnbofstars{\inteval{\tmpalphacubesnbofstars+1}}%
1391 }%
1392 {%
1393 \xdef\k{\fpeval{\j+\tmpalphacubesnbofstars*(1-(\cubealphabetspacestretch))}}%
1394 \intalphacube{\tmpcouleur}{\tmplettre}{\tmpcouleurlettre}{{(\cubealphabethstretch)*\k},0,0}%
1395 }%
1396 }%
1397 }
1398
1399 \defKV[cubealphabet]{%
1400 hstretch=\def\cubealphabethstretch{#1},%
1401 spacestretch=\def\cubealphabetspacestretch{#1},%
1402 dstrut=\def\cubealphabetdstrut{#1},%
1403 strut=\def\cubealphabetstrut{#1},%
1404 font=\def\cubealphabetfont{#1},%
1405 height=\def\cubealphabetheight{#1}
1406 }
1407 \setKVdefault[cubealphabet]{%
1408 hstretch=1.05,%
1409 spacestretch=0.25,
1410 dstrut={qH},%
1411 strut={H},
1412 font=\huge\bfseries\sffamily,%
1413 height=dauto
1414 }
1415
1416 \NewDocumentCommand\tkzletterblock{ O{} D<>{} m }{%
1417 \setsepchar[.]{,./}%
1418 \readlist*\listelettrescubealpha{#3}%
1419 \restoreKV[cubealphabet]%
1420 \setKV[cubealphabet]{#1}%
1421 \sbox{\tmpalphacubes}{%
1422 \def\tmpalphacubesnbofstars{0}%
1423 \def\tmpcubealphabetscale{1}%
1424 \tdplotsetmaincoords{80}{-10}\unskip\unskip%
1425 \begin{tikzpicture}[scale=\tmpcubealphabetscale,line join=round,rounded corners=\fpeval{\tmpcubealphabetscale*0.5}mm,line width=\fpeval{\tmpcubealphabetscale*0.2}mm,transform shape,tdplot_main_coords,#2]%
1426 \intalphablocks
1427 \end{tikzpicture}%
1428 }%
1429 \settoboxtotalheight\tmpheightalphacubes{\tmpalphacubes}%
1430 %height dauto / auto / manual
1431 \ifthenelse{\equal{\cubealphabetheight}{dauto}}%
1432 {%dauto
1433 \def\tmpalphacubesnbofstars{0}%
1434 \settototalheight\tmpstrutalphacubes{\hbox{\cubealphabetdstrut}}%
1435 \settodepth\tmpdepthalphacubes{\hbox{\cubealphabetdstrut}}%
1436 \xdef\tmpcubealphabetscale{\fpeval{\tmpstrutalphacubes/\tmpheightalphacubes}}%
1437 \raisebox{-\tmpdepthalphacubes}{%
1438 \tdplotsetmaincoords{80}{-10}\unskip\unskip%
1439 \begin{tikzpicture}[scale=\tmpcubealphabetscale,line join=round,rounded corners=\fpeval{\tmpcubealphabetscale*0.5}mm,line width=\fpeval{\tmpcubealphabetscale*0.2}mm,transform shape,tdplot_main_coords]%
1440 \intalphablocks
1441 \end{tikzpicture}%
1442 }%
1443 }%
1444 {%auto
1445 \ifthenelse{\equal{\cubealphabetheight}{auto}}%
1446 {%
1447 \def\tmpalphacubesnbofstars{0}%
1448 \settototalheight\tmpstrutalphacubes{\hbox{\cubealphabetstrut}}%
1449 \xdef\tmpcubealphabetscale{\fpeval{\tmpstrutalphacubes/\tmpheightalphacubes}}%
1450 \tdplotsetmaincoords{80}{-10}\unskip\unskip%
1451 \begin{tikzpicture}[scale=\tmpcubealphabetscale,line join=round,rounded corners=\fpeval{\tmpcubealphabetscale*0.5}mm,line width=\fpeval{\tmpcubealphabetscale*0.2}mm,transform shape,tdplot_main_coords]%
1452 \intalphablocks
1453 \end{tikzpicture}%
1454 }%
1455 {%manual
1456 \def\tmpalphacubesnbofstars{0}%
1457 \setlength\tmpstrutalphacubes{\cubealphabetheight}%
1458 \xdef\tmpcubealphabetscale{\fpeval{\tmpstrutalphacubes/\tmpheightalphacubes}}%
1459 \tdplotsetmaincoords{80}{-10}\unskip\unskip%
1460 \begin{tikzpicture}[scale=\tmpcubealphabetscale,line join=round,rounded corners=\fpeval{\tmpcubealphabetscale*0.5}mm,line width=\fpeval{\tmpcubealphabetscale*0.2}mm,transform shape,tdplot_main_coords]%
1461 \intalphablocks
1462 \end{tikzpicture}%
1463 }%
1464 }%
1465 }
1466
1467 %----ulinewithpen
1468 \newlength\totaheightulinepen
1469 \newlength\voffsetulinepen
1470 \newlength\hoffsetulinepen
1471 \newlength\thicknessulinepen
1472 \setlength\thicknessulinepen{0.8pt}
1473
1474 \defKV[penuline]{%
1475 thick=\setlength\thicknessulinepen{#1},%
1476 color=\def\colorulinepen{#1},%
1477 chardepth=\def\chardepthulinepen{#1},%
1478 vstretchoffset=\def\vstretchoffsetuline{#1},%
1479 scale=\def\scaleuline{#1}
1480 }
1481 \setKVdefault[penuline]{%
1482 thick=0.8pt,%
1483 color={},%
1484 chardepth={(AZERTUIOPQSDFGHJKLMWXCVBNazertyuiopqsdfghjklmwxcvbn)},%
1485 vstretchoffset={0.5},%
1486 scale=1,%
1487 swap=false
1488 }
1489
1490 \tikzset{ulinewithpen/.style={line width=0.35pt}}
1491
1492 \newcommand\intpen{%
1493 \filldraw[ulinewithpen,line join=bevel] (0,0) -- ({0.017\totaheightulinepen},{0.035\totaheightulinepen}) -- ({-0.017\totaheightulinepen},{0.035\totaheightulinepen}) -- cycle ;
1494 \filldraw[ulinewithpen,line join=bevel] ({0.085\totaheightulinepen},{0.175\totaheightulinepen}) -- ({0.085\totaheightulinepen},{0.8\totaheightulinepen}) -- ({-0.085\totaheightulinepen},{0.8\totaheightulinepen}) -- ({-0.085\totaheightulinepen},{0.175\totaheightulinepen}) --++ ({0.0425\totaheightulinepen},{0.035\totaheightulinepen}) --++ ({0.0425\totaheightulinepen},{-0.07\totaheightulinepen}) --++ ({0.0425\totaheightulinepen},{0.07\totaheightulinepen}) --++ ({0.0425\totaheightulinepen},{-0.035\totaheightulinepen}) ;
1495 \draw[ulinewithpen] (0,0) -- ({0.085\totaheightulinepen},{0.175\totaheightulinepen}) -- ({0.085\totaheightulinepen},{0.8\totaheightulinepen}) -- ({-0.085\totaheightulinepen},{0.8\totaheightulinepen}) -- ({-0.085\totaheightulinepen},{0.175\totaheightulinepen}) -- cycle ;
1496 \filldraw[ulinewithpen,line join=rect] ([yshift=0.85pt]{0.085\totaheightulinepen},{0.8\totaheightulinepen}) -- ({0.085\totaheightulinepen},{0.925\totaheightulinepen}) to[out=90,in=90]++ ({-0.17\totaheightulinepen},{0}) -- ([yshift=0.85pt]{-0.085\totaheightulinepen},{0.8\totaheightulinepen}) -- cycle ;
1497 }
1498 \newcommand\intphantompenuline[1][]{%
1499 \begin{tikzpicture}[\colorulinepen]
1500 \begin{scope}[rotate=42.5,scale=\scaleuline]
1501 \intpen
1502 \end{scope}
1503 \end{tikzpicture}%
1504 }
1505
1506 \newcommand\intpenuline[1][]{%
1507 \ifboolKV[penuline]{swap}%
1508 {%
1509 \xdef\anglepenuline{\fpeval{180-42.5}}%
1510 }%
1511 {%
1512 \xdef\anglepenuline{42.5}%
1513 }%
1514 \begin{tikzpicture}[remember picture,overlay,\colorulinepen]
1515 \begin{scope}[shift={([yshift={\fpeval{1-\vstretchoffsetuline}\voffsetulinepen}]AAAAZZY.south west)},rotate=\anglepenuline,scale=\scaleuline]
1516 \intpen
1517 \end{scope}
1518 \draw[line width=\thicknessulinepen,line cap=round] ([yshift=\fpeval{1-\vstretchoffsetuline}\voffsetulinepen]AAAAZZY.south west) -- ([yshift=\fpeval{1-\vstretchoffsetuline}\voffsetulinepen]AAAAZZY.south east) ;
1519 \end{tikzpicture}%
1520 }
1521
1522 \newcommand\phantomulinewithpen{\hspace*{\hoffsetulinepen}}%
1523
1524 \NewDocumentCommand\ulinewithpen{ O{} m }{%
1525 \restoreKV[penuline]%
1526 \setKV[penuline]{#1}%
1527 \settototalheight\totaheightulinepen{\chardepthulinepen#2}%
1528 \settodepth\voffsetulinepen{\chardepthulinepen#2}%
1529 \settowidth\hoffsetulinepen{\intphantompenuline}%
1530 \global\hoffsetulinepen=\hoffsetulinepen%
1531 \hphantom{\intphantompenuline}%
1532 {\tikz[remember picture,baseline=(AAAAZZY.base)] {\node[shape=rectangle,inner sep=0pt](AAAAZZY){\vphantom{\chardepthulinepen}#2};}%
1533 }%
1534 \intpenuline%
1535 }
1536 \NewCommandCopy\tkzunderlinepen\ulinewithpen
1537
1538 \endinput