%!TEX pdflatex
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz,pgf}
\usepackage{simplekv}
\usepackage{calc}
\usepackage{xstring}
\usepackage{codehigh}
\usetikzlibrary{bbox,calc}
\defKV[tkzArrowBullsEye]{%
height=\def\heightarrowbullseye{#1},%
maincolor=\def\colorarrowbullseye{#1}
}
\setKVdefault[tkzArrowBullsEye]{%
height=auto,%
maincolor={},%
colors=false
}
\newcommand\inttkzArrowBullsEye{
\draw (54:2.25) arc (54:396:2.25) (0,0) circle[radius=0.6] (0,0) circle[radius=1.36] ;
\draw[line cap=round,line join=round] (0,0)--(45:1.7) -- (55:2.5) -- (52:3.5) -- (45:3.1) -- (38:3.5) -- (35:2.5) -- (45:1.7) -- cycle;
}
\newcommand\intcolortkzArrowBullsEye{
\filldraw[black,fill=blue!50!cyan] (0,0) circle[radius=2.25] ;%
\filldraw[black,fill=red] (0,0) circle[radius=1.36] ;
\filldraw[black,fill=yellow] (0,0) circle[radius=0.6] ;
\draw[black,fill=white,line cap=round,line join=round] (0,0)--(45:1.7) -- (55:2.5) -- (52:3.5) -- (45:3.1) -- (38:3.5) -- (35:2.5) -- (45:1.7) -- cycle;
}
\def\calcheightofchars{B}
\def\calctotheightofchars{qB}
\def\calcdepthofchars{qB}
\newlength\totheightarrowbullseye
\newlength\depthbullseye
\NewDocumentCommand\tkzBullsEyeArrow{ s O{} m }{%
%* = depth or not
%#2 = keys
%#3 = tikz options
\restoreKV[tkzArrowBullsEye]%
\setKV[tkzArrowBullsEye]{#2}%
%scale
\IfStrEq{\heightarrowbullseye}{auto}%
{%
\IfBooleanTF{#1}%
{%without depth
\settototalheight\totheightarrowbullseye{\hbox{\calcheightofchars}}%
}%
{%with
\settototalheight\totheightarrowbullseye{\hbox{\calctotheightofchars}}%
\settodepth\depthbullseye{\hbox{\calcdepthofchars}}%
}%
}%
{%
\setlength\totheightarrowbullseye{\heightarrowbullseye}%
}%
%scale + style
\pgfmathsetmacro{\tikzarrowbullseyescale}{\totheightarrowbullseye/53mm}%
\tikzset{tkzarrowbullseye/.style={scale=\tikzarrowbullseyescale,line width=\fpeval{2.75*\tikzarrowbullseyescale}mm,bezier bounding box}}%
%arrow
\IfStrEq{\heightarrowbullseye}{auto}%
{%
\IfBooleanTF{#1}%
{%without depth
\begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#3]
\ifboolKV[tkzArrowBullsEye]{colors}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye}
\end{tikzpicture}%
}%
{%with
\raisebox{-\depthbullseye}{%
\begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#3]
\ifboolKV[tkzArrowBullsEye]{colors}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye}
\end{tikzpicture}%
}%
}%
}%
{%
\begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#3]
\ifboolKV[tkzArrowBullsEye]{colors}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye}
\end{tikzpicture}%
}%
}
\begin{document}
\textbf{\footnotesize Licence Etalab 2.0}
\vspace*{1cm}
\begin{codehigh}
\tkzBullsEyeArrow(*)%version étoilée := sans profondeur si height=auto
[height='auto ou longueur',maincolor='couleur',colors=TF]%
{options tikz}
\end{codehigh}
\begin{demohigh}
Hauteur fixée :=%
{\tikz\draw (0,0) grid (1,3);}%
\tkzBullsEyeArrow[height=3cm,maincolor=red]{}%
\tkzBullsEyeArrow[height=2cm,maincolor=blue]{rotate=90}%
\tkzBullsEyeArrow[height=1cm,colors]{rotate=-90}%
{\tikz\draw (0,0) grid (1,3);}
\end{demohigh}
\begin{demohigh}
Un essai q\tkzBullsEyeArrow{}\tkzBullsEyeArrow*{}B en ligne.
\end{demohigh}
\begin{demohigh}
{\Huge\sffamily\textcolor{orange}{Un essai q\tkzBullsEyeArrow{}\tkzBullsEyeArrow*{}B en ligne.}}
\end{demohigh}
\begin{demohigh}
{\LARGE\ttfamily\textcolor{cyan}{Un essai q\tkzBullsEyeArrow{}\tkzBullsEyeArrow*{}B en ligne.}}
\end{demohigh}
\begin{demohigh}
\scalebox{5}[5]{q\tkzBullsEyeArrow[maincolor=orange]{}\tkzBullsEyeArrow*[colors]{}B}
\end{demohigh}
\end{document}