%% %% SPDX-FileCopyrightText: 2026 Andre Anjos (github:anjos) %% %% SPDX-License-Identifier: LPPL-1.3c %% \NeedsTeXFormat{LaTeX2e}[2020/02/02] \ProvidesPackage{geistserif} [2026/11/08 v1.9.2 Geist Serif support for LaTeX] \RequirePackage{iftex} \RequirePackage{xkeyval} %% Up here because packages cannot be loaded once options are declared. \ifpdftex\else\RequirePackage{fontspec}\fi %% Geist Serif comes as four single-weight fonts that differ only in the shape %% of their dots. variant= picks the one \rmdefault uses; \geistserifvariant %% switches locally. There is no bold and no italic: NFSS falls back to the %% upright regular face, with its usual warning, rather than faking either. \@namedef{geistserif@name@regular}{Regular} \@namedef{geistserif@name@square}{Square} \@namedef{geistserif@name@triangle}{Triangle} \@namedef{geistserif@name@heart}{Heart} %% Sets \geistserif@Name to the font-name form of a variant. \newcommand*{\geistserif@setname}[1]{% \@ifundefined{geistserif@name@#1} {\PackageError{geistserif}{Unknown variant `#1'} {Use regular, square, triangle or heart.}% \def\geistserif@Name{Regular}} {\edef\geistserif@Name{\@nameuse{geistserif@name@#1}}}} \newcommand*{\geistserif@variant}{regular} \DeclareOptionX{variant}{\renewcommand*{\geistserif@variant}{#1}} \ifpdftex %% The pdfTeX branch uses the metrics generated from the TrueType fonts with %% autoinst, one NFSS family per variant. Everything but variant= passes %% straight through to geistserif-nfss.sty. \DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{geistserif-nfss}} \ProcessOptionsX\relax \RequirePackage{geistserif-nfss} \newcommand*{\geistserifvariant}[1]{% \geistserif@setname{#1}% \fontfamily{GeistSerif\geistserif@Name-% \GeistSerif@figurealign\GeistSerif@figurestyle}\selectfont} \geistserif@setname{\geistserif@variant} \edef\rmdefault{GeistSerif\geistserif@Name-% \GeistSerif@figurealign\GeistSerif@figurestyle} \else %% XeTeX and LuaTeX read the TrueType fonts directly. \newcommand*{\geistserif@scale}{1} \DeclareOptionX{scale}{\renewcommand*{\geistserif@scale}{#1}} \DeclareOptionX{scaled}{\renewcommand*{\geistserif@scale}{#1}} \DeclareOptionX{mainfont}{% \AtEndOfPackage{\renewcommand*{\familydefault}{\rmdefault}}} %% Figure-style options only mean anything to the NFSS branch. Accept and %% ignore them here so one \usepackage line works under any engine. \DeclareOptionX*{} \ProcessOptionsX\relax %% Expand the variant before fontspec sees it: fontspec keys its font cache on %% the feature list as written, so an unexpanded macro there would make every %% variant resolve to whichever was loaded first. \newcommand*{\geistserif@load}[1]{% \edef\geistserif@tmp{\noexpand#1{GeistSerif}[ Extension = .ttf, Scale = \geistserif@scale, UprightFont = *-\geistserif@Name, ]}\geistserif@tmp} \newcommand*{\geistserifvariant}[1]{% \geistserif@setname{#1}\geistserif@load\fontspec} \geistserif@setname{\geistserif@variant} \geistserif@load\setmainfont \fi \endinput