%% lisnoti.sty
%% Sets Lisnoti as the main and sans serif font, with Lisnoti Caption for
%% small text. Needs LuaLaTeX or XeLaTeX.
%%
%% Options:
%%   caption=<size>  text smaller than <size> points is set in Lisnoti
%%                   Caption (default 9.5)
%%   nocaption       Lisnoti at every size
%%
%% Maths is not set up here: see lisnoti.pdf for the unicode-math lines.
%%
%% Copyright 2026 Tim Gordon
%%
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2008 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Tim Gordon.
%% This work consists of the file lisnoti.sty.
%%
%% The Lisnoti fonts themselves are licensed separately, under the SIL Open
%% Font License, version 1.1: see Licence.txt.
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesPackage{lisnoti}[2026-12-04 v2.008 Lisnoti with Lisnoti Caption for small text]

\RequirePackage{fontspec}

\newif\iflisnoti@caption
\lisnoti@captiontrue
\DeclareKeys[lisnoti]{
  caption   .store = \lisnoti@size,
  nocaption .code  = \lisnoti@captionfalse,
}
\SetKeys[lisnoti]{caption = 9.5}
\ProcessKeyOptions[lisnoti]

% The fonts are named by file. fontspec finds a font for one size range by
% file name only when the whole family is named that way.
\newcommand*\lisnoti@set[1]{%
  \iflisnoti@caption
    \begingroup
    \edef\lisnoti@do{\endgroup
      \noexpand#1{Lisnoti}[
        Extension      = .ttf,
        UprightFont    = *-Regular,
        ItalicFont     = *-Italic,
        BoldFont       = *-Bold,
        BoldItalicFont = *-BoldItalic,
        UprightFeatures    = {SizeFeatures = {
          {Size = -\lisnoti@size, Font = LisnotiCaption-Regular},
          {Size = \lisnoti@size-}}},
        ItalicFeatures     = {SizeFeatures = {
          {Size = -\lisnoti@size, Font = LisnotiCaption-Italic},
          {Size = \lisnoti@size-}}},
        BoldFeatures       = {SizeFeatures = {
          {Size = -\lisnoti@size, Font = LisnotiCaption-Bold},
          {Size = \lisnoti@size-}}},
        BoldItalicFeatures = {SizeFeatures = {
          {Size = -\lisnoti@size, Font = LisnotiCaption-BoldItalic},
          {Size = \lisnoti@size-}}},
      ]}%
    \lisnoti@do
  \else
    #1{Lisnoti}[
      Extension      = .ttf,
      UprightFont    = *-Regular,
      ItalicFont     = *-Italic,
      BoldFont       = *-Bold,
      BoldItalicFont = *-BoldItalic,
    ]%
  \fi}

\lisnoti@set\setmainfont
\lisnoti@set\setsansfont

\endinput
