Looking for a way to add a custom line cap (slight bulbous) like one would get when inking a line on real paper.
1 Answer
Can one add such arrow tips? Sure. Am I sure that my proposal is the best inky tip ever? Absolutely not. However, this should give you an idea how to approach the "best inky tip ever". ;-)
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\pgfdeclarearrow{
name=ink,
parameters= {\the\pgfarrowlength},
setup code={
\pgfarrowssettipend{0pt}
\pgfarrowssetlineend{-\pgfarrowlength}
\pgfarrowlinewidth=\pgflinewidth
\pgfarrowssavethe\pgfarrowlength
},
drawing code={
\pgfpathmoveto{\pgfpoint{-\pgfarrowlength}{0.5\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.75\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{-0.01\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{0pt}{0pt}}
\pgfpathcurveto{\pgfpoint{-0.01\pgfarrowlength}{-0.5\pgflinewidth}}{%
\pgfpoint{-0.05\pgfarrowlength}{-0.95\pgflinewidth}}{%
\pgfpoint{-0.2\pgfarrowlength}{-0.9\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.3\pgfarrowlength}{-0.8\pgflinewidth}}{%
\pgfpoint{-0.6\pgfarrowlength}{-0.55\pgflinewidth}}{%
\pgfpoint{-01\pgfarrowlength}{-0.5\pgflinewidth}}
\pgfusepathqfill
},
defaults = { length = 12pt }
}
\begin{document}
\begin{tikzpicture}
\draw [line width=1mm,{ink[bend]}-{ink[bend]},blue!80!black] (0,0) to [bend left] (3,0);
\end{tikzpicture}
\end{document}
Or, if you wish to have a more pronounced tip, this can also be done.
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\pgfdeclarearrow{
name=ink,
parameters= {\the\pgfarrowlength},
setup code={
\pgfarrowssettipend{0pt}
\pgfarrowssetlineend{-\pgfarrowlength}
\pgfarrowlinewidth=\pgflinewidth
\pgfarrowssavethe\pgfarrowlength
},
drawing code={
\pgfpathmoveto{\pgfpoint{-\pgfarrowlength}{0.5\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.75\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{-0.01\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{0pt}{0pt}}
\pgfpathcurveto{\pgfpoint{-0.01\pgfarrowlength}{-0.5\pgflinewidth}}{%
\pgfpoint{-0.2\pgfarrowlength}{-1.35\pgflinewidth}}{%
\pgfpoint{-0.3\pgfarrowlength}{-1.1\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.4\pgfarrowlength}{-0.8\pgflinewidth}}{%
\pgfpoint{-0.6\pgfarrowlength}{-0.55\pgflinewidth}}{%
\pgfpoint{-01\pgfarrowlength}{-0.5\pgflinewidth}}
\pgfusepathqfill
},
defaults = { length = 12pt }
}
\begin{document}
\begin{tikzpicture}
\draw [line width=1mm,{ink[bend]}-{ink[bend]},blue!80!black] (0,0) to [bend left] (3,0);
\end{tikzpicture}
\end{document}
And one could also add some randomness.
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\pgfdeclarearrow{
name=ink,
parameters= {\the\pgfarrowlength},
setup code={
\pgfarrowssettipend{0pt}
\pgfarrowssetlineend{-\pgfarrowlength}
\pgfarrowlinewidth=\pgflinewidth
\pgfarrowssavethe\pgfarrowlength
},
drawing code={
\pgfpathmoveto{\pgfpoint{-\pgfarrowlength}{0.5\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.75\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{-0.01\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{0pt}{0pt}}
\pgfpathcurveto{\pgfpoint{-0.01\pgfarrowlength}{-0.5\pgflinewidth}}{%
\pgfpoint{-0.2\pgfarrowlength}{-(1+0.3*rnd)*\pgflinewidth}}{%
\pgfpoint{-0.3\pgfarrowlength}{-0.8*(1+0.3*rnd)*\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.4\pgfarrowlength}{-0.6*(1+0.3*rnd)*\pgflinewidth}}{%
\pgfpoint{-0.6\pgfarrowlength}{-0.3*(1+0.3*rnd)*\pgflinewidth}}{%
\pgfpoint{-1\pgfarrowlength}{-0.5\pgflinewidth}}
\pgfusepathqfill
},
defaults = { length = 12pt }
}
\begin{document}
\begin{tikzpicture}
\draw [line width=1mm,{ink[bend]}-{ink[bend]},blue!80!black] (0,0) to [bend left] (3,0);
\end{tikzpicture}
\end{document}
BONUS: Some quick and dirty "inky" letters.
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\usetikzlibrary{positioning}
\pgfdeclarearrow{
name=ink,
parameters= {\the\pgfarrowlength},
setup code={
\pgfarrowssettipend{0pt}
\pgfarrowssetlineend{-\pgfarrowlength}
\pgfarrowlinewidth=\pgflinewidth
\pgfarrowssavethe\pgfarrowlength
},
drawing code={
\pgfpathmoveto{\pgfpoint{-\pgfarrowlength}{0.5\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.75\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{-0.01\pgfarrowlength}{0.6\pgflinewidth}}{%
\pgfpoint{0pt}{0pt}}
\pgfpathcurveto{\pgfpoint{-0.01\pgfarrowlength}{-0.5\pgflinewidth}}{%
\pgfpoint{-0.2\pgfarrowlength}{-(1+0.3*rnd)*\pgflinewidth}}{%
\pgfpoint{-0.3\pgfarrowlength}{-0.8*(1+0.3*rnd)*\pgflinewidth}}
\pgfpathcurveto{\pgfpoint{-0.4\pgfarrowlength}{-0.6*(1+0.3*rnd)*\pgflinewidth}}{%
\pgfpoint{-0.6\pgfarrowlength}{-0.3*(1+0.3*rnd)*\pgflinewidth}}{%
\pgfpoint{-1\pgfarrowlength}{-0.5\pgflinewidth}}
\pgfusepathqfill
},
defaults = { length = 12pt }
}
\begin{document}
\tikzset{pics/.cd,
A/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,-0.55) -- (0.3,0.4) -- (0.6,-0.55);
\draw[line width=5](0.1,1/3-0.45) --
(0.5,1/3-0.45);
\path (0.7,0);}},
B/.style={code={\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;}},
C/.style={code={\draw[line width=5,-{ink[bend]}]
(0,0) to[out=90,in=110,looseness=2] (0.5,0.25);
\draw[line width=5,-{ink[bend]}](0,0) to[out=-90,in=-110,looseness=2] (0.5,-0.25);
\path (0.7,0);}},
D/.style={code={\draw[line width=5] (0,-0.45) -- (0,0.45)
to[out=0,in=0,looseness=2.25] cycle;
\path (0.7,0);}},
E/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0.5,-0.45) --(0,-0.45) -- (0,0.45) -- (0.5,0.45);
\draw[line width=5,-{ink[bend]}] (0,0) -- (0.5,0);
\path (0.7,0);}},
F/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,-0.45) -- (0,0.45) -- (0.5,0.45);
\draw[line width=5,-{ink[bend]}] (0,0) -- (0.5,0);
\path (0.7,0);}},
G/.style={code={\draw[line width=5,-{ink[bend]}]
(0,0) to[out=90,in=110,looseness=2] (0.5,0.25);
\draw[line width=5] (0,0) to[out=-90,in=-110,looseness=2]
(0.5,-0.25);
\draw[line width=5,-{ink[bend]}] (0.54,-0.25) to (0.3,-0.25);
\path (0.7,0);}},
H/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,-0.5) -- (0,0.5);
\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.5,-0.5) -- (0.5,0.5);
\draw[line width=5] (0,0) -- (0.5,0);
\path (0.7,0);}},
I/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45);
\path (0.25,0);}},
J/.style={code={\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);
\path (0.45,0);}},
K/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,-0.45) -- (0,0.45);
\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.4,0.45) -- (0.02,0) -- (0.4,-0.45);
\path (0.6,0);}},
L/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,0.5) -- (0,-0.45) -- (0.4,-0.45);
\path (0.6,0);}},
M/.style={code={\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);
\path (0.8,0);}},
N/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,-0.45) -- (0,0.45) -- (0.6,-0.4) --
(0.6,0.45);
\path (0.8,0);}},
O/.style={code={\draw[line width=5] (0.3,0) circle(0.3 and 0.48);
\path (0.8,0);}},
P/.style={code={\draw[line width=5,{ink[bend]}-] (0,-0.45) -- (0,0.45)
to[out=0,in=0,looseness=2.5] (0,0);
\path (0.6,0);}},
Q/.style={code={\draw[line width=5]
(0.3,0) circle(0.3 and 0.48);
\draw[line width=5,{ink[bend]}-{ink[bend]}](0.35,-0.25) -- (0.6,-0.45);
\path (0.8,0);}},
R/.style={code={\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);
\path (0.6,0);}},
S/.style={code={\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);
\path (0.65,0);}},
T/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.35,-0.45) -- (0.35,0.45) (0,0.45) -- (0.7,0.45);
\path (0.85,0);}},
U/.style={code={\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);
\path (0.8,0);}},
V/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.5) -- (0.3,-0.4) -- (0.6,0.5);
\path (0.8,0);}},
W/.style={code={\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);
\path (1.1,0);}},
X/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,0.45) -- (0.6,-0.45);
\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.6,0.45)
-- (0,-0.45);
\path (0.8,0);}},
Y/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}]
(0,0.45) -- (0.3,0);
\draw[line width=5,{ink[bend]}-{ink[bend]}] (0.6,0.45)
-- (0,-0.45);
\path (0.8,0);}},
Z/.style={code={\draw[line width=5,{ink[bend]}-{ink[bend]}] (0,0.45) --(0.6,0.45) -- (0,-0.45)
-- (0.6,-0.45);
\path (0.8,0);}},
space/.style={code={\path (0,0) (0.2,0);}},
}
\begin{tikzpicture}[blue!80!black]
\pic[local bounding box=box1,scale=2] at (0,0) {A};
\foreach \X [count=\Y,evaluate=\Y as \Z using {int(\Y+1)}] in {B,...,Z}
{\edef\temp{\noexpand\pic[right=0mm of box\Y,local bounding box=box\Z,scale=2]
{\X};}
\temp}
\end{tikzpicture}
\end{document}
(Yes, obviously these are not at all as beautiful as dedicated fonts. However, one can subject them to nonlinear transformation, such as those of this impressive master piece. I spare this application for another day. Also because arrow tips and nonlinear transformations require some extra work.)
-
Wow, perfect thank you! And, in my book, those would count as some pretty perfect inky tips to me. Nov 19, 2018 at 23:31
-
How to convert your font such that it becomes install-able on my machine? Nov 20, 2018 at 6:07
-
@ArtificialStupidity There is no font that you need to install. You can compile the code on your machine, I think, without adding anything e.g. with
pdflatex
. And there is no font, I just drew the characters (very quickly and in a very dirty way) with TikZ. And since this is no font, you can not do anything sophisticated with it, in particular not typeset any formulae, which TeX is originally made for. The only conceivable use of this is that you can subject the "characters" to nontrivial transformations.– user121799Nov 20, 2018 at 6:15 -
@marmot: My idea is to create a font with TikZ and use it everywhere. :-) Nov 20, 2018 at 6:34