%%
%% This is file `nfssext-cfr-nnfss.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nfssext-cfr.dtx  (with options: `sty-nnfss')
%% Additions and changes Copyright (C) 2008-2025 Clea F. Rees.
%% Code from fontinstallationguide Copyright (C) 2002-2004 Philipp Lehman (see below)
%% 
%% 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-05-04 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Clea F. Rees.
%% 
%% This work consists of all files listed in manifest.txt.
%% 
%% 
%% The file  nfssext-cfr-nnfss.sty is a derived work under the terms of the LPPL.
%% It is based on version 1.2 of nfssext.sty which is supplied with
%% The Font Installation Guide by Philipp Lehman. A copy of The Font Installation Guide, including an
%% unmodified version of nfssext.sty is available from
%%   https://tug.ctan.org/pkg/fontinstallationguide.
%% nfssext.sty is part of the included archive figuide-examples.tar.gz
%% which consists of examples and templates released under the LPPL.
%% nfssext.sty is included in the files for tutorials 3, 5 and 6.
%% 
%% The main modifications made to this file are described in nfssext-cfr.dtx.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{svn-prov}
\ProvidesPackageSVN[\filebase-nnfss.sty]{$Id: nfssext-cfr.dtx 11042 2025-06-22 22:34:34Z cfrees $}[v1.3 \revinfo{} extended New New Font Selection Scheme (NNFSS) based on 2003/03/14 v1.2 Experimental NFSS Extensions]
\DefineFileInfoSVN
\newcommand*{\exfs@tempa}{}
\newcommand*{\exfs@tempb}{}
\newcommand*{\exfs@tempf}{}
\ExplSyntaxOn
\hook_gput_code:nnn { cmd/wrong@fontshape/before } { . }
{
  \global\expandafter\expandafter\expandafter\let
  \expandafter \csname exfs@fake@ \curr@fontshape\endcsname\relax
}
\ExplSyntaxOff
\newcommand \exfs@info[2][nfssext-cfr]{%
  \ifexfs@debug
    \PackageWarning{#1}{Info: #2}%
  \else
    \PackageInfo{#1}{#2}%
  \fi
}
\newcommand* \exfs@normalise[1]{%
  \ifcsname exfs@fake@\curr@fontshape\endcsname
    \exfs@info{Current font '\curr@fontshape' is fake.\MessageBreak
      Normalising}%
    \expandafter\csname f@#1\endcsname{\csname #1default\endcsname}\selectfont
    \ifcsname exfs@fake@\curr@fontshape\endcsname
      \f@series{\seriesdefault}\f@shape{\shapedefault}\selectfont
      \ifcsname exfs@fake@\curr@fontshape\endcsname
        \normalfont
        \ifcsname exfs@fake@\curr@fontshape\endcsname
          \PackageError{nfssext-cfr}{Default font appears to be fake!\MessageBreak
            Switch \textbackslash normalfont yielded '\curr@fontshape'}
          {This is highly unlikely, so the bug is probably in the phenomena\MessageBreak
            rather than the noumena}%
        \fi
      \fi
    \fi
    \exfs@info{Normalised to '\curr@fontshape'}%
  \else
    \exfs@info{Current font '\curr@fontshape' appears real}%
  \fi
}
\newcommand*{\exfs@try@family}[2][]{%
  \let\exfs@tempa\relax
  \begingroup % fel arall, bydd latex yn credu bod y family yn go iawn beth bynnag
    \exfs@info{Trying Font family '\f@encoding/#2'}%
    \fontfamily{#2}\try@load@fontshape
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
      \edef\exfs@tempa{#1}%
      \ifx\exfs@tempa\@empty
        \PackageWarning{nfssext}{%
          Font family '\f@encoding/#2' not available\MessageBreak
          Ignoring font switch}%
      \else
        \exfs@info[nfssext]{%
          Font family '\f@encoding/#2' not available\MessageBreak
          Font family '\f@encoding/#1' tried instead}%
        \exfs@try@family{#1}%
      \fi
    \else
      \exfs@info{Loading font family '\f@encoding/#2'}%
      \gdef\exfs@tempa{\fontfamily{#2}\selectfont}%
    \fi
  \endgroup
  \exfs@tempa}
\newcommand*{\exfs@try@series}[2][]{%
  \let\exfs@targetseries\relax
  \edef\exfs@tempa{#2}%
  \ifx\f@series\exfs@tempa\relax
  \exfs@info{Current (\f@series) matches target (#2) series.\MessageBreak
    Ignoring font switch}%
  \else
    \begingroup
      \exfs@normalise{series}%
      \edef\exfs@tempa{\f@encoding/\f@family/#2/\f@shape}%
      \ifcsname \exfs@tempa\endcsname
        \exfs@info{Switching series: \f@series\space -> #2}%
        \gdef\exfs@targetseries{\fontseries{#2}\selectfont}%
      \else
        \edef\exfs@reserved{#1}%
        \ifx\exfs@reserved\@empty
          \PackageWarning{nfssext-cfr}{%
            Font series '\f@encoding/\f@family/#2/\f@shape' not available\MessageBreak
            Ignoring font change}%
        \else
          \PackageWarning{nfssext-cfr}{%
            Font series '\f@encoding/\f@family/#2/\f@shape' not available\MessageBreak
            Trying '\f@encoding/\f@family/#1/\f@shape'}%
            \exfs@try@series{#1}%
        \fi
      \fi
    \endgroup
    \exfs@targetseries
  \fi}
\def\exfs@try@shapeshift#1{%
  \edef\exfs@targetshape{\csname #1default\endcsname}%
  \ifx\f@shape\exfs@targetshape\relax
    \exfs@info{Current (\f@shape) matches target (#1) shape.\MessageBreak
      Ignoring font switch}%
  \else
    \not@math@alphabet\edef\exfs@targetshape\relax
    \exfs@info{\f@shape\space -> \exfs@targetshape\MessageBreak
      Trying \f@encoding/\f@family/\f@series/\exfs@targetshape}%
    \fontshape{\exfs@targetshape}\selectfont
  \fi}
\newcommand* \exfs@swshape{%
  \let\exfs@targetsw\relax
  \begingroup % angen neu beidio? angen - bendant!
    \edef\exfs@tempa{\f@encoding/\f@family/\f@series/\swdefault}%
    \edef\exfs@tempa@fake{exfs@fake@\exfs@tempa}%
    \ifcsname \exfs@tempa\endcsname
      \ifcsname exfs@fake@\exfs@tempa\endcsname
        \exfs@swfamily
      \else
        \gdef\exfs@targetsw{\fontshape{\swdefault}\selectfont}% kernel
      \fi
    \else
      \exfs@swfamily
    \fi
  \endgroup
  \ifx\exfs@targetsw\relax
    \PackageWarning{nfssext-cfr}{%
      Cannot find any route to swash.\MessageBreak
      Are you sure one is available?}%
  \else
    \exfs@targetsw
    \exfs@info{Switch to swash resulted in '\curr@fontshape'}%
  \fi
}
\newcommand* \exfs@swfamily{%
  \let\exfs@targetsw\relax
  \begingroup
    \let\exfs@tempa\f@family
    \exfs@merge@families{w}%
    \ifx\exfs@tempa\f@family % try merge with current shape
      \fontshape{n}%
      \exfs@merge@families{w}% up & merge
      \if\exfs@tempa\f@family
        \fontshape\swshapedefault
        \exfs@merge@families{w}% up & nfssext-cfr default/configured
        \if\exfs@tempa\f@family
          \exf@try@family{\expandafter\exfs@get@base\f@family\@nil w}% nfssext switch
          \if\exfs@tempa\f@family % nfssext switch
            \fontshape\swshapedefault\exfs@try@family{%
            \expandafter\exfs@get@base\f@family\@nil w}% nfssext switch & shape
            \if\exfs@tempa\f@family
              \relax % rhodd y ffidl yn y to (give up)
            \else
              \gdef\exfs@targetsw{%
                \fontshape\swshapedefault\expandafter\fontfamily{%
                \exfs@get@base\f@family\@nil w}\selectfont
              }% nfssext switch & shape
            \fi % nfssext switch & shape
          \else
            \gdef\exfs@targetsw{\expandafter\fontfamily{%
              \exfs@get@base\f@family\@nil w}\selectfont
            }% nfssext switch
          \fi % nfssext switch
        \else
          \gdef\exfs@targetsw{%
            \fontshape\swshapedefault\exfs@merge@families{w}%
          }%  up & nfssext-cfr default/configured
        \fi % up & nfssext-cfr default/configured
      \else
        \gdef\exfs@targetsw{%
          \fontshape{n}\exfs@merge@families{w}%
        }% up & merge
      \fi % up & merge
    \else
      \gdef\exfs@targetsw{\exfs@merge@families{w}}% merge with current shape
    \fi % merge with current shape
  \endgroup
}
\def\exfs@get@base#1#2#3#4\@nil{#1#2#3}
\def\exfs@get@variants#1#2#3#4\@nil{#4}
\def\exfs@next#1#2\@nil{#1}
\def\exfs@shift#1#2\@nil{#2}
\def\exfs@first#1#2\@nil{#1}
\def\exfs@part#1#2\@nil{#2}
\def\exfs@second#1#2#3\@nil{#2}
\def\exfs@series@splitter#1{%
  \edef\exfs@weight{\expandafter\exfs@first#1\@nil}%
  \edef\exfs@width{\expandafter\exfs@shift#1\@nil}%
  \if\exfs@weight u\exfs@check@cx{u}%
    \else\if\exfs@weight e\exfs@check@cx{e}%
      \else\if\exfs@weight s\exfs@check@cx{s}%
        \else\if\exfs@weight d\exfs@check@cx{d}%
          \else\ifx\exfs@width\@empty % m dealt with elsewhere
            \if\exfs@weight c\def\exfs@width{c}\let\exfs@weight\@empty
            \else\if\exfs@weight x\def\exfs@width{x}\let\exfs@weight\@empty
          \fi\fi
  \fi\fi\fi\fi\fi
  \exfs@info{#1 -> \exfs@weight:\exfs@width;}%
}
\def\exfs@check@cx#1{%
  \edef\exfs@tempa{\expandafter\exfs@first\exfs@width\@nil}%
  \if\exfs@tempa c\edef\exfs@width{#1c}\let\exfs@weight\@empty
    \else\if\exfs@tempa x\edef\exfs@width{#1x}\let\exfs@weight\@empty
    \else\edef\exfs@weighta{%
        \exfs@weight\exfs@tempa
      }\let\exfs@weight\exfs@weighta
      \edef\exfs@widtha{%
        \expandafter\exfs@shift\exfs@width\@nil
      }\let\exfs@width\exfs@widtha
  \fi\fi
}
\DeclareRobustCommand{\lnstyle}{%% anniffiniedig
  \not@math@alphabet\lnstyle\relax
  \exfs@try@family[\expandafter\exfs@get@base\f@family\@nil]%
                  {\expandafter\exfs@get@base\f@family\@nil x}}
\DeclareRobustCommand{\osstyle}{%% anniffiniedig
  \not@math@alphabet\osstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil j}}
\DeclareRobustCommand{\instyle}{%% anniffiniedig
  \not@math@alphabet\instyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 0}}
\let\infstyle\instyle
\DeclareRobustCommand{\sustyle}{%% anniffiniedig
  \not@math@alphabet\sustyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 1}}
\DeclareRobustCommand{\swstyle}{%% anniffiniedig
  \not@math@alphabet\swstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil w}}
\newif\ifexfs@added
\newcommand*\exfs@merge@families[1]{%
  \edef\exfs@vartomerge{#1}%
  \edef\exfs@variants{\expandafter\exfs@get@variants\f@family\@nil}%
  \exfs@info{Trying to merge variants #1 and \exfs@variants}%
  \edef\tempo{2j}%
  \let\exfs@tempq\@empty
  \def\exfs@tempg{}%
  \exfs@addedfalse
  \ifx\exfs@variants\@empty
    \edef\exfs@tempq{\exfs@vartomerge}%
    \exfs@addedtrue
  \else
    \gdef\set{0,1,2,a,d,e,f,h,j,l,p,q,s,t,v,w}% these are the variants to consider - the order here and in the font name is crucial
    \ifx\tempo\exfs@vartomerge
      \@for \xx:=\set \do {%
        \ifx\exfs@variants\@empty
          \let\exfs@nextvariant\@empty
        \else
          \edef\exfs@nextvariant{\expandafter\exfs@next\exfs@variants\@nil}%
        \fi
        \if\exfs@nextvariant 2%
          \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
        \fi
        \if\exfs@nextvariant j% if the next variant is j, ignore it
          \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
        \fi
        \if\xx 2%
          \edef\exfs@tempg{\exfs@tempg\xx}%
        \else
          \if\xx j% if the current value is j, we're done
            \edef\exfs@tempq{\exfs@tempg\xx\exfs@variants}%
            \let\exfs@variants\@empty
            \exfs@addedtrue
          \else
            \ifx\xx\exfs@nextvariant
              \edef\exfs@tempg{\exfs@tempg\xx}%
              \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
            \fi
          \fi
        \fi
      }%
    \else
      \@for \xx:=\set \do {%
        \ifx\exfs@variants\@empty
          \ifexfs@added
          \else
            \edef\exfs@tempq{\exfs@tempg\exfs@vartomerge}%
            \exfs@addedtrue
          \fi
        \else
          \edef\exfs@nextvariant{\expandafter\exfs@next\exfs@variants\@nil}%
          \ifx\exfs@nextvariant\exfs@vartomerge
            \edef\exfs@tempq{\exfs@tempg\exfs@variants}%
            \exfs@addedtrue
            \let\exfs@variants\@empty
          \else
            \ifx\exfs@vartomerge\xx
              \edef\exfs@tempq{\exfs@tempg\xx\exfs@variants}%
              \exfs@addedtrue
              \let\exfs@variants\@empty
            \else
              \ifx\exfs@nextvariant\xx
                \edef\exfs@tempg{\exfs@tempg\xx}%
                \edef\exfs@variants{\expandafter\exfs@shift\exfs@variants\@nil}%
              \fi
            \fi
          \fi
        \fi
      }%
    \fi
  \fi
  \ifx\exfs@tempq\@empty
    \PackageError{nfssext-cfr}{Something is wrong here. Ignoring font switching command.}{}%
  \else
    \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
  \fi
}
\DeclareRobustCommand{\pstyle}{%% anniffiniedig proportional figures
  \not@math@alphabet\pstyle\relax
  \exfs@merge@families{2}}
\DeclareRobustCommand{\ostyle}{%% anniffiniedig oldstyle figures (cf. original osstyle above)
  \not@math@alphabet\ostyle\relax
  \exfs@merge@families{j}}
\DeclareRobustCommand{\postyle}{%% anniffiniedig
  \not@math@alphabet\postyle\relax
  \exfs@merge@families{2j}}
\DeclareRobustCommand{\tistyle}{%% anniffiniedig titling/display
  \not@math@alphabet\tistyle\relax
  \exfs@merge@families{d}}
\DeclareRobustCommand{\ltstyle}{%% anniffiniedig
  \not@math@alphabet\ltstyle\relax
  \exfs@merge@families{l}}
\DeclareRobustCommand{\ofstyle}{%% anniffiniedig
  \not@math@alphabet\ofstyle\relax
  \exfs@merge@families{l}}
\DeclareRobustCommand{\altstyle}{%% anniffiniedig alternative style
  \not@math@alphabet\altstyle\relax
  \exfs@merge@families{a}}
\DeclareRobustCommand{\regstyle}{%% anniffiniedig 'regular' style
  \not@math@alphabet\regstyle\relax
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil}}
\DeclareRobustCommand{\embossstyle}{%% anniffiniedig
  \not@math@alphabet\embossstyle\relax
  \exfs@merge@families{e}}
\DeclareRobustCommand{\ornamentalstyle}{%% anniffiniedig intended primarily for decorative initial fonts etc.
  \not@math@alphabet\ornamentalstyle\relax
  \exfs@merge@families{p}}
\DeclareRobustCommand{\qtstyle}{%% anniffiniedig quotation style (assumes sans)
  \not@math@alphabet\qtstyle\relax
  \sffamily
  \exfs@merge@families{q}}
\DeclareRobustCommand{\shstyle}{%% anniffiniedig
  \not@math@alphabet\shstyle\relax
  \exfs@merge@families{h}}
\DeclareRobustCommand{\swashstyle}{%% anniffiniedig an attempt to improve on \swstyle
  \not@math@alphabet\swashstyle\relax
  \exfs@merge@families{w}}
\DeclareRobustCommand{\tmstyle}{%% anniffiniedig       monowidth typewriter
  \not@math@alphabet\tmstyle\relax
  \exfs@unmerge@families{s}%
  \exfs@unmerge@families{v}%
  \exfs@merge@families{t}}
\DeclareRobustCommand{\tvstyle}{%% anniffiniedig       variable width typewriter
  \not@math@alphabet\tvstyle\relax
  \exfs@unmerge@families{s}%
  \exfs@unmerge@families{t}%
  \exfs@merge@families{v}}
\newif\ifexfs@take
\newcommand*\exfs@unmerge@families[1]{%
  \edef\exfs@tempf{#1}%
  \edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
  \let\exfs@tempq\@empty
  \edef\exfs@tempg{}%
  \exfs@taketrue
  \ifx\tempa\@empty
    \edef\exfs@tempq{}%
  \else
    \loop
      \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
      \ifx\exfs@tempf\exfs@tempn
        \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
        \edef\exfs@tempq{\exfs@tempg\tempa}%
        \exfs@takefalse
      \else
        \edef\exfs@tempg{\exfs@tempg\exfs@tempn}%
        \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
        \ifx\tempa\@empty% if there are no variants left, we're done
          \edef\exfs@tempq{\exfs@tempg}%
          \exfs@takefalse
        \fi
      \fi
      \ifexfs@take % \fi yn \repeat
    \repeat
  \fi
  \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
}
\DeclareRobustCommand{\tstyle}{%% anniffiniedig tabular figures
  \not@math@alphabet\tstyle\relax
  \exfs@unmerge@families{2}}
\DeclareRobustCommand{\lstyle}{%% anniffiniedig lining figures (cf. command above)
  \not@math@alphabet\lstyle\relax
  \exfs@unmerge@families{j}}
\DeclareRobustCommand{\tlstyle}{%% anniffiniedig
  \lstyle\tstyle}
\DeclareRobustCommand{\plstyle}{%% anniffiniedig
  \lstyle\pstyle}
\DeclareRobustCommand{\tostyle}{%% anniffiniedig
  \ostyle\tstyle}
\newcommand*{\sidefault}{si}% anniffiniedig
\DeclareRobustCommand{\sishape}{%
  \exfs@try@shapeshift{si}}
\DeclareFontShapeChangeRule {n}{si}{scit}{scsl}% current; request (& trydedd); dewisiad cyntaf; ail ddewisiad
\DeclareFontShapeChangeRule {it}{si}{scit}{scsl}
\DeclareFontShapeChangeRule {sl}{si}{scit}{scsl}
\DeclareFontShapeChangeRule {sc}{si}{scit}{scsl}
\DeclareFontShapeChangeRule {si}{sc} {si} {}
\DeclareFontShapeChangeRule {si}{it} {si} {}
\DeclareFontShapeChangeRule {si}{sl} {scsl} {si}
\DeclareFontShapeChangeRule {si}{scit} {scit} {si}% rhag ofn?!
\DeclareFontShapeChangeRule {si}{ulc} {it} {}
\DeclareFontShapeChangeRule {si}{up}{sc}{}
\ExplSyntaxOn
\bool_if:NT \g__exfs_compat_bool
{
  \DeclareFontShapeChangeRule {it}{sc}{si}{scsl}
  \DeclareFontShapeChangeRule{sl}{sc}{scsl}{si}
  \DeclareFontShapeChangeRule {sc}{it} {si} {scsl}
  \DeclareFontShapeChangeRule {sc}{sl} {scsl} {si}
  \DeclareFontShapeChangeRule {scsl}{it} {si} {scsl}
}
\ExplSyntaxOff
\DeclareFontShapeChangeRule {ui}{sc}{scit}{scsl}
\DeclareFontShapeChangeRule {ui}{scsl}{scsl}{scit}
\DeclareFontShapeChangeRule {ui}{it}{it}{ui}
\DeclareFontShapeChangeRule {ui}{ri}{ri}{ui}
\DeclareFontShapeChangeRule {ui}{up}{n}{}
\DeclareFontShapeChangeRule {ui}{ulc}{ui}{}
\DeclareFontShapeChangeRule {ri}{sc}{scit}{scsl}
\DeclareFontShapeChangeRule {ri}{scsl}{scsl}{scit}
\DeclareFontShapeChangeRule {ri}{it}{it}{ri}
\DeclareFontShapeChangeRule {ri}{ui}{ui}{ri}
\DeclareFontShapeChangeRule {ri}{up}{n}{}
\DeclareFontShapeChangeRule {ri}{ulc}{ri}{}
\DeclareFontShapeChangeRule {ol} {sc} {scol} {} % <- seiliedig ar nfssext-cfr-nfss.sty \scshape
\DeclareFontShapeChangeRule {ol} {ulc} {ol} {}
\DeclareFontShapeChangeRule {ol} {up} {ol} {}
\DeclareFontShapeChangeRule {scol} {sc} {scol} {}
\DeclareFontShapeChangeRule {scol} {ulc} {ol} {}
\DeclareFontShapeChangeRule {scol} {up} {scol} {}
\DeclareFontShapeChangeRule {u}{sc}{su}{} % <- seiliedig ar nfssext-cfr-nfss.sty \scshape
\DeclareFontShapeChangeRule {su}{ulc}{u}{}
\DeclareFontShapeChangeRule {sc}{u}{su}{}
\DeclareFontShapeChangeRule {su}{u}{su}{}
\DeclareFontShapeChangeRule {su}{sc}{su}{}
\newcommand*{\oldefault}{ol}% anniffiniedig
\DeclareRobustCommand{\olshape}{%% anniffiniedig
  \exfs@try@shapeshift{ol}}
\newcommand*{\scoldefault}{scol}% anniffiniedig
\DeclareRobustCommand{\scolshape}{%% anniffiniedig
  \exfs@try@shapeshift{scol}}
\newcommand*{\udefault}{u}% anniffiniedig
\DeclareRobustCommand{\ushape}{%% anniffiniedig
  \exfs@try@shapeshift{u}}
\newcommand*{\scudefault}{su}% anniffiniedig
\DeclareRobustCommand{\scushape}{%% anniffiniedig
  \exfs@try@shapeshift{scu}}
\newcommand*{\uidefault}{ui}% anniffiniedig
\DeclareRobustCommand{\uishape}{% anniffiniedig
  \exfs@try@shapeshift{ui}}
\newcommand*{\ridefault}{ri}% anniffiniedig
\DeclareRobustCommand{\rishape}{% anniffiniedig
  \exfs@try@shapeshift{ri}}
\newcommand*{\exfs@merge@width}[1]{%
    \exfs@series@splitter{\f@series}%
    \edef\exfs@temph{#1}%
    \if\exfs@temph m\ifx\exfs@weight\@empty\else\let\exfs@temph\@empty\fi\fi
    \if\exfs@weight m\ifx\exfs@temph\@empty\else\let\exfs@weight\@empty\fi\fi
    \edef\exfs@series{\exfs@weight\exfs@temph}%
    \exfs@info{Trying \exfs@series}%
\exfs@try@series{\exfs@series}}
\DeclareRobustCommand{\regwidth}{%% anniffiniedig
\not@math@alphabet\regwidth\relax
    \exfs@merge@width{m}}
\newcommand*{\nwdefault}{c}% anniffiniedig
\DeclareRobustCommand{\nwwidth}{%% anniffiniedig ond rheolau
\not@math@alphabet\nwwidth\relax
\exfs@merge@width{\nwdefault}}% neu \exfs@try@series ?
\newcommand*{\cddefault}{c}% anniffiniedig
\DeclareRobustCommand{\cdwidth}{% anniffiniedig ond rheolau
\not@math@alphabet\cdwidth\relax
\exfs@merge@width{\cddefault}}% neu \exfs@try@series ?
\newcommand*{\ecdefault}{ec}% anniffiniedig
\DeclareRobustCommand{\ecwidth}{%% anniffiniedig ond rheolau
\not@math@alphabet\ecwidth\relax
\exfs@merge@width{\ecdefault}}% neu \exfs@try@series ?
\newcommand*{\ucdefault}{uc}% anniffiniedig
\DeclareRobustCommand{\ucwidth}{%% anniffiniedig
\not@math@alphabet\ucwidth\relax
\exfs@merge@width{\ucdefault}}
\newcommand*{\etdefault}{x}% anniffiniedig
\DeclareRobustCommand{\etwidth}{%% anniffiniedig
\not@math@alphabet\etwidth\relax
\exfs@merge@width{\etdefault}}% neu \exfs@try@series ?
\newcommand*{\epdefault}{x}% anniffiniedig
\DeclareRobustCommand{\epwidth}{%% anniffiniedig ond rheolau
\not@math@alphabet\epwidth\relax
\exfs@merge@width{\epdefault}}% neu \exfs@try@series ?
\newcommand*{\exdefault}{ex}% anniffiniedig
\DeclareRobustCommand{\exwidth}{%% anniffiniedig
\not@math@alphabet\exwidth\relax
\exfs@merge@width{\exdefault}}
\newcommand*{\uxdefault}{ux}% anniffiniedig
\DeclareRobustCommand{\uxwidth}{%% anniffiniedig
\not@math@alphabet\uxwidth\relax
\exfs@merge@width{\uxdefault}}
\newcommand*\mdwdefault{m}
\DeclareRobustCommand{\mdwidth}{%% anniffiniedig
  \not@math@alphabet\mdwidth\relax
  \exfs@merge@width{\mdwdefault}}
\newcommand*{\exfs@merge@weight}[1]{%
  \exfs@series@splitter{\f@series}%
  \let\exfs@tempg\f@series
  \def\exfs@temph{#1}%
  \if\exfs@temph m\relax
    \ifx\exfs@width\@empty\relax
    \else
      \let\exfs@temph\@empty
    \fi
  \fi
  \edef\exfs@series{\exfs@temph\exfs@width}%
  \ifx\exfs@temph\exfs@series
    \exfs@info{Trying \exfs@series}%
    \exfs@try@series{\exfs@series}%
  \else
    \exfs@info{Trying \exfs@series, favouring \exfs@weight}%
    \exfs@try@series[\exfs@weight]{\exfs@series}% assume user wants to change weight even if this changes back to the default width
  \fi}
\newcommand*{\mbdefault}{sb}% dim byd i'w gael ei wneud yma
\DeclareRobustCommand{\mbweight}{%% anniffiniedig
  \not@math@alphabet\mbweight\relax
  \exfs@merge@weight{\mbdefault}}
\newcommand*{\bddefault}{b}% dim byd i'w gael ei wneud yma
\DeclareRobustCommand{\bfweight}{%% anniffiniedig
  \not@math@alphabet\bfweight\relax
  \exfs@merge@weight{\bddefault}}
\DeclareRobustCommand{\bdweight}{%% anniffiniedig
  \not@math@alphabet\bdweight\relax
  \exfs@merge@weight{\bddefault}}
\newcommand*\mwdefault{m}
\DeclareRobustCommand{\mdweight}{%% anniffiniedig
  \not@math@alphabet\mdweight\relax
  \exfs@merge@weight{\mwdefault}}
\newcommand*{\dbdefault}{db}% anniffiniedig
\DeclareRobustCommand{\dbweight}{%% anniffiniedig
\not@math@alphabet\dbweight\relax
\exfs@merge@weight{\dbdefault}}
\newcommand*{\sbdefault}{sb}% anniffiniedig
\DeclareRobustCommand{\sbweight}{%% anniffiniedig ond rheolau
\not@math@alphabet\sbweight\relax
\exfs@merge@weight{\sbdefault}}% neu \exfs@try@series ?
\newcommand*{\ebdefault}{eb}% anniffiniedig
\DeclareRobustCommand{\ebweight}{%% anniffiniedig ond rheolau
\not@math@alphabet\ebweight\relax
\exfs@merge@weight{\ebdefault}}% neu \exfs@try@series ?
\newcommand*{\ubdefault}{ub}% anniffiniedig
\DeclareRobustCommand{\ubweight}{%% anniffiniedig ond rheolau
\not@math@alphabet\ubweight\relax
\exfs@merge@weight{\ubdefault}}% neu \exfs@try@series ?
\newcommand*{\lgdefault}{l}% anniffiniedig
\DeclareRobustCommand{\lgweight}{%% anniffiniedig ond rheolau
\not@math@alphabet\lgweight\relax
\exfs@merge@weight{\lgdefault}}% neu \exfs@try@series ?
\newcommand*{\eldefault}{el}% anniffiniedig
\DeclareRobustCommand{\elweight}{%% anniffiniedig ond rheolau
\not@math@alphabet\elweight\relax
\exfs@merge@weight{\eldefault}}% neu \exfs@try@series ?
\newcommand*{\uldefault}{ul}% anniffiniedig
\DeclareRobustCommand{\ulweight}{%% anniffiniedig ond rheolau
\not@math@alphabet\ulweight\relax
\exfs@merge@weight{\uldefault}}% neu \exfs@try@series ?
\let\dfshape\normalshape
\newcommand*{\swshapedefault}{\itdefault}
\ExplSyntaxOn
\hook_gput_code:nnn {begindocument}{.}
{% compatibility with original nfss \swshape
  \bool_if:NTF \g__exfs_compat_bool
  {
    \DeclareRobustCommand{\swshape}
    {
      \not@math@alphabet\swshape\relax
      \swstyle\fontshape\swshapedefault\selectfont
    }
    \PackageWarning{nfssext-cfr}{
      Overwriting ~ kernel ~ definition ~ of ~ \swshape \space (compat)
    }
  }{
    \DeclareRobustCommand \swshape
    {
      \not@math@alphabet\swshape\relax
      \exfs@swshape
    }
    \PackageWarning{nfssext-cfr}{
      Overwriting ~ kernel ~ definition ~ of ~ \swshape \space (new)
    }
  }
  \@ifpackageloaded{hyperref}{
    \expandafter\@ifl@t@r \csname ver@hyperref.sty\endcsname {2025/05/20}{
      \DeclareTextFontCommand{\textin}{\instyle}
    }{
      \hook_gput_code:nnn { cmd/textin/before } { . }
      {
        \exfs@info{
          Note ~ that ~ '\protect\textin' ~ is ~ defined ~ by ~ hyperref.\MessageBreak
          Use ~ for ~ inferior ~ digits ~ will ~ yield ~ an\MessageBreak
          undefined ~ command ~ error ~ in ~ document ~ font ~ encodings.\MessageBreak
          Use ~ '\protect\textinf' ~ to ~ access ~ inferior ~ digits.\MessageBreak
          Alternatively, ~ update ~ hyperref ~ to ~ 2025-05-20 ~ or ~ later
        }
      }
    }
  }{
    \DeclareTextFontCommand{\textin}{\instyle}
  }
}
\ExplSyntaxOff
\DeclareTextFontCommand{\textln}{\lnstyle}% anniffiniedig
\DeclareTextFontCommand{\textos}{\osstyle}% anniffiniedig
\DeclareTextFontCommand{\textinf}{\instyle}% anniffiniedig
\DeclareTextFontCommand{\textsu}{\sustyle}% anniffiniedig
\DeclareTextFontCommand{\textsi}{\sishape}% anniffiniedig
\DeclareTextFontCommand{\textdf}{\dfshape}% anniffiniedig
\DeclareTextFontCommand{\textti}{\tistyle}% anniffiniedig
\DeclareTextFontCommand{\textlt}{\ltstyle}% anniffiniedig
\DeclareTextFontCommand{\textof}{\ofstyle}% anniffiniedig % open-face (or outline or blank) style
\DeclareTextFontCommand{\textalt}{\altstyle}% anniffiniedig % alternative style
\DeclareTextFontCommand{\textreg}{\regstyle}% anniffiniedig % `regular' style
\DeclareTextFontCommand{\emboss}{\embossstyle}% anniffiniedig
\DeclareTextFontCommand{\textorn}{\ornamentalstyle}% anniffiniedig % intended primarily for decorative initials etc.
\DeclareTextFontCommand{\textqt}{\qtstyle}% anniffiniedig
\DeclareTextFontCommand{\textsh}{\shstyle}% anniffiniedig % shadowed style
\DeclareTextFontCommand{\texttm}{\tmstyle}% anniffiniedig
\DeclareTextFontCommand{\texttv}{\tvstyle}% anniffiniedig
\DeclareTextFontCommand{\textl}{\lstyle}% anniffiniedig
\DeclareTextFontCommand{\texto}{\ostyle}% anniffiniedig
\DeclareTextFontCommand{\textp}{\pstyle}% anniffiniedig
\DeclareTextFontCommand{\textt}{\tstyle}% anniffiniedig
\DeclareTextFontCommand{\textpl}{\plstyle}% anniffiniedig
\DeclareTextFontCommand{\textpo}{\postyle}% anniffiniedig
\DeclareTextFontCommand{\texttl}{\tlstyle}% anniffiniedig
\DeclareTextFontCommand{\textto}{\tostyle}% anniffiniedig
\DeclareTextFontCommand{\textol}{\olshape}% anniffiniedig   % outline
\DeclareTextFontCommand{\textswash}{\swashstyle}% anniffiniedig % an attempt to improve on \textsw
\DeclareTextFontCommand{\textu}{\ushape}% anniffiniedig       % be' yw hwn?! <_ underlined?
\DeclareTextFontCommand{\textscu}{\scushape}% anniffiniedig
\DeclareTextFontCommand{\textui}{\uishape}% anniffiniedig   % upright italic
\DeclareTextFontCommand{\textri}{\rishape}% anniffiniedig   % reverse italic
\DeclareTextFontCommand{\textnw}{\nwwidth}% anniffiniedig
\DeclareTextFontCommand{\textcd}{\cdwidth}% anniffiniedig
\DeclareTextFontCommand{\textec}{\ecwidth}% anniffiniedig
\DeclareTextFontCommand{\textuc}{\ucwidth}% anniffiniedig
\DeclareTextFontCommand{\textet}{\etwidth}% anniffiniedig
\DeclareTextFontCommand{\textep}{\epwidth}% anniffiniedig
\DeclareTextFontCommand{\textex}{\exwidth}% anniffiniedig
\DeclareTextFontCommand{\textux}{\uxwidth}% anniffiniedig
\DeclareTextFontCommand{\textrw}{\regwidth}% anniffiniedig
\DeclareTextFontCommand{\textmb}{\mbweight}% anniffiniedig
\DeclareTextFontCommand{\textdb}{\dbweight}% anniffiniedig
\DeclareTextFontCommand{\textbd}{\bdweight}% new?
\DeclareTextFontCommand{\textsb}{\sbweight}% anniffiniedig
\DeclareTextFontCommand{\texteb}{\ebweight}% anniffiniedig
\DeclareTextFontCommand{\textub}{\ubweight}% anniffiniedig
\DeclareTextFontCommand{\textlg}{\lgweight}% anniffiniedig
\DeclareTextFontCommand{\textel}{\elweight}% anniffiniedig
\DeclareTextFontCommand{\textul}{\ulweight}% anniffiniedig
\patchcmd{\init@series@setup}{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt}{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt,clm,clm2,clm2j,clmj,clm2js,clm2s,clmjs,clms,clm2jt,clm2t,clmjt,clmt,clm2jv,clm2v,clmjv,clmv,clm2jqs,clm2qs,clmjqs,clmqs}{%
  \PackageWarning{nfssext-cfr}{%
    Patching font initialisation macro for serif.%
  }%
}{%
  \PackageWarning{nfssext-cfr}{%
    Failed to patch font initialisation macro for serif.%
  }%
}
\patchcmd{\init@series@setup}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt}}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt,clm,clm2,clm2j,clmj,clm2js,clm2s,clmjs,clms,clm2jt,clm2t,clmjt,clmt,clm2jv,clm2v,clmjv,clmv,clm2jqs,clm2qs,clmjqs,clmqs}}{%
  \PackageWarning{nfssext-cfr}{%
    Patching font initialisation macro for sans.%
  }%
}{%
  \PackageWarning{nfssext-cfr}{%
    Failed to patch font initialisation macro for sans.%
  }%
}
\patchcmd{\init@series@setup}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt}}{{cmr,cmss,cmtt,lcmss,lcmtt,lmr,lmss,lmtt,clm,clm2,clm2j,clmj,clm2js,clm2s,clmjs,clms,clm2jt,clm2t,clmjt,clmt,clm2jv,clm2v,clmjv,clmv,clm2jqs,clm2qs,clmjqs,clmqs}}{%
  \PackageWarning{nfssext-cfr}{%
    Patching font initialisation macro for typewriter.%
  }%
}{%
  \PackageWarning{nfssext-cfr}{%
    Failed to patch font initialisation macro for typewriter.%
  }%
}
\endinput
%%
%% End of file `nfssext-cfr-nnfss.sty'.
