From 8ea9c8fc9ada2f8031b10d7dfb1a132a2ecf33e1 Mon Sep 17 00:00:00 2001
From: Holden Rohrer <hr@hrhr.dev>
Date: Sat, 27 Feb 2021 02:19:57 -0500
Subject: created this nicely formatted background guide; didn't do the writing

---
 font.tex | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 font.tex

(limited to 'font.tex')

diff --git a/font.tex b/font.tex
new file mode 100644
index 0000000..f7d69e0
--- /dev/null
+++ b/font.tex
@@ -0,0 +1,49 @@
+%% Fonts
+\newcount\thespacing
+\newdimen\size
+\begingroup
+  \edef\specialAt{{ \string a\string t }}%
+  \def\x#1{%
+    \def\getfontsize##1=##2{% The user level macro
+      \expandafter\getfontsizE\fontname##2#1\relax{##1}%
+    }%
+    \def\getfontsizE##1#1##2\relax##3{%
+      {\def\tmp{##2}\expandafter}%
+      \ifx\tmp\empty % empty #2 = Loaded at designsize
+        \begingroup
+          \font\tmpfont"##1" scaled 2000
+          \getfontsize\dimen0=\tmpfont
+          \divide\dimen0 by 2
+          \expandafter
+        \endgroup
+        \expandafter\getfontsiZe\the\dimen0\relax{##3}%
+      \else% Otherwise #2 holds the size. But is is followed by " at ", so we have to strip that
+        \getfontsiZE{##3}##2%
+      \fi
+    }%
+    \def\getfontsiZE##1##2#1{##1=##2}% Strip " at "
+    \def\getfontsiZe##1\relax##2{##2=##1}%
+  }%
+  \expandafter\expandafter\expandafter
+\endgroup
+\expandafter\x\specialAt % From StackOverflow
+{
+\catcode`\@=11
+
+\global\let\f@nt\font
+
+\gdef\spacing{\afterassignment\adjs \thespacing}
+\gdef\adjs{%adjust spacing
+    \baselineskip=\size \multiply\baselineskip by \thespacing
+    \divide\baselineskip by 100\relax}
+
+\gdef\font#1{%
+    \def\orig{#1}\edef\realname{\csname\string#1@font\endcsname}
+    \afterassignment\xfont
+    \expandafter\f@nt\realname
+}
+\gdef\xfont{
+    \expandafter\getfontsize\expandafter\dimen0\expandafter=\realname
+    \expandafter\edef\orig{\realname\size\the\dimen0\setbox\strutbox=\hbox{\noexpand\vphantom(}\adjs}
+}
+}
-- 
cgit 

