\documentclass[12pt]{article}

\usepackage[
    weightadjustment=-50,opticalsizeadjustment=-2,slant=12,
    MainFeatures={StylisticSet=3},
]{elstob}

\setfontface\samplefootnote{Elstob}[
    Renderer = HarfBuzz,
    SizeFeatures = {{Size={5-}, RawFeature={axis={wght=460,opsz=6}}}},
]
\setfontface\sampleheader{Elstob}[
    Renderer = HarfBuzz,
    SizeFeatures = {{Size={5-}, RawFeature={axis={wght=345,opsz=18}}}}
]
\setfontface\mostslanted{Elstob-Italic}[
    Renderer = HarfBuzz,
    SizeFeatures = {{Size={5-}, RawFeature={axis={wght=415,opsz=12,slnt=0}}}}
]
\setfontface\leastslanted{Elstob-Italic}[
    Renderer = HarfBuzz,
    SizeFeatures = {{Size={5-}, RawFeature={axis={wght=415,opsz=12,slnt=15}}}}
]

\usepackage{microtype}
\usepackage{multicol}
\usepackage{metalogo}
\newcommand{\ltech}{Lua\kern-1.5pt\TeX}
\newcommand{\lltech}{Lua\LaTeX}
\setmonofont{Fira Mono}[Scale=MatchLowercase,Numbers=Lowercase]
\setsansfont{Fira Sans}[Scale=MatchLowercase,Numbers=Lowercase]
\newcommand{\fspec}{{\sffamily fontspec}}
\usepackage{supertabular}
\usepackage[table,dvipsnames]{xcolor}
\definecolor{myLightBlue}{RGB}{203,228,249}
\definecolor{GunMetalGray}{RGB}{42,52,57}
\definecolor{BrickRed}{RGB}{146,18,6}
\definecolor{RViolet}{RGB}{70,18,87}
\definecolor{myRed}{rgb}{0.5,0,0}
\newcommand{\bluerow}{\rowcolor{myLightBlue}}
\usepackage{titlesec}
\titleformat{\section}[hang]{\Large\color{GunMetalGray}}{\thesection.}{1em}{}
\usepackage{fancyhdr}
\pagestyle{fancy}
\footskip = 30pt
\headsep = 30pt
\renewcommand{\headrule}{}
\fancyhead[L]{}
\fancyhead[C]{}
\fancyhead[R]{}
\fancyfoot[L]{}
\fancyfoot[C]{}
\fancyfoot[R]{}
\newcommand{\src}[1]{{\color{BrickRed}\texttt{#1}}}
\linespread{1.1}
\title{Elstob}
\author{Peter S. Baker}
\date{\today}
\tolerance=1500

\begin{document}

\maketitle

\section{Introduction}

\pagestyle{fancy}
\fancyhead[CE]{\scshape\color{myRed} {\addfontfeatures{Numbers=OldStyle}\thepage}\hspace{10pt}%
\addfontfeature{Letters=UppercaseSmallCaps}\leftmark}
\fancyhead[CO]{\scshape\color{myRed} {elstob}\hspace{10pt}{\addfontfeatures{Numbers=OldStyle}\thepage}}

This package supports Elstob, the variable font for medievalists (and others).
The package requires \lltech, since {\ltech} is
the only flavor of {\TeX} that supports variable fonts. Elstob is not in CTAN, so you must
install the font in your system in order to use it (be sure to get “Elstob,” the variable
version, not “ElstobD,” the static font). Place the files \src{elstob.sty} and
\src{elstob.lua} in the same
directory with the document you're working on. This package loads
\fspec, so it is not necessary to load that package separately, even if you are using
other fonts alongside Elstob.

A variable font is one with glyphs that can change not only their size, but also their
shape. These changes in shape are defined in one or more \textbf{axes}---for example,
\textbf{Weight} (Light, Bold, etc.) and \textbf{Width} (Condensed, Expanded). A traditional
“static” font family also has axes, but as every style requires a separate font file,
the number of available styles is severely constrained. A variable font, by contrast,
offers a practically limitless number of styles in a single file: you choose a style
by making a selection of number values (usually called “coordinates”) from the axes, 
of which Elstob has four (five in the italic):

\begin{description}
    \item[Weight] Possible weights run from ExtraLight (200) to ExtraBold (800). By
    convention, Regular is 400 and Bold is 700.
    \item[Optical Size] A complex adjustment of a glyph's shape to
    optimize for particular type sizes: at small sizes (e.g. footnotes), thin stems are
    thicker, the xheight is higher, and glyphs are a little wider. Values from 6 to 18 correspond to point
    sizes, but this correspondence is merely the designer's suggestion: changing the
    font's optical size setting does not change the actual size of the text, and you can use any
    optical size with type in any actual size.
    \item[Slant] Italic only. The axis has values from 0 to 15, where 0 is {\mostslanted most
    slanted} and 15 is {\leastslanted least slanted}. The default is 8.
    \item[Grade] Increases the weight of glyphs without changing their width. This
    axis is more useful in web applications than in print.
    Possible values are 0–1 (fractional values are permitted). The default is 0.
    \item[Spacing] Increases the width of space characters. In combination with
    Stylistic Set 18 “Old-Style Punctuation Spacing,” this can approximate the
    spacing used by early printed books, which was more generous than now.
    Possible values are 0–1, with 0 as the default.
\end{description}

\noindent You can access all these axes through this package, but
especially those most appropriate for printed documents: Weight, Optical Size,
Spacing, and Slant.


\section{Loading Elstob}

Load the package in the usual way, with {\color{BrickRed}\verb|\usepackage{elstob}|}.
By default, the main font is not a set of static outlines whose proportions
remain the same though they can be scaled, but rather a set of
\emph{variable} outlines that change their Weight and Optical Size as the text size increases
or decreases. You can see the difference if we scale a line of fine print
and a line of header text to the same {\color{BrickRed}\verb|\large|} size:\\[0.5ex]

\noindent {\large\samplefootnote Here is some sample fine print (6pt).}\\[0.2ex]
{\large\sampleheader Here is some sample header text (18pt and up).}\\[0.5ex]

\noindent The letter-shapes are markedly different, but on the page they look
pretty much the same, because the purpose of these changes in
shape, in addition to promoting legibility,
is to allow blocks of text in different sizes (headers, main text,
block quotations, footnotes) to coexist on a page without any of them looking too
dark or too light.\footnote{%
For example, on a typical {\LaTeX} page a footnote like this, looked at as a block
of gray, is usually a little lighter than the main text. But on this page, the
“color” of the footnote matches that of the main text. The variation in glyph
shape responsible for this effect approximates the way letters in metal type were
typically wider and heavier at small sizes.} Evenness of texture makes text in
different point sizes \emph{look} the same.

Elstob's {\color{BrickRed}\verb|\usepackage|} options give you a number of ways to
fine-tune the look of your text:

\begin{description}
    \item[light] The weight of the type for the main text is Light. As with the default
    style (and all styles defined by these options), “Light” is not a fixed weight, but
    a range of weights varying with type size.
    \item[extralight] The weight of the type for the main text is ExtraLight.
    \item[medium] The weight of the type for the main text is Medium---that is, darker than
    Regular but lighter than Bold.
    \item[semibold] The weight of bold type is somewhat lighter than the usual bold. This may be a
    good choice if you have selected the \textbf{light} option.
    \item[extrabold] The weight of bold type is somewhat heavier than the usual bold. This may be a
    good choice if you have selected the \textbf{medium} option.
    \item[weightadjustment (or wghtadjust)] Adjusts the weight of the type. For example, if you choose \textbf{medium}
    for your document (weight averages about 500) and \textbf{extrabold} (weight about 800)
    and also include the option {\color{BrickRed}\verb|wghtadjust=-25|}, then the weights of medium and extrabold
    text will be lightened by 25 (475, 775).
    \item[opticalsizeadjustment (or opszadjust)] Adjusts the optical size. By default, the value of this axis
    is 8 for 8pt text, 12 for 12pt, etc. (within the range 6–18). But if you pass the
    option {\color{BrickRed}\verb|opszadjust=-2|}, the optical size axis will have 6 for 8pt type, 10 for
    12pt, etc. Because the value of the optical size axis must be between 6 and 18, the
    value of the optical size axis for 6- and 7pt type will be 6.
    \item[slant] A number from 0 to 15, specifying the slant of the italic face.
    A value of 0 is {\mostslanted most slanted}, 15 {\leastslanted most upright}.
    \item[oldspacing] Word-spacing and spacing around puncuation will approximate the conventions
    observed by typesetters of early printed books, which are more spaciously set than
    modern books.
    \item[proportional] Numbers in the document will be proportionally spaced. This is the default.
    \item[tabular] Numbers will be tabular (monospaced).
    \item[oldstyle] Numbers will be old-style, harmonizing with lowercase letters. This is the default.
    \item[lining] Numbers will be lining, harmonizing with uppercase letters.
\end{description}

\section{Customizing the Main Font}

If the options listed in the previous section don't give you the effect you're looking for,
this package's more advanced options allow you to choose
from a virtually infinite number of styles. Do this by passing OpenType features 
for your document's main text \emph{or} for one or more of the four main styles
(Regular, Italic, Bold, Bold Italic), and also by supplying custom values for the
font's four axes.

For example, if you want your document to use the conventions observed by early
English typesetters for the distribution of \textbf{s} and \textbf{ſ}, load the
package this way:

\footnotesize
\begin{verbatim}
    \usepackage[MainFeatures={
        Language=English,
        StylisticSet=8
    }]{elstob}
\end{verbatim}
\normalsize

\noindent If you want to use these conventions only for italic text, use
\textbf{MainItalicFeatures} instead of \textbf{MainFeatures}. All of the
features you pass via these options must be valid for \fspec: in fact,
they are passed straight through to \fspec.

If you want to customize the four basic styles of the main text, use
\textbf{MainRegularSizeFeatures}, \textbf{MainItalicSizeFeatures}, and so on.
Each of these defines a list of associative arrays, in which each array in the
list prescribes axis coordinates for a range of sizes.
For example, here is a hypothetical set of \textbf{SizeFeatures}:

\footnotesize
\begin{verbatim}
    MainRegularSizeFeatures={
        {size=10,wght=380,opsz=8},
        {size=13,wght=370,opsz=10},
        {size=13,wght=350,opsz=16}
    },
    MainItalicSizeFeatures={
        {size=10,wght=380,opsz=8,slnt=12},
        {size=13,wght=370,opsz=10,slnt=12},
        {size=13,wght=350,opsz=16,slnt=12}
    },
    MainBoldSizeFeatures={
        {size=10,wght=620,opsz=8},
        {size=13,wght=600,opsz=10},
        {size=13,wght=700,opsz=16}
    },
    MainBoldItalicSizeFeatures={
        {size=10,wght=620,opsz=8,slnt=12},
        {size=13,wght=600,opsz=10,slnt=12},
        {size=13,wght=700,opsz=16,slnt=12}
    }
\end{verbatim}\normalsize

\noindent For each array, a \src{size} key is mandatory: any array without one
is ignored. The arrays should be in order of point size. The first array
prescribes axis coordinates for all sizes up to \src{size}, the last array for all sizes
greater than \src{size}, and any intermediate items a range from the previous to the
current \src{size}.\footnote{%
If you want only one size array, make \src{size} improbably low (e.g. 5) and place
a comma after the closing brace of the array.%
} So the ranges covered in each list above are \src{-10}, \src{10-13},
and \src{13-}.\footnote{Any modification of the default text size (e.g. in the
\src{\textbackslash documentclass} command) can affect the size definitions in these
arrays, with the result that (for example)
\src{10} no longer means exactly “ten points.” You may have to experiment to get these numbers
right.}

The keys other than \src{size} are the four-letter tags for the font's axes: \src{wght}
(Weight), \src{opsz} (Optical Size), \src{slnt} (Slant, italic only), \src{GRAD} (Grade),
and \src{SPAC} (Spacing).\footnote{%
By convention, tags for axes defined in the OpenType standard are lowercase; custom axes
are uppercase. Elstob’s \src{GRAD} and \src{SPAC} are custom axes.%
} When a key
is omitted, the default value for that axis is used. It is up to you to make sure the values
given for each axis are valid---the package does no checking (but {\fspec} will do a good bit
of checking for you). When SizeFeatures are given in
this way, they override any other options that set or change axis coordinates
(e.g. \textbf{weightadjustment}).

This example defines three sizes, since the (hypothetical) document in question uses
only three sizes of type---for footnotes, main text, and headers. For each of these sizes, the
weight is a little lighter than the default of 400, and the optical size a little less, giving
the page a slightly more spacious look than the default. \textit{Italic type is relatively upright}.

\section{Selecting Alternate Styles}

In addition to the document's main font, you can choose from more than fifty
predefined styles, most of which match the instances defined in the font.
The commands for shifting to these
styles are as follows (of the italic styles, only the base “eItalic” is listed;
append “Italic” to any of the others, except “eRegular”):

\begin{multicols}{2}
\small\noindent\textbackslash eRegular

\noindent\textbackslash eItalic

\noindent\textbackslash eSixPt

\noindent\textbackslash eEightPt

\noindent\textbackslash eTenPt

\noindent\textbackslash eFourteenPt

\noindent\textbackslash eEighteenPt

\noindent\textbackslash eExtraLight

\noindent\textbackslash eSixPtExtraLight

\noindent\textbackslash eEightPtExtraLight

\noindent\textbackslash eTenPtExtraLight

\noindent\textbackslash eFourteenPtExtraLight

\noindent\textbackslash eEighteenPtExtraLight

\noindent\textbackslash eLight

\noindent\textbackslash eSixPtLight

\noindent\textbackslash eEightPtLight

\noindent\textbackslash eTenPtLight

\noindent\textbackslash eFourteenPtLight

\noindent\textbackslash eEighteenPtLight

\noindent\textbackslash eMedium

\noindent\textbackslash eSixPtMedium

\noindent\textbackslash eEightPtMedium

\noindent\textbackslash eTenPtMedium

\noindent\textbackslash eFourteenPtMedium

\noindent\textbackslash eEighteenPtMedium

\noindent\textbackslash eSemibold

\noindent\textbackslash eSixPtSemibold

\noindent\textbackslash eEightPtSemibold

\noindent\textbackslash eTenPtSemibold

\noindent\textbackslash eFourteenPtSemibold

\noindent\textbackslash eEighteenPtSemibold

\noindent\textbackslash eBold

\noindent\textbackslash eSixPtBold

\noindent\textbackslash eEightPtBold

\noindent\textbackslash eTenPtBold

\noindent\textbackslash eFourteenPtBold

\noindent\textbackslash eEighteenPtBold

\noindent\textbackslash eExtraBold

\noindent\textbackslash eSixPtExtraBold

\noindent\textbackslash eEightPtExtraBold

\noindent\textbackslash eTenPtExtraBold

\noindent\textbackslash eFourteenPtExtraBold
\end{multicols}

\noindent Use these commands
to shift temporarily to a style other than that of the main text.
For example, to shift to the 6pt Medium style for a short phrase, use
this code:
\begin{center}
{\color{BrickRed}\small\verb|{\eSixPtMedium a short phrase}|}.
\end{center}
The result: {\eSixPtMedium a short phrase}.

To add features to any of these styles, use the style name
(without the prefixed \textbf{e} and with \textbf{Features} appended)
as a package option. To change the size features for the style,
do the same, but with \textbf{SizeFeatures} instead of \textbf{Features}
appended. For example:

\footnotesize
\begin{verbatim}
    \usepackage[
        EightPtSemiboldFeatures={
            Language=English,
            StylisticSet=2
        },
        EightPtSemiboldSizeFeatures={{size=5,wght=650,opsz=8.5},}
    ]{elstob}
\end{verbatim}\normalsize

\noindent This will shift text in the 8pt Semibold style from default to insular
letter-shapes and slightly increase the weight and optical size of all glyphs in that style.
While you can supply \textbf{SizeFeatures} for any style, each roman style shares
\textbf{Features} with its matching italic. So there is no \textbf{SemiboldItalicFeatures}
option, but only \textbf{SemiboldFeatures}.

\section{Other Commands}

This package's other commands (listed in Table 1) are offered as conveniences---shorter and more
mnemonic than the {\fspec} commands they invoke (though of course all {\fspec} commands
remain available). Each of these commands
also has a corresponding “text” command that works like 
{\color{BrickRed}\verb|\textit{}|}—that is, it takes
as its sole argument the text to which the command will be applied. Each “text” command
consists of the main command with “text” prefixed—for example,
{\color{BrickRed}\verb|\textInsularLetterForms{}|}
corresponding to {\color{BrickRed}\verb|\InsularLetterForms|}.\linebreak
For a fuller account of the OpenType features
applied by these commands, see the \textit{Elstob Manual}.

%\begin{center}
\begin{table}[ht]
    \centering
    \begin{tabular}{| l | p{2.75in} |}
        \hline
    \bluerow\textbackslash AltThornEth & Applies ss01, Alternate thorn and eth.\\
    \textbackslash InsularLetterForms & Applies ss02, Insular letter-forms.\\
    \bluerow\textbackslash AlternateFigures & Applies ss03, Alternate Figures.\\
    \textbackslash ContextualLongS & Applies ss08, Contextual long s.\\
    \bluerow\textbackslash LanguageSpecificVariants & \small Applies ss09, Language-Specific Variants.\\
    \textbackslash EarlyEnglishFuthorc & Applies ss12, Early English Futhorc.\\
    \bluerow\textbackslash ElderFuthark & Applies ss13, Elder Futhark.\\
    \textbackslash YoungerFuthark & Applies ss14, Younger Futhark.\\
    \bluerow\textbackslash LongBranchToShortTwig & Applies ss15, Long Branch to Short Twig.\\
    \textbackslash ContextualRRotunda & Applies ss16, Contextual r rotunda.\\
    \bluerow\textbackslash OldStylePunctuation & Applies ss18, Old-style Punctuation.\\
    \textbackslash ecv, \textbackslash textcv & Applies a Character Variant feature.\\
    \hline
    \end{tabular}
%    \end{center}
\caption{Stylistic Set and Character Variant Commands}
\end{table}

The syntax of \textbackslash ecv
is {\color{BrickRed}\verb|\ecv[num]{num}|}, where the second (required) argument is the number of the Character Variant feature,
and the first (optional) argument is an index into the variants provided by that feature (starting with zero, the default).
\textbackslash textcv takes an additional required argument ({\color{BrickRed}\verb|\textcv[num]{num}{text}|}— the text to which the
feature should be applied.

\begin{table}[ht]
    \centering
    \begin{tabular}{|l|l|l|}
    \hline
    \textbackslash ecvD & \textbackslash ecvg & \textbackslash ecvs\\

    \textbackslash ecvd & \textbackslash ecvi & \textbackslash ecvT\\

    \textbackslash ecvF & \textbackslash ecvR & \textbackslash ecvT\\

    \textbackslash ecvf & \textbackslash ecvr & \textbackslash ecvt\\

    \textbackslash ecvG & \textbackslash ecvS & \textbackslash ecvTironianEt\\
    \hline
\end{tabular}
\caption{Mnemonics for Character Variants}
\end{table}

Character Variant features can also be selected with mnemonics, listed in Table 2. For example, a feature for
lowercase \textbf{g} can be expressed as

\begin{center}
{\color{BrickRed}\small\verb|\textcv[1]{\ecvg}{g}|}
\end{center}

\noindent yielding \textbf{\textcv[1]{\ecvg}{g}}, one of the phonetic characters devised by
the Middle English poet Orm.

\vspace*{\fill}

\begin{center}
    \itshape This document is set in 12pt Elstob with Weight 350, Optical Size Adjustment -2, and Italic Slant 12.\\
    The font used for code is Fira Mono,\\
    and the sans serif font is Fira Sans.
\end{center}

\end{document}
