% !TEX TS-program = XeLaTeX


% This code by Chris Staecker, released to public domain. 
%You are free to do whatever you want with it.

\documentclass{article}
\usepackage{nopageno}
\usepackage[margin=0.25in]{geometry}
\usepackage{qrcode}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{patterns,patterns.meta}


% Uses the copperplate font, download here: https://www.dafontfree.co/copperplate-font/
\usepackage{fontspec}
\setmainfont[]{OPTICopperplate-Light}


% arcs on chart: args are # of arcs, angle offset, and draw options
\newcommand{\makearcs}[3]{
\pgfmathsetmacro{\k}{#1-1}
\foreach \a in {0,...,\k} {
	\draw[#3] ({(360/#1)*\a+#2}:\innerrad) to[bend left=10] ({(360/#1)*\a+#2+.8}:\outerrad);
  }
}

\newcommand{\timelabel}[2]{
\node[rotate={#1-90},align=center,scale=\textscale] at (#1:\outerrad+\timepad) {#2};
}

\newcommand{\tikzscale}{1}

% these all measured by hand
\newcommand{\paperrad}{5.5cm} % radius of entire paper
\newcommand{\outerrad}{4.82cm} % outside ring of chart
\newcommand{\innerrad}{1.5cm} % inside ring of chart
\newcommand{\cutoutrad}{.72cm}
\newcommand{\cutoutheight}{.38cm} % measured from center
\newcommand{\tenthickness}{.221333cm} % thickness of radial 10s divisions
\newcommand{\timepad}{\tenthickness * 1.5} % radial distance from outerrad to center of "6AM" label
\newcommand{\shaderad}{\outerrad + \tenthickness*2} % radius from center to outer edge of shading
\newcommand{\shadeoffset}{7} % angle of shade offsets
\newcommand{\textscale}{.5}
\newcommand{\numbertextscale}{.4}


\newcommand{\chart}[1]{
\begin{scope}[shift={#1}]

\draw (0,0) circle (\paperrad);
\draw (0,0) circle (\outerrad);
\draw (0,0) circle (\innerrad);
%\draw (0,0) circle (\cutoutrad);

% inner rectangle
\begin{scope}
\clip (-\innerrad, -\cutoutheight) rectangle (\innerrad, \cutoutheight);
\draw (0,0) circle (\cutoutrad);
\end{scope}
\begin{scope}
\clip (0,0) circle (\cutoutrad);
\draw (-\innerrad, -\cutoutheight) rectangle (\innerrad, \cutoutheight);
\end{scope}

\node at (0,0) {$\times$};

% thick circles
\foreach \r in {-3,-2,...,12} {
 \draw[thick] (0,0) circle ({\innerrad + (\r +3)*\tenthickness});
}
% thin circles
\foreach \r in {-3,-2.5,...,12} {
 \draw[] (0,0) circle ({\innerrad + (\r +3)*\tenthickness});
}


% arcs on chart
\makearcs{24}{12.85}{thick}
\makearcs{48}{12.85}{thin}
\makearcs{96}{12.85}{very thin}


% number labels along arcs
\foreach \a in {0,...,5} {
 \foreach \r in {-3,-1,...,11} {
  \pgfmathsetmacro{\rlabel}{int((9-\r)*10)}
  \pgfmathsetmacro{\ang}{(360/6)*\a+12.85}
  \path (\ang:\innerrad) to[bend left=10] 
  coordinate[pos={(\r+3)/15}] (C)    % grab locations along the arc- in polar coords these have slightly wrong radius
  ({\ang+.8}:\outerrad);
  
  % use angle from points as above, calculate appropriate radius
  \draw let \p1=(C) in ({atan2(\y1,\x1)}:{\innerrad + (\r+3)*\tenthickness}) node[fill=white,rotate={\ang-90},scale=\numbertextscale] {\rlabel};
}
}

% arched shaded regions
\foreach \a in {0,...,5} {
  \pgfmathsetmacro{\ang}{(180/6)*\a}
  \draw[pattern={Dots[angle=45,radius={.2pt},distance={1pt}]}] (\ang+\shadeoffset:\shaderad) arc (\ang+\shadeoffset:\ang+180/6-\shadeoffset:\shaderad) -- (\ang+180/6-\shadeoffset:\shaderad-\tenthickness) arc (\ang+180/6-\shadeoffset:\ang+\shadeoffset:\shaderad-\tenthickness) -- cycle; 
}

%% time labels
\timelabel{0}{6 A.M.\\06 00}
\timelabel{360/12*1}{4 A.M.\\04 00}
\timelabel{360/12*2}{2 A.M.\\02 00}
\timelabel{360/12*3}{MIDNIGHT\\24 00}
\timelabel{360/12*4}{10 P.M.\\22 00}
\timelabel{360/12*5}{8 P.M.\\20 00}
\timelabel{360/12*6}{6 P.M.\\18 00}
\timelabel{360/12*7}{4 P.M.\\16 00}
\timelabel{360/12*8}{2 P.M.\\14 00}
\timelabel{360/12*9}{NOON \\12 00}
\timelabel{360/12*10}{10 A.M.\\10 00}
\timelabel{360/12*11}{8 A.M.\\08 00}

% middle text
\node[align=center,scale=\textscale] at (0,-\cutoutheight*2) {fits tempscribe\textsuperscript{\textregistered}\\ chart 14-0045};

% deg fahr text
\node[align=center,scale=\textscale*.8] at (-\innerrad*.8, 0) {deg.\\fahr.};
\end{scope}
}

\begin{document}

\begin{tikzpicture}[scale=\tikzscale,transform shape]
\chart{(0,0)}
\chart{(9,-7)}
\chart{(0,-14)}
\node[align=center,scale=1,execute at begin node=\setlength{\baselineskip}{5ex}] at (9,3) {These charts made by Chris Staecker.\\Get more here:\\ \\ \qrcode{https://cstaecker.fairfield.edu/~cstaecker/machines/tempscribe.html}};
\end{tikzpicture}

\end{document}