% \iffalse meta-comment
%
% Copyright (C) 2019-2020
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It 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 file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%
%<*driver>
% \fi
%
%
\ProvidesFile{lttextcomp.dtx}
             [2020/02/20 v1.0c LaTeX Kernel (text companion symbols)]
% \iffalse
\documentclass{ltxdoc}
\begin{document}
\DocInput{lttextcomp.dtx}
\end{document}
%</driver>
% \fi
%
%
%
%
% \GetFileInfo{lttextcomp.dtx}
% \title{Providing addtional text symbols\\
%        (previously available through the \texttt{textcomp} package)\thanks
%       {This file has version number
%       \fileversion\ dated \filedate}}
%
% \author{Frank Mittelbach}
%
% \MaintainedByLaTeXTeam{latex}
% \maketitle
%
% This file contains the implementation for accessing the glyphs
% provided by the \texttt{TS1} encoding (Text Companion
% Encoding). This is now offered as part of the kernel and so the
% \texttt{textcomp} package which used to provide the definitions is
% now mainly needed for compatibility reasons (and doesn't do much any
% more).
%
%
%
% \StopEventually{}
%
%
%  \begin{macro}{\oldstylenums}
%  \begin{macro}{\legacyoldstylenums}
%
%
%    Preserve the old definition of \cs{oldstylenums} under a different name.
%
%    This macro implements old style numerals but only works if we
%    assume that the standard math fonts are used. Thus it needs
%    changing in case other math encodings are used.
%    \begin{macrocode}
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/02/02}%
%<latexrelease>                 {\oldstylenums}{Old style numerals}%
\DeclareRobustCommand\legacyoldstylenums[1]{%
   \begingroup
%    \end{macrocode}
%    Provide spacing using the interword space of the current font.
%    \begin{macrocode}
    \spaceskip\fontdimen\tw@\font
%    \end{macrocode}
%    Then switch to the math italic font. We don't change the current
%    value of |\f@series| which means that you can use bold numerals
%    if |\bfseries| is in force. As family we use |\rmdefault| which
%    means that this only works if there exist an |OML| encoded
%    version of that font or rather a corresponding |.fd| file (which
%    is the case for standard \LaTeX{} fonts even though they only
%    contain substitutions).
% \changes{v3.0j}{1999/02/12}{Use \cs{rmdefault} instead of \texttt{cmm}
%                 (pr/2954)}
%    \begin{macrocode}
    \usefont{OML}{\rmdefault}{\f@series}{it}%
    \mathgroup\symletters #1%
   \endgroup
}
%    \end{macrocode}
%
%    And here is the improved one that adjusts depending on surroundings.
%    \begin{macrocode}
\DeclareRobustCommand\oldstylenums[1]{%
 \begingroup
 \ifmmode
   \mathgroup\symletters #1%
  \else
%    \end{macrocode}
%    The \cs{CheckEncodingSubset} is discused below.
%    \begin{macrocode}
   \CheckEncodingSubset\@use@text@encoding{TS1}\tc@oldstylesubst2{{#1}}%
 \fi
 \endgroup
}
%    \end{macrocode}
%    The helper to select the substitution if needed.
%    \begin{macrocode}
\def\tc@oldstylesubst#1{%
   \tc@errorwarn
          {Oldstyle digits unavailable for
           family \f@family.\MessageBreak
           Default oldstyle digits used instead}\@eha
  \bgroup
      \expand@font@defaults
%    \end{macrocode}
%    The substitution defaults are provided in the file \texttt{fonttext.ltx}.
%    \begin{macrocode}
      \ifx\f@family\rmdef@ult
         \fontfamily\rmsubstdefault
      \else\ifx\f@family\sfdef@ult
         \fontfamily\sfsubstdefault
      \else\ifx\f@family\ttdef@ult
         \fontfamily\ttsubstdefault
      \else
        \fontfamily\textcompsubstdefault
      \fi\fi\fi
      \fontencoding{TS1}\selectfont#1%
  \egroup
}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
% \begin{macro}{\textcompsubstdefault}
%    Here is the default for the ``unknown'' case:
%    \begin{macrocode}
\def\textcompsubstdefault{\rmsubstdefault}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\oldstylenums}{Old style numerals}%
%<latexrelease>
%<latexrelease>\DeclareRobustCommand\oldstylenums[1]{%
%<latexrelease>   \begingroup
%<latexrelease>    \spaceskip\fontdimen\tw@\font
%<latexrelease>    \usefont{OML}{\rmdefault}{\f@series}{it}%
%<latexrelease>    \mathgroup\symletters #1%
%<latexrelease>   \endgroup
%<latexrelease>}
%<latexrelease>\let\legacyoldstylenums\@undefined
%<latexrelease>\def\textcompsubstdefault{cmr}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
%





%    Everything else in the this file got introduced 2020/02/02, so we do a
%    single rollback (for now).
%    \begin{macrocode}
%<*2ekernel>
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/02/02}%
%<latexrelease>   {\DeclareEncodingSubset}{Text companion symbols}%
%    \end{macrocode}
%
%
%
%  \begin{macro}{\DeclareEncodingSubset}
%
%     The declaration takes 3 mandatory arguments: an \emph{encoding}
%    for which a subsetting is wanted (currently always \texttt{TS1},
%    and most likely forever), the \emph{font family} for which we
%    declare the subset and finally the \emph{subset} number (between \texttt{0} (all
%    of the encoding is supported) and \texttt{9} many glyphs are missing.
%
%    For \texttt{TS1} the numbers have been choosen in a way that most
%    fonts can be fairly correctly categorized, but the default
%    settings are always conservative, that is they may claim that
%    less glyphs are supported than there actually are.
%
%    As these days many font families are set up to end in \texttt{-LF}
%    (lining figures), \texttt{-OsF} (oldstyle figures), etc.\ the
%    declaration supports a shortcut: if the \emph{font family} name
%    ends in \texttt{-*} then the star gets replaced by these common
%    ending, e.g.,
%\begin{verbatim}
% \DeclareEncodingSubset{TS1}{Alegreya-*}{2}
%\end{verbatim}
%    is the same as writing
%\begin{verbatim}
% \DeclareEncodingSubset{TS1}{Alegreya-LF}{2}
% \DeclareEncodingSubset{TS1}{Alegreya-OsF}{2}
% \DeclareEncodingSubset{TS1}{Alegreya-TLF}{2}
% \DeclareEncodingSubset{TS1}{Alegreya-TOsF}{2}
%\end{verbatim}
%    If only some are needed then one can define them individually but
%    in many cases all four are wanted, hence the shortcut.
%
%
%    The coding of the declaration has no error checking as it is
%    mostly for internal use.
%    \begin{macrocode}
\def\DeclareEncodingSubset#1#2{%
  \DeclareEncodingSubset@aux{#1}#2*\DeclareEncodingSubset@aux
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\DeclareEncodingSubset@aux#1#2*#3\DeclareEncodingSubset@aux#4{%
%    \end{macrocode}
%    if \verb=#3= is empty then there was no star, otherwise we
%    define all four variants.
%    \begin{macrocode}
  \expandafter\ifx\expandafter X\detokenize{#3}X%
    \@DeclareEncodingSubset{#1}{#2}{#4}%
  \else
    \@DeclareEncodingSubset{#1}{#2LF}{#4}%
    \@DeclareEncodingSubset{#1}{#2TLF}{#4}%
    \@DeclareEncodingSubset{#1}{#2OsF}{#4}%
    \@DeclareEncodingSubset{#1}{#2TOsF}{#4}%
  \fi
}
%    \end{macrocode}
%
%    The subset info is stored in a command with the name
%    \texttt{\bslash}\emph{family}\texttt{:}\emph{subset} so if that
%    already exists we change otherwise declare a subset.
%    \begin{macrocode}
\def\@DeclareEncodingSubset#1#2#3{%
   \@ifundefined{#1:#2}%
     {\@font@info{Setting #2 sub-encoding to #1/#3}}%
     {\@font@info{Changing #2 sub-encoding to #1/#3}}%
     \@namedef{#1:#2}{#3}}
%    \end{macrocode}
%
%    Any reason to allow those in the middle of documents?
%    \begin{macrocode}
\@onlypreamble\DeclareEncodingSubset
\@onlypreamble\DeclareEncodingSubset@aux
\@onlypreamble\@DeclareEncodingSubset
%    \end{macrocode}
%  \end{macro}


% \begin{macro}{\CheckEncodingSubset}
%    The command |\CheckEncodingSubset| will check if the current font
%    family has the right encoding subset to typeset a certain
%    command. It takes five arguments as follows:
%    first argument is either |\UseTextSymbol|, |\UseTextAccent|
%    depending on whether or not the symbol is a text symbol or a text
%    accent.

%    The second argument is the encoding from which this symbol should
%    be fetched.
%
%    The third argument is either a fake accessor command or an error
%    message. the code in that argument (if ever executed) receives
%    two arguments: |#2| and |#5| of |\CheckEncodingSubset|.
%
%    Argument four is the subset encoding id to test against: if this
%    value is higher than the subset id of the current font family
%    then we typeset the symbol, i.e., execute |#1{#2}#5| otherwise
%    it runs |#3#5|, e.g., to produce an error message or fake the
%    glyph somehow.
%
%    Argument five is the symbol or accent command that is being
%    checked.
%
%    For usage examples see definitions below.
%
%    \begin{macrocode}
\def\CheckEncodingSubset#1#2#3#4#5{%
    \ifnum #4>%
      \expandafter\ifx\csname #2:\f@family\endcsname\relax
        0\csname #2:?\endcsname
      \else
        \csname #2:\f@family\endcsname
      \fi
   \relax
   \expandafter\@firstoftwo
  \else
   \expandafter\@secondoftwo
 \fi
  {#1{#2}}{#3}%
  #5%
}
%    \end{macrocode}
% \end{macro}





% To set up the glyphs for the subsets we need a number helpers.
%
%  \begin{macro}{\tc@errorwarn}
%    To we produce errors, warnings, or only info in the transcripts
%    if glyphs require substitutions? By default it is ``info''
%    only. With the \texttt{textcomp} package that can be changed.
%    \begin{macrocode}
\def\tc@errorwarn#1#2{\@latex@info{#1}}
%    \end{macrocode}
%  \end{macro}


%  \begin{macro}{\tc@subst}
%
% \changes{v1.0b}{2020/01/22}{The overall default is \cs{textcompsubstdefault}
%      not \cs{substdefault}}
%    \begin{macrocode}
\def\tc@subst#1{%
   \tc@errorwarn
    {Symbol \string#1 not provided by\MessageBreak
     font family \f@family\space
     in TS1 encoding.\MessageBreak Default family used instead}\@eha
  \bgroup
      \expand@font@defaults
      \ifx\f@family\rmdef@ult
         \fontfamily\rmsubstdefault
      \else\ifx\f@family\sfdef@ult
         \fontfamily\sfsubstdefault
      \else\ifx\f@family\ttdef@ult
         \fontfamily\ttsubstdefault
      \else
         \fontfamily\textcompsubstdefault
      \fi\fi\fi
%    \end{macrocode}
%    Whatever default was chosen, we claim now (locally hopefully)
%    that it  can handle all slots (even if not true) to avoid looping
%    in certain situations, e.g., when something was set up incorrectly.
%    \begin{macrocode}
      \@namedef{TS1:\f@family}{0}%
      \selectfont#1%
  \egroup
}
%    \end{macrocode}
%  \end{macro}




% \begin{macro}{\tc@fake@euro}
%    |\tc@fake@euro|  is an example of a ``fake'' definition to use in  arg |#3| of
%    |\CheckEncodingSubset| when a symbol is not available in a
%    certain font family. Here we produce a poor man's Euro symbol by combining
%    a ``C'' with a ``=''.
%    \begin{macrocode}
\def\tc@fake@euro#1{%
   \leavevmode
   \@font@info{Faking \noexpand#1for font family
                          \f@family\MessageBreak in TS1 encoding}%
   \valign{##\cr
      \vfil\hbox to 0.07em{\dimen@\f@size\p@
                           \math@fontsfalse
                           \fontsize{.7\dimen@}\z@\selectfont=\hss}%
      \vfil\cr%
      \hbox{C}\crcr
   }%
}
%    \end{macrocode}
% \end{macro}




% \begin{macro}{\tc@check@symbol}
% \begin{macro}{\tc@check@accent}
%    These are two abbreviations that we use below to check symbols
%    and accents in TS1. Only there to save some space, e.g., we can
%    then write
%\begin{verbatim}
%\DeclareTextCommandDefault{\textcurrency}{\tc@check@symbol3\textcurrency}
%\end{verbatim}
%    to ensure that |\textcurrency| is only typeset if the current
%    font has a \texttt{TS1} subset id of less than 3. Otherwise
%    |\tc@error| is called telling the user that for this font family
%    |\textcurreny| is not available.
%    \begin{macrocode}
\def\tc@check@symbol{\CheckEncodingSubset\UseTextSymbol{TS1}\tc@subst}
%    \end{macrocode}
%
%    Accents and been mad an error in the \texttt{textcomp} package when
%    not available. Now that we provide the functionality in the
%    kernel we avoid the eror by swapping in a \texttt{T1} accent if
%    the \texttt{TS1} accent is not available.
%    \begin{macrocode}
%\def\tc@check@accent{\CheckEncodingSubset\UseTextAccent{TS1}\tc@error}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\tc@check@accent#1{\CheckEncodingSubset\UseTextAccent{TS1}{\tc@swap@accent#1}}
\def\tc@swap@accent#1#2{\UseTextAccent{T1}#1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%

% \section{Sub-encodings}
%
%    Here are the default definitions for the \texttt{TS1} symbols.
%    First those that we assume are always available if a font
%    implements \texttt{TS1}.
%
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textdollar}{TS1}
\UndeclareTextCommand{\textdollar}  {OT1}         % don't use the OT1 def any longer
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textsterling}{TS1}
\UndeclareTextCommand{\textsterling}{OT1}         % don't use the OT1 def any longer
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textperthousand}{TS1}
\UndeclareTextCommand{\textperthousand}{T1}       % don't use the T1 def
%    \end{macrocode}
%    Using \cs{UndeclareTextCommand} above is enough only if the
%    encoding definition files are not reloaded afterwards. In the
%    past that happened if \texttt{fontenc} was used in the document
%    preamble (not any longer). So in some sense it is better to fully remove
%    them from the encoding files, but for rollbacks it is easier to
%    keep them in for now.
%
%    These are the standard \texttt{itemize} and footnote symbols
%    originally taken from \texttt{OMS} and now from \texttt{TS1}:
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textasteriskcentered}{TS1}
\DeclareTextSymbolDefault{\textbullet}{TS1}
\DeclareTextSymbolDefault{\textdaggerdbl}{TS1}
\DeclareTextSymbolDefault{\textdagger}{TS1}
\DeclareTextSymbolDefault{\textparagraph}{TS1}
\DeclareTextSymbolDefault{\textperiodcentered}{TS1}
\DeclareTextSymbolDefault{\textsection}{TS1}
%    \end{macrocode}
%
%    And here are the other \texttt{TS1} glyphs that are implemented
%    by every font (or nearly everyone---a few are commented out and
%    moved to sub-encoding 9,
%    because they aren't around in one or two fonts.
%    \begin{macrocode}
%%\DeclareTextSymbolDefault{\textbardbl}{TS1} % subst in sub-enc 9 above
\DeclareTextSymbolDefault{\textbrokenbar}{TS1}
%%\DeclareTextSymbolDefault{\textcelsius}{TS1} % subst in sub-enc 9 above
\DeclareTextSymbolDefault{\textcent}{TS1}
\DeclareTextSymbolDefault{\textcopyright}{TS1}
\DeclareTextSymbolDefault{\textdegree}{TS1}
\DeclareTextSymbolDefault{\textdiv}{TS1}
\DeclareTextSymbolDefault{\textlnot}{TS1}
\DeclareTextSymbolDefault{\textonehalf}{TS1}
\DeclareTextSymbolDefault{\textonequarter}{TS1}
%%\DeclareTextSymbolDefault{\textonesuperior}{TS1} % subst in sub-enc 9 above
\DeclareTextSymbolDefault{\textordfeminine}{TS1}
\DeclareTextSymbolDefault{\textordmasculine}{TS1}
\DeclareTextSymbolDefault{\textpm}{TS1}
\DeclareTextSymbolDefault{\textquotesingle}{TS1}
\DeclareTextSymbolDefault{\textquotestraightbase}{TS1}
\DeclareTextSymbolDefault{\textquotestraightdblbase}{TS1}
\DeclareTextSymbolDefault{\textregistered}{TS1}
%%\DeclareTextSymbolDefault{\textthreequartersemdash}{TS1} % subst in sub-enc 9 above
\DeclareTextSymbolDefault{\textthreequarters}{TS1}
%%\DeclareTextSymbolDefault{\textthreesuperior}{TS1} % subst in sub-enc 9 above
\DeclareTextSymbolDefault{\texttimes}{TS1}
\DeclareTextSymbolDefault{\texttrademark}{TS1}
%%\DeclareTextSymbolDefault{\texttwelveudash}{TS1} % subst in sub-enc 9 above
%%\DeclareTextSymbolDefault{\texttwosuperior}{TS1} % subst in sub-enc 9 above
\DeclareTextSymbolDefault{\textyen}{TS1}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textcapitalcompwordmark}{TS1}
\DeclareTextSymbolDefault{\textascendercompwordmark}{TS1}
%    \end{macrocode}
%
%
%    In the following sections the remaining default definitions are ordered by
%    sub-encoding in which they are become unavailable (i.e., they are
%    not provided in the sub-encoding with that number and all
%    sub-encodings with higher numbers.
%
%    Thus the symbols that are available in sub-encoding $x$ are the
%    symbols above (always available) and the symbols list in the
%    sections for sub-encodings $x+1$ and higher.
%
% \subsection{Sub-encoding \texttt{1} (drop symbols not working in
%    Latin Modern)}
%
%    The \cs{textcircled} is available but the glyph is simply too
%    small so we keep using the \texttt{OMS} glyph.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textcircled}
  {\CheckEncodingSubset\UseTextAccent{TS1}{\UseTextAccent{OMS}}1\textcircled}
%    \end{macrocode}
%
%
%
%
%
% \subsection{Sub-encoding \texttt{2} (majority of new OTF fonts via autoinst)}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\t}
  {\CheckEncodingSubset\UseTextAccent{TS1}{\UseTextAccent{OML}}2\t}
%    \end{macrocode}
%
%    Capital  accents are really only very seldom implemented, so from
%    sub-encoding \texttt{2} onwards we use the normal \texttt{T1}
%    accents if they are asked for in the document.
%
%    In Unicode engines we don't implement them at all but always use
%    the basic accents instead. whether that works or not really
%    depends on the font, something like \verb=\"X= usually comes out
%    wrong in Unicode engines.
%
%    \begin{macrocode}
\ifx\Umathcode\@undefined
  \DeclareTextCommandDefault{\capitalacute}       {\tc@check@accent{\'}2\capitalacute}
  \DeclareTextCommandDefault{\capitalbreve}       {\tc@check@accent{\u}2\capitalbreve}
  \DeclareTextCommandDefault{\capitalcaron}       {\tc@check@accent{\v}2\capitalcaron}
  \DeclareTextCommandDefault{\capitalcedilla}     {\tc@check@accent{\c}2\capitalcedilla}
  \DeclareTextCommandDefault{\capitalcircumflex}  {\tc@check@accent{\^}2\capitalcircumflex}
  \DeclareTextCommandDefault{\capitaldieresis}    {\tc@check@accent{\"}2\capitaldieresis}
  \DeclareTextCommandDefault{\capitaldotaccent}   {\tc@check@accent{\.}2\capitaldotaccent}
  \DeclareTextCommandDefault{\capitalgrave}       {\tc@check@accent{\`}2\capitalgrave}
  \DeclareTextCommandDefault{\capitalhungarumlaut}{\tc@check@accent{\H}2\capitalhungarumlaut}
  \DeclareTextCommandDefault{\capitalmacron}      {\tc@check@accent{\=}2\capitalmacron}
  \DeclareTextCommandDefault{\capitalogonek}      {\tc@check@accent{\k}2\capitalogonek}
  \DeclareTextCommandDefault{\capitalring}        {\tc@check@accent{\r}2\capitalring}
  \DeclareTextCommandDefault{\capitaltie}         {\tc@check@accent{\t}2\capitaltie}
  \DeclareTextCommandDefault{\capitaltilde}       {\tc@check@accent{\~}2\capitaltilde}
%    \end{macrocode}
%    For \cs{newtie} and \cs{capitalnewtie} this is actually wrong, they should pick up
%    the accent from the substitution font (not done yet).
%    \begin{macrocode}
  \DeclareTextCommandDefault{\newtie}             {\tc@check@accent{\t}2\newtie}
  \DeclareTextCommandDefault{\capitalnewtie}      {\tc@check@accent{\t}2\capitalnewtie}
%    \end{macrocode}
%
%    In Unicode engines we just execute the simple accents:
% \changes{v1.0c}{2020/02/10}{Use \cs{@tabacckludge} for tabbing where necessary (gh/271)}
%    \begin{macrocode}
\else
  \def\capitalacute{\@tabacckludge'}
  \def\capitalbreve{\u}
  \def\capitalcaron{\v}
  \def\capitalcedilla{\c}
  \def\capitalcircumflex{\^}
  \def\capitaldieresis{\"}
  \def\capitaldotaccent{\.}
  \def\capitalgrave{\@tabacckludge`}
  \def\capitalhungarumlaut{\H}
  \def\capitalmacron{\@tabacckludge=}
  \def\capitalnewtie{\t}
  \def\capitalogonek{\k}
  \def\capitalring{\r}
  \def\capitaltie{\t}
  \def\capitaltilde{\~}
  \def\newtie{\t}
\fi
%    \end{macrocode}
%
%
%
%
%    The next two symbols exist in some fonts (faked?), but we ignore
%    that to keep the subsets reasonable compact and most important linear.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textlbrackdbl}      {\tc@check@symbol2\textlbrackdbl}
\DeclareTextCommandDefault{\textrbrackdbl}      {\tc@check@symbol2\textrbrackdbl}
%    \end{macrocode}
%
%
%    Old style numerals are again in some fonts but using
%    \texttt{-OsF}, etc.\ is the better approach to get them, so we
%    claim they aren't in sub-encoding 2 as that's true for most
%    fonts.
%    \begin{macrocode}
\DeclareTextCommandDefault{\texteightoldstyle}  {\tc@check@symbol2\texteightoldstyle}
\DeclareTextCommandDefault{\textfiveoldstyle}   {\tc@check@symbol2\textfiveoldstyle}
\DeclareTextCommandDefault{\textfouroldstyle}   {\tc@check@symbol2\textfouroldstyle}
\DeclareTextCommandDefault{\textnineoldstyle}   {\tc@check@symbol2\textnineoldstyle}
\DeclareTextCommandDefault{\textoneoldstyle}    {\tc@check@symbol2\textoneoldstyle}
\DeclareTextCommandDefault{\textsevenoldstyle}  {\tc@check@symbol2\textsevenoldstyle}
\DeclareTextCommandDefault{\textsixoldstyle}    {\tc@check@symbol2\textsixoldstyle}
\DeclareTextCommandDefault{\textthreeoldstyle}  {\tc@check@symbol2\textthreeoldstyle}
\DeclareTextCommandDefault{\texttwooldstyle}    {\tc@check@symbol2\texttwooldstyle}
\DeclareTextCommandDefault{\textzerooldstyle}   {\tc@check@symbol2\textzerooldstyle}
%    \end{macrocode}
%
%
%
%    The next set of glyphs is special to TeX fonts (and available
%    with a few older PS fonts supported in the virtual fonts), but
%    not any longer in the majority of fonts provided through
%    autoinst, so we pretend there aren't available in sub-encoding 2
%    and below.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textacutedbl}       {\tc@check@symbol2\textacutedbl}
\DeclareTextCommandDefault{\textasciiacute}     {\tc@check@symbol2\textasciiacute}
\DeclareTextCommandDefault{\textasciibreve}     {\tc@check@symbol2\textasciibreve}
\DeclareTextCommandDefault{\textasciicaron}     {\tc@check@symbol2\textasciicaron}
\DeclareTextCommandDefault{\textasciidieresis}  {\tc@check@symbol2\textasciidieresis}
\DeclareTextCommandDefault{\textasciigrave}     {\tc@check@symbol2\textasciigrave}
\DeclareTextCommandDefault{\textasciimacron}    {\tc@check@symbol2\textasciimacron}
\DeclareTextCommandDefault{\textgravedbl}       {\tc@check@symbol2\textgravedbl}
\DeclareTextCommandDefault{\texttildelow}       {\tc@check@symbol2\texttildelow}
%    \end{macrocode}
%
%
%    Finally those below are only available in CM-based fonts but in
%    no font that has its origin outside of the \TeX{} world.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textbaht}           {\tc@check@symbol2\textbaht}
\DeclareTextCommandDefault{\textbigcircle}      {\tc@check@symbol2\textbigcircle}
\DeclareTextCommandDefault{\textborn}           {\tc@check@symbol2\textborn}
\DeclareTextCommandDefault{\textcentoldstyle}   {\tc@check@symbol2\textcentoldstyle}
\DeclareTextCommandDefault{\textcircledP}       {\tc@check@symbol2\textcircledP}
\DeclareTextCommandDefault{\textcopyleft}       {\tc@check@symbol2\textcopyleft}
\DeclareTextCommandDefault{\textdblhyphenchar}  {\tc@check@symbol2\textdblhyphenchar}
\DeclareTextCommandDefault{\textdblhyphen}      {\tc@check@symbol2\textdblhyphen}
\DeclareTextCommandDefault{\textdied}           {\tc@check@symbol2\textdied}
\DeclareTextCommandDefault{\textdiscount}       {\tc@check@symbol2\textdiscount}
\DeclareTextCommandDefault{\textdivorced}       {\tc@check@symbol2\textdivorced}
\DeclareTextCommandDefault{\textdollaroldstyle} {\tc@check@symbol2\textdollaroldstyle}
\DeclareTextCommandDefault{\textguarani}        {\tc@check@symbol2\textguarani}
\DeclareTextCommandDefault{\textleaf}           {\tc@check@symbol2\textleaf}
\DeclareTextCommandDefault{\textlquill}         {\tc@check@symbol2\textlquill}
\DeclareTextCommandDefault{\textmarried}        {\tc@check@symbol2\textmarried}
\DeclareTextCommandDefault{\textmho}            {\tc@check@symbol2\textmho}
\DeclareTextCommandDefault{\textmusicalnote}    {\tc@check@symbol2\textmusicalnote}
\DeclareTextCommandDefault{\textnaira}          {\tc@check@symbol2\textnaira}
\DeclareTextCommandDefault{\textopenbullet}     {\tc@check@symbol2\textopenbullet}
\DeclareTextCommandDefault{\textpeso}           {\tc@check@symbol2\textpeso}
\DeclareTextCommandDefault{\textpilcrow}        {\tc@check@symbol2\textpilcrow}
\DeclareTextCommandDefault{\textrecipe}         {\tc@check@symbol2\textrecipe}
\DeclareTextCommandDefault{\textreferencemark}  {\tc@check@symbol2\textreferencemark}
\DeclareTextCommandDefault{\textrquill}         {\tc@check@symbol2\textrquill}
\DeclareTextCommandDefault{\textservicemark}    {\tc@check@symbol2\textservicemark}
\DeclareTextCommandDefault{\textsurd}           {\tc@check@symbol2\textsurd}
%    \end{macrocode}
%
%    The \cs{textpertenthousand} also belongs in this group but here
%    we have a choice: in T1 there is definition for
%    \cs{textpertenthousand} making the symbol up from \% and
%    \verb=\char 24= (twice) but in many fonts that char doesn't exist
%    and the slot is reused for random ligatures. So better not use it
%    because often it is wrong.  But pointing to TS1 is also not great
%    as only a few fonts have it as a real symbol, so we get a
%    substitution to CM or LM.
%
%    Alternatively we could just state that the symbol is unavailable in
%    those fonts. For now I substitute.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textpertenthousand} {\tc@check@symbol2\textpertenthousand}
\UndeclareTextCommand{\textpertenthousand}{T1}
%    \end{macrocode}
%
%
%
% \subsection{Sub-encoding \texttt{3}}
%
%    Sub-encoding \texttt{2} is the one where we loose many
%    symbols. In the higher-numbered sub-encodings we see only a few
%    dropped additionally.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textlangle}         {\tc@check@symbol3\textlangle}
\DeclareTextCommandDefault{\textrangle}         {\tc@check@symbol3\textrangle}
%    \end{macrocode}
%
%
%
%
%
% \subsection{Sub-encoding \texttt{4}}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textcolonmonetary}  {\tc@check@symbol4\textcolonmonetary}
\DeclareTextCommandDefault{\textdong}           {\tc@check@symbol4\textdong}
\DeclareTextCommandDefault{\textdownarrow}      {\tc@check@symbol4\textdownarrow}
\DeclareTextCommandDefault{\textleftarrow}      {\tc@check@symbol4\textleftarrow}
\DeclareTextCommandDefault{\textlira}           {\tc@check@symbol4\textlira}
\DeclareTextCommandDefault{\textrightarrow}     {\tc@check@symbol4\textrightarrow}
\DeclareTextCommandDefault{\textuparrow}        {\tc@check@symbol4\textuparrow}
\DeclareTextCommandDefault{\textwon}            {\tc@check@symbol4\textwon}
%    \end{macrocode}
%
%
%
%
%
% \subsection{Sub-encoding \texttt{5} (most older PS fonts)}
%
%    Most older PS fonts (supported in \TeX{} since the early nineties
%    when virtual fonts became available) are sorted under this
%    sub-encoding. But in reality, many of them don't have all glpyhs
%    that should be available in sub-encoding \texttt{5}. Instead they
%    show little squares, i.e., they produce ``tofu'' if you are
%    unlucky.
%
%    But the coverage is so random that it is impossible to sort them
%    properly and if we tried to ensure that they only typeset those
%    glyphs that are really  always available wouput put them all into
%    sub-encoding \texttt{9} so that's a compromise really.
%
%    Modern fonts that don't typeset a tofu character if a glyph is
%    missing are only cataloged as sub-encoding \texttt{5} if they
%    really support of its glyph set.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textestimated}      {\tc@check@symbol5\textestimated}
\DeclareTextCommandDefault{\textnumero}         {\tc@check@symbol5\textnumero}
%    \end{macrocode}
%
%
%
%
% \subsection{Sub-encoding \texttt{6}}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textflorin}         {\tc@check@symbol6\textflorin}
\DeclareTextCommandDefault{\textcurrency}       {\tc@check@symbol6\textcurrency}
%    \end{macrocode}
%
%
%
% \subsection{Sub-encoding \texttt{7}}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textfractionsolidus}{\tc@check@symbol7\textfractionsolidus}
\DeclareTextCommandDefault{\textohm}            {\tc@check@symbol7\textohm}
\DeclareTextCommandDefault{\textmu}             {\tc@check@symbol7\textmu}
\DeclareTextCommandDefault{\textminus}          {\tc@check@symbol7\textminus}
%    \end{macrocode}
%
%
%
% \subsection{Sub-encoding \texttt{8}}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textblank}          {\tc@check@symbol{8}\textblank}
\DeclareTextCommandDefault{\textinterrobangdown}{\tc@check@symbol{8}\textinterrobangdown}
\DeclareTextCommandDefault{\textinterrobang}    {\tc@check@symbol{8}\textinterrobang}
%    \end{macrocode}
%
%    Fonts with this sub-encoding don't have a Euro symbol, but
%    instead of substituting we fake it.
%    \begin{macrocode}
\DeclareTextCommandDefault{\texteuro}
            {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@fake@euro{8}\texteuro}
%    \end{macrocode}
%
%
%
%
% \subsection{Sub-encoding \texttt{9} (most missing)}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textcelsius}{\tc@check@symbol{9}\textcelsius}
\DeclareTextCommandDefault{\textonesuperior}{\tc@check@symbol{9}\textonesuperior}
\DeclareTextCommandDefault{\textthreequartersemdash}{\tc@check@symbol{9}\textthreequartersemdash}
\DeclareTextCommandDefault{\textthreesuperior}{\tc@check@symbol{9}\textthreesuperior}
\DeclareTextCommandDefault{\texttwelveudash}{\tc@check@symbol{9}\texttwelveudash}
\DeclareTextCommandDefault{\texttwosuperior}{\tc@check@symbol{9}\texttwosuperior}
\DeclareTextCommandDefault{\textbardbl}{\tc@check@symbol{9}\textbardbl}
%    \end{macrocode}
%
%
%
%
% \section{Unicode engine specials}
%
%    If we are using a unicode engine we handle some glyphs differently,
%    so this here are the definitions for the Unicode encoding
%    (overwriting the defaults above).

%    \begin{macrocode}
\ifx \Umathcode\@undefined  \else
%    \end{macrocode}
%
%    This set should be taken from \texttt{TS1} encoding even if it
%    means you get it from the default font for that encoding.
%    \begin{macrocode}
%\DeclareTextSymbol{\textcopyleft}{TS1}{171}
%\DeclareTextSymbol{\textdblhyphen}{TS1}{45}
%\DeclareTextSymbol{\textdblhyphenchar}{TS1}{127}
%\DeclareTextSymbol{\textquotestraightbase}{TS1}{13}
%\DeclareTextSymbol{\textquotestraightdblbase}{TS1}{18}
%\DeclareTextSymbol{\textleaf}{TS1}{108}
%\DeclareTextSymbol{\texttwelveudash}{TS1}{21}
%\DeclareTextSymbol{\textthreequartersemdash}{TS1}{22}
%    \end{macrocode}
%
%    If oldstyle numerals are asked for we just use \cs{oldstylenums}.
%    \begin{macrocode}
\DeclareTextCommand{\textzerooldstyle} \UnicodeEncodingName{\oldstylenums{0}}
\DeclareTextCommand{\textoneoldstyle}  \UnicodeEncodingName{\oldstylenums{1}}
\DeclareTextCommand{\texttwooldstyle}  \UnicodeEncodingName{\oldstylenums{2}}
\DeclareTextCommand{\textthreeoldstyle}\UnicodeEncodingName{\oldstylenums{3}}
\DeclareTextCommand{\textfouroldstyle} \UnicodeEncodingName{\oldstylenums{4}}
\DeclareTextCommand{\textfiveoldstyle} \UnicodeEncodingName{\oldstylenums{5}}
\DeclareTextCommand{\textsixoldstyle}  \UnicodeEncodingName{\oldstylenums{6}}
\DeclareTextCommand{\textsevenoldstyle}\UnicodeEncodingName{\oldstylenums{7}}
\DeclareTextCommand{\texteightoldstyle}\UnicodeEncodingName{\oldstylenums{8}}
\DeclareTextCommand{\textnineoldstyle} \UnicodeEncodingName{\oldstylenums{9}}
%    \end{macrocode}
%    These have Unicode slots so this should be integrated into TU explictly
%    \begin{macrocode}
\DeclareTextSymbol{\textpilcrow}       \UnicodeEncodingName{"00B6}
\DeclareTextSymbol{\textborn}          \UnicodeEncodingName{"002A}
\DeclareTextSymbol{\textdied}          \UnicodeEncodingName{"2020}
\DeclareTextSymbol{\textlbrackdbl}     \UnicodeEncodingName{"27E6}
\DeclareTextSymbol{\textrbrackdbl}     \UnicodeEncodingName{"27E7}
\DeclareTextSymbol{\textguarani}       \UnicodeEncodingName{"20B2}
%    \end{macrocode}
%    We could make \cs{textcentoldstyle} and \cs{textdollaroldstyle}
%    point to dollar and cent in the Unicode encoding
%    \begin{macrocode}
%\DeclareTextSymbol{\textcentoldstyle}            \UnicodeEncodingName{"00A2}
%\DeclareTextSymbol{\textdollaroldstyle}          \UnicodeEncodingName{"0024}
%    \end{macrocode}
%    but I think it is better to pick them up from TS1 even if that
%    usually means LMR fonts
%    \begin{macrocode}
\DeclareTextSymbol{\textdollaroldstyle}{TS1}{138}
\DeclareTextSymbol{\textcentoldstyle}  {TS1}{139}
%    \end{macrocode}
%
%
%    \begin{macrocode}
\fi               % --- END of Unicode engines specials
%    \end{macrocode}
%
% \section{Font family sub-encodings setup}
%
%    We declare the subsets for a good number of fonts in the kernel
%    \ldots
%
%    But first the default for anything that is not declared.  We use
%    \texttt{9} which is most likely much too conservative, but with the
%    advantage that we aren't getting missing glyphs (or at least that
%    this is very unlikely).
%    For nearly all font in the \TeX{} Live distribution of 2019
%    ``correct'' classifications are given below, so that this default
%    is only used for new font families, and over time the right
%    classifications can be added here too.
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{?}{9}
%    \end{macrocode}
%
%    This first block contains the fonts that have been already
%    supported by the \texttt{textcomp} package way back, i.e., the
%    font families that have \TeX{} support since the mid-nineties.
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{ccr}     {0}
\DeclareEncodingSubset{TS1}{cmbr}    {0}
\DeclareEncodingSubset{TS1}{cmr}     {0}
\DeclareEncodingSubset{TS1}{cmss}    {0}
\DeclareEncodingSubset{TS1}{cmtl}    {0}
\DeclareEncodingSubset{TS1}{cmtt}    {0}
\DeclareEncodingSubset{TS1}{cmvtt}   {0}
\DeclareEncodingSubset{TS1}{pxr}     {0}
\DeclareEncodingSubset{TS1}{pxss}    {0}
\DeclareEncodingSubset{TS1}{pxtt}    {0}
\DeclareEncodingSubset{TS1}{qag}     {0}
\DeclareEncodingSubset{TS1}{qbk}     {0}
\DeclareEncodingSubset{TS1}{qcr}     {0}
\DeclareEncodingSubset{TS1}{qcs}     {0}
\DeclareEncodingSubset{TS1}{qhvc}    {0}
\DeclareEncodingSubset{TS1}{qhv}     {0}
\DeclareEncodingSubset{TS1}{qpl}     {0}
\DeclareEncodingSubset{TS1}{qtm}     {0}
\DeclareEncodingSubset{TS1}{qzc}     {0}
\DeclareEncodingSubset{TS1}{txr}     {0}
\DeclareEncodingSubset{TS1}{txss}    {0}
\DeclareEncodingSubset{TS1}{txtt}    {0}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{lmr}     {1}
\DeclareEncodingSubset{TS1}{lmdh}    {1}
\DeclareEncodingSubset{TS1}{lmss}    {1}
\DeclareEncodingSubset{TS1}{lmssq}   {1}
\DeclareEncodingSubset{TS1}{lmvtt}   {1}
\DeclareEncodingSubset{TS1}{lmtt}    {1} % missing TM, SM, pertenthousand for some reason
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{ptmx}    {2}
\DeclareEncodingSubset{TS1}{ptmj}    {2}
\DeclareEncodingSubset{TS1}{ul8}     {2}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{bch}     {5}  % tofu for blank, ohm
\DeclareEncodingSubset{TS1}{futj}    {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{futs}    {5}  % tofu for blank, ohm
\DeclareEncodingSubset{TS1}{futx}    {5}  % probably (currently broken distrib)
\DeclareEncodingSubset{TS1}{pag}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{pbk}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{pcr}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{phv}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{pnc}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{pplj}    {5}  % tofu for blank
\DeclareEncodingSubset{TS1}{pplx}    {5}  % tofu for blank
\DeclareEncodingSubset{TS1}{ppl}     {5}  % tofu for blank interrobang/down
\DeclareEncodingSubset{TS1}{ptm}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{pzc}     {5}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{ul9}     {5}  % tofu for blank, interrobang/down, ohm
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{dayroms} {6}  % tofu for blank, interrobang/down, ohm
\DeclareEncodingSubset{TS1}{dayrom}  {6}  % tofu for blank, interrobang/down, ohm
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{augie}   {8}  % really only missing euro
\DeclareEncodingSubset{TS1}{put}     {8}
\DeclareEncodingSubset{TS1}{uag}     {8}  % probably (currently broken distrib)
\DeclareEncodingSubset{TS1}{ugq}     {8}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{zi4}     {9}
%    \end{macrocode}
%    LucidaBright (sold through TUG) probably not quite correct, I
%    guess as I have the older fonts \ldots
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{hls}     {5}
\DeclareEncodingSubset{TS1}{hlst}    {5}
\DeclareEncodingSubset{TS1}{hlct}    {5}
\DeclareEncodingSubset{TS1}{hlh}     {5}
\DeclareEncodingSubset{TS1}{hlx}     {8}
\DeclareEncodingSubset{TS1}{hlce}    {8}
\DeclareEncodingSubset{TS1}{hlcn}    {8}
\DeclareEncodingSubset{TS1}{hlcw}    {8}
\DeclareEncodingSubset{TS1}{hlcf}    {8}
%    \end{macrocode}
%
%    Below are the newer fonts that have support files for
%    \LaTeX{}. With very few exceptions the classifications are done
%    so that all characters are correctly produced (either being
%    available in the font or substituted.
%
%    There are a few fonts that contain ``tofu'' squares in places
%    (instead of a real glyph) and in a few cases some really seldom
%    needed chars are unavailable, i.e., produce missing glyphs (to
%    avoid that a large number of available chars are unnecessarily
%    substituted.
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{lato-*}                   {0}  % with a bunch of tofu inside
\DeclareEncodingSubset{TS1}{opensans-*}               {0}  % with a bunch of tofu inside
\DeclareEncodingSubset{TS1}{cantarell-*}              {0}  % with a bunch of tofu inside
\DeclareEncodingSubset{TS1}{fbb-*}                    {0}  % missing centoldstyle
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{tli}                      {1}  % with lots of tofu inside
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{Alegreya-*}               {2}
\DeclareEncodingSubset{TS1}{AlegreyaSans-*}           {2}
\DeclareEncodingSubset{TS1}{DejaVuSans-TLF}           {2}
\DeclareEncodingSubset{TS1}{DejaVuSansCondensed-TLF}  {2}
\DeclareEncodingSubset{TS1}{DejaVuSansMono-TLF}       {2}
\DeclareEncodingSubset{TS1}{EBGaramond-*}             {2}
\DeclareEncodingSubset{TS1}{Tempora-TLF}              {2}
\DeclareEncodingSubset{TS1}{Tempora-TOsF}             {2}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{Arimo-TLF}                {3}
\DeclareEncodingSubset{TS1}{Carlito-*}                {3}
\DeclareEncodingSubset{TS1}{FiraSans-*}               {3}
\DeclareEncodingSubset{TS1}{IBMPlexSans-TLF}          {3}
\DeclareEncodingSubset{TS1}{Merriweather-OsF}         {3}
\DeclareEncodingSubset{TS1}{Montserrat-*}             {3}
\DeclareEncodingSubset{TS1}{MontserratAlternates-*}   {3}
\DeclareEncodingSubset{TS1}{SourceCodePro-TLF}        {3}
\DeclareEncodingSubset{TS1}{SourceCodePro-TOsF}       {3}
\DeclareEncodingSubset{TS1}{SourceSansPro-*}          {3}
\DeclareEncodingSubset{TS1}{SourceSerifPro-*}         {3}
\DeclareEncodingSubset{TS1}{Tinos-TLF}                {3}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{AccanthisADFStdNoThree-LF}{4}
\DeclareEncodingSubset{TS1}{Cabin-TLF}                {4}
\DeclareEncodingSubset{TS1}{Caladea-TLF}              {4}
\DeclareEncodingSubset{TS1}{Chivo-*}                  {4}
\DeclareEncodingSubset{TS1}{ClearSans-TLF}            {4}
\DeclareEncodingSubset{TS1}{Coelacanth-LF}            {4}
\DeclareEncodingSubset{TS1}{CrimsonPro-*}             {4}
\DeclareEncodingSubset{TS1}{FiraMono-TLF}             {4}
\DeclareEncodingSubset{TS1}{FiraMono-TOsF}            {4}
\DeclareEncodingSubset{TS1}{Go-TLF}                   {4}
\DeclareEncodingSubset{TS1}{GoMono-TLF}               {4}
\DeclareEncodingSubset{TS1}{InriaSans-*}              {4}
\DeclareEncodingSubset{TS1}{InriaSerif-*}             {4}
\DeclareEncodingSubset{TS1}{LibertinusSans-*}         {4}
\DeclareEncodingSubset{TS1}{LibertinusSerif-*}        {4}
\DeclareEncodingSubset{TS1}{LibreBodoni-TLF}          {4}
\DeclareEncodingSubset{TS1}{LibreFranklin-TLF}        {4}
\DeclareEncodingSubset{TS1}{LinguisticsPro-LF}        {4}
\DeclareEncodingSubset{TS1}{LinguisticsPro-OsF}       {4}
\DeclareEncodingSubset{TS1}{LinuxBiolinumT-*}         {4}
\DeclareEncodingSubset{TS1}{LinuxLibertineT-*}        {4}
\DeclareEncodingSubset{TS1}{MerriweatherSans-OsF}     {4}
\DeclareEncodingSubset{TS1}{MintSpirit-*}             {4}
\DeclareEncodingSubset{TS1}{MintSpiritNoTwo-*}        {4}
\DeclareEncodingSubset{TS1}{PTMono-TLF}               {4}
\DeclareEncodingSubset{TS1}{PTSans-TLF}               {4}
\DeclareEncodingSubset{TS1}{PTSansCaption-TLF}        {4}
\DeclareEncodingSubset{TS1}{PTSansNarrow-TLF}         {4}
\DeclareEncodingSubset{TS1}{PTSerif-TLF}              {4}
\DeclareEncodingSubset{TS1}{PTSerifCaption-TLF}       {4}
\DeclareEncodingSubset{TS1}{Raleway-TLF}              {4}
\DeclareEncodingSubset{TS1}{Raleway-TOsF}             {4}
\DeclareEncodingSubset{TS1}{Roboto-*}                 {4}
\DeclareEncodingSubset{TS1}{RobotoMono-TLF}           {4}
\DeclareEncodingSubset{TS1}{RobotoSlab-TLF}           {4}
\DeclareEncodingSubset{TS1}{Rosario-*}                {4}
\DeclareEncodingSubset{TS1}{SticksTooText-*}          {4}
\DeclareEncodingSubset{TS1}{UniversalisADFStd-LF}     {4}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{Almendra-OsF}             {5}
\DeclareEncodingSubset{TS1}{Baskervaldx-*}            {5}
\DeclareEncodingSubset{TS1}{BaskervilleF-*}           {5}
\DeclareEncodingSubset{TS1}{Bitter-TLF}               {5}
\DeclareEncodingSubset{TS1}{Cinzel-LF}                {5}
\DeclareEncodingSubset{TS1}{CinzelDecorative-LF}      {5}
\DeclareEncodingSubset{TS1}{DejaVuSerif-TLF}          {5}
\DeclareEncodingSubset{TS1}{DejaVuSerifCondensed-TLF} {5}
\DeclareEncodingSubset{TS1}{GilliusADF-LF}            {5}
\DeclareEncodingSubset{TS1}{GilliusADFCond-LF}        {5}
\DeclareEncodingSubset{TS1}{GilliusADFNoTwo-LF}       {5}
\DeclareEncodingSubset{TS1}{GilliusADFNoTwoCond-LF}   {5}
\DeclareEncodingSubset{TS1}{LobsterTwo-LF}            {5}
\DeclareEncodingSubset{TS1}{OldStandard-TLF}          {5}
\DeclareEncodingSubset{TS1}{PlayfairDisplay-TLF}      {5}
\DeclareEncodingSubset{TS1}{PlayfairDisplay-TOsF}     {5}
\DeclareEncodingSubset{TS1}{TheanoDidot-TLF}          {5}
\DeclareEncodingSubset{TS1}{TheanoDidot-TOsF}         {5}
\DeclareEncodingSubset{TS1}{TheanoModern-TLF}         {5}
\DeclareEncodingSubset{TS1}{TheanoModern-TOsF}        {5}
\DeclareEncodingSubset{TS1}{TheanoOldStyle-TLF}       {5}
\DeclareEncodingSubset{TS1}{TheanoOldStyle-TOsF}      {5}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{Crimson-TLF}              {6}
\DeclareEncodingSubset{TS1}{IBMPlexMono-TLF}          {6}
\DeclareEncodingSubset{TS1}{IBMPlexSerif-TLF}         {6}
\DeclareEncodingSubset{TS1}{LibertinusMono-TLF}       {6}
\DeclareEncodingSubset{TS1}{LibertinusSerifDisplay-LF}{6}
\DeclareEncodingSubset{TS1}{LinuxLibertineDisplayT-*} {6}
\DeclareEncodingSubset{TS1}{LinuxLibertineMonoT-LF}   {6}
\DeclareEncodingSubset{TS1}{LinuxLibertineMonoT-TLF}  {6}
\DeclareEncodingSubset{TS1}{Overlock-LF}              {6}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{CormorantGaramond-*}      {7}
\DeclareEncodingSubset{TS1}{Heuristica-TLF}           {7}
\DeclareEncodingSubset{TS1}{Heuristica-TOsF}          {7}
\DeclareEncodingSubset{TS1}{IMFELLEnglish-TLF}        {7}
\DeclareEncodingSubset{TS1}{LibreBaskerville-TLF}     {7}
\DeclareEncodingSubset{TS1}{LibreCaslon-*}            {7}
\DeclareEncodingSubset{TS1}{Marcellus-LF}             {7}
\DeclareEncodingSubset{TS1}{NotoSans-*}               {7}
\DeclareEncodingSubset{TS1}{NotoSansMono-TLF}         {7}
\DeclareEncodingSubset{TS1}{NotoSansMono-TOsF}        {7}
\DeclareEncodingSubset{TS1}{NotoSerif-*}              {7}
\DeclareEncodingSubset{TS1}{Quattrocento-TLF}         {7}
\DeclareEncodingSubset{TS1}{QuattrocentoSans-TLF}     {7}
\DeclareEncodingSubset{TS1}{XCharter-TLF}             {7}
\DeclareEncodingSubset{TS1}{XCharter-TOsF}            {7}
\DeclareEncodingSubset{TS1}{erewhon-*}                {7}
\DeclareEncodingSubset{TS1}{ComicNeue-TLF}            {7}
\DeclareEncodingSubset{TS1}{ComicNeueAngular-TLF}     {7}
\DeclareEncodingSubset{TS1}{Forum-LF}                 {7}  % the superiors are missing
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{Cochineal-*}              {8}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{AlgolRevived-TLF}         {9}
%    \end{macrocode}
%
%
%
%
% \section{Legacy symbol support for lists and footnote symbols}
%
%  \begin{macro}{\UseLegacyTextSymbols}
%
%    \begin{macrocode}
\def\UseLegacyTextSymbols{%
  \DeclareTextSymbolDefault{\textasteriskcentered}{OMS}%
  \DeclareTextSymbolDefault{\textbardbl}{OMS}%
  \DeclareTextSymbolDefault{\textbullet}{OMS}%
  \DeclareTextSymbolDefault{\textdaggerdbl}{OMS}%
  \DeclareTextSymbolDefault{\textdagger}{OMS}%
  \DeclareTextSymbolDefault{\textparagraph}{OMS}%
  \DeclareTextSymbolDefault{\textperiodcentered}{OMS}%
  \DeclareTextSymbolDefault{\textsection}{OMS}%
  \UndeclareTextCommand{\textsection}{T1}%
  \expandafter\let\csname oldstylenums \expandafter\endcsname
                  \csname legacyoldstylenums \endcsname
}
%    \end{macrocode}
%  \end{macro}



%  \begin{macro}{\textlegacyasteriskcentered}
%  \begin{macro}{\textlegacybardbl}
%  \begin{macro}{\textlegacybullet}
%  \begin{macro}{\textlegacydaggerdbl}
%  \begin{macro}{\textlegacydagger}
%  \begin{macro}{\textlegacyparagraph}
%  \begin{macro}{\textlegacyperiodcentered}
%  \begin{macro}{\textlegacysection}
%
%    Here are new names for the legacy symbols that \LaTeX{} used to
%    pick up from the \texttt{OMS} encoded fonts (and used dor itemize
%    lists or footnote symbols.
%
%    We go the roundabout way via separate OMS declarations so that
%\begin{verbatim}
%   \renewcommand\textbullet{\textlegacybullet}
%\end{verbatim}
% doesn't produce an endless loop.
%    \begin{macrocode}
\DeclareTextSymbol{\textlegacyasteriskcentered}{OMS}{3}   % "03
\DeclareTextSymbol{\textlegacybardbl}{OMS}{107}           % "6B
\DeclareTextSymbol{\textlegacybullet}{OMS}{15}            % "0F
\DeclareTextSymbol{\textlegacydaggerdbl}{OMS}{122}        % "7A
\DeclareTextSymbol{\textlegacydagger}{OMS}{121}           % "79
\DeclareTextSymbol{\textlegacyparagraph}{OMS}{123}        % "7B
\DeclareTextSymbol{\textlegacyperiodcentered}{OMS}{1}     % "01
\DeclareTextSymbol{\textlegacysection}{OMS}{120}          % "78
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textlegacyasteriskcentered}{OMS}
\DeclareTextSymbolDefault{\textlegacybardbl}{OMS}
\DeclareTextSymbolDefault{\textlegacybullet}{OMS}
\DeclareTextSymbolDefault{\textlegacydaggerdbl}{OMS}
\DeclareTextSymbolDefault{\textlegacydagger}{OMS}
\DeclareTextSymbolDefault{\textlegacyparagraph}{OMS}
\DeclareTextSymbolDefault{\textlegacyperiodcentered}{OMS}
\DeclareTextSymbolDefault{\textlegacysection}{OMS}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}

%
%
% Supporting rollback \ldots
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>   {\DeclareEncodingSubset}{Text companion symbols}%
%<latexrelease>
%<latexrelease>\let\DeclareEncodingSubset\@undefined
%<latexrelease>\let\CheckEncodingSubset\@undefined
%<latexrelease>
%<latexrelease>\DeclareTextSymbolDefault{\textdollar}{OT1}
%<latexrelease>\DeclareTextSymbolDefault{\textsterling}{OT1}
%<latexrelease>\DeclareTextCommand{\textdollar}{OT1}{\hmode@bgroup
%<latexrelease>   \ifdim \fontdimen\@ne\font >\z@
%<latexrelease>      \slshape
%<latexrelease>   \else
%<latexrelease>      \upshape
%<latexrelease>   \fi
%<latexrelease>   \char`\$\egroup}
%<latexrelease>\DeclareTextCommand{\textsterling}{OT1}{\hmode@bgroup
%<latexrelease>   \ifdim \fontdimen\@ne\font >\z@
%<latexrelease>      \itshape
%<latexrelease>   \else
%<latexrelease>      \fontshape{ui}\selectfont
%<latexrelease>   \fi
%<latexrelease>   \char`\$\egroup}
%<latexrelease>\DeclareTextCommand{\textperthousand}{T1}
%<latexrelease>   {\%\char 24 }
%<latexrelease>
%<latexrelease>\DeclareTextSymbolDefault{\textasteriskcentered}{OMS}
%<latexrelease>\DeclareTextSymbolDefault{\textbullet}{OMS}
%<latexrelease>\DeclareTextSymbolDefault{\textdaggerdbl}{OMS}
%<latexrelease>\DeclareTextSymbolDefault{\textdagger}{OMS}
%<latexrelease>\DeclareTextSymbolDefault{\textparagraph}{OMS}
%<latexrelease>\DeclareTextSymbolDefault{\textperiodcentered}{OMS}
%<latexrelease>\DeclareTextSymbolDefault{\textsection}{OMS}
%<latexrelease>
%<latexrelease>\DeclareTextSymbolDefault{\textbardbl}{OMS}
%<latexrelease>\let\textbrokenbar\@undefined
%<latexrelease>\let\textcelsius\@undefined
%<latexrelease>\let\textcent\@undefined
%<latexrelease>\DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
%<latexrelease>\let\textdegree\@undefined
%<latexrelease>\let\textdiv\@undefined
%<latexrelease>\let\textlnot\@undefined
%<latexrelease>\let\textonehalf\@undefined
%<latexrelease>\let\textonequarter\@undefined
%<latexrelease>\let\textonesuperior\@undefined
%<latexrelease>\DeclareTextCommandDefault{\textordfeminine}{\textsuperscript{a}}
%<latexrelease>\DeclareTextCommandDefault{\textordmasculine}{\textsuperscript{o}}
%<latexrelease>\let\textpm\@undefined
%<latexrelease>\let\textquotesingle\@undefined
%<latexrelease>\let\textquotestraightbase\@undefined
%<latexrelease>\let\textquotestraightdblbase\@undefined
%<latexrelease>\DeclareTextCommandDefault{\textregistered}{\textcircled{%
%<latexrelease>     \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
%<latexrelease>\let\textthreequartersemdash\@undefined
%<latexrelease>\let\textthreequarters\@undefined
%<latexrelease>\let\textthreesuperior\@undefined
%<latexrelease>\let\texttimes\@undefined
%<latexrelease>\DeclareTextCommandDefault{\texttrademark}{\textsuperscript{TM}}
%<latexrelease>\let\texttwelveudash\@undefined
%<latexrelease>\let\texttwosuperior\@undefined
%<latexrelease>\let\textyen\@undefined
%<latexrelease>
%<latexrelease>\let\textcapitalcompwordmark\@undefined
%<latexrelease>\let\textascendercompwordmark\@undefined
%<latexrelease>
%<latexrelease>\DeclareTextAccentDefault{\textcircled}{OMS}
%<latexrelease>\DeclareTextAccentDefault{\t}{OML}
%<latexrelease>
%<latexrelease>\let\capitalacute\@undefined
%<latexrelease>\let\capitalbreve\@undefined
%<latexrelease>\let\capitalcaron\@undefined
%<latexrelease>\let\capitalcedilla\@undefined
%<latexrelease>\let\capitalcircumflex\@undefined
%<latexrelease>\let\capitaldieresis\@undefined
%<latexrelease>\let\capitaldotaccent\@undefined
%<latexrelease>\let\capitalgrave\@undefined
%<latexrelease>\let\capitalhungarumlaut\@undefined
%<latexrelease>\let\capitalmacron\@undefined
%<latexrelease>\let\capitalnewtie\@undefined
%<latexrelease>\let\capitalogonek\@undefined
%<latexrelease>\let\capitalring\@undefined
%<latexrelease>\let\capitaltie\@undefined
%<latexrelease>\let\capitaltilde\@undefined
%<latexrelease>\let\newtie\@undefined
%<latexrelease>
%<latexrelease>\let\textlbrackdbl\@undefined
%<latexrelease>\let\textrbrackdbl\@undefined
%<latexrelease>
%<latexrelease>\let\texteightoldstyle\@undefined
%<latexrelease>\let\textfiveoldstyle\@undefined
%<latexrelease>\let\textfouroldstyle\@undefined
%<latexrelease>\let\textnineoldstyle\@undefined
%<latexrelease>\let\textoneoldstyle\@undefined
%<latexrelease>\let\textsevenoldstyle\@undefined
%<latexrelease>\let\textsixoldstyle\@undefined
%<latexrelease>\let\textthreeoldstyle\@undefined
%<latexrelease>\let\texttwooldstyle\@undefined
%<latexrelease>\let\textzerooldstyle\@undefined
%<latexrelease>
%<latexrelease>\let\textacutedbl\@undefined
%<latexrelease>\let\textasciiacute\@undefined
%<latexrelease>\let\textasciibreve\@undefined
%<latexrelease>\let\textasciicaron\@undefined
%<latexrelease>\let\textasciidieresis\@undefined
%<latexrelease>\let\textasciigrave\@undefined
%<latexrelease>\let\textasciimacron\@undefined
%<latexrelease>\let\textgravedbl\@undefined
%<latexrelease>\let\texttildelow\@undefined
%<latexrelease>
%<latexrelease>\let\textbaht\@undefined
%<latexrelease>\let\textbigcircle\@undefined
%<latexrelease>\let\textborn\@undefined
%<latexrelease>\let\textcentoldstyle\@undefined
%<latexrelease>\let\textcircledP\@undefined
%<latexrelease>\let\textcopyleft\@undefined
%<latexrelease>\let\textdblhyphenchar\@undefined
%<latexrelease>\let\textdblhyphen\@undefined
%<latexrelease>\let\textdied\@undefined
%<latexrelease>\let\textdiscount\@undefined
%<latexrelease>\let\textdivorced\@undefined
%<latexrelease>\let\textdollaroldstyle\@undefined
%<latexrelease>\let\textguarani\@undefined
%<latexrelease>\let\textleaf\@undefined
%<latexrelease>\let\textlquill\@undefined
%<latexrelease>\let\textmarried\@undefined
%<latexrelease>\let\textmho\@undefined
%<latexrelease>\let\textmusicalnote\@undefined
%<latexrelease>\let\textnaira\@undefined
%<latexrelease>\let\textopenbullet\@undefined
%<latexrelease>\let\textpeso\@undefined
%<latexrelease>\let\textpilcrow\@undefined
%<latexrelease>\let\textrecipe\@undefined
%<latexrelease>\let\textreferencemark\@undefined
%<latexrelease>\let\textrquill\@undefined
%<latexrelease>\let\textservicemark\@undefined
%<latexrelease>\let\textsurd\@undefined
%<latexrelease>
%<latexrelease>\DeclareTextCommand{\textpertenthousand}{T1}
%<latexrelease>                   {\%\char 24\char 24 }
%<latexrelease>
%<latexrelease>\let\textlangle\@undefined
%<latexrelease>\let\textrangle\@undefined
%<latexrelease>
%<latexrelease>\let\textcolonmonetary\@undefined
%<latexrelease>\let\textdong\@undefined
%<latexrelease>\let\textdownarrow\@undefined
%<latexrelease>\let\textleftarrow\@undefined
%<latexrelease>\let\textlira\@undefined
%<latexrelease>\let\textrightarrow\@undefined
%<latexrelease>\let\textuparrow\@undefined
%<latexrelease>\let\textwon\@undefined
%<latexrelease>
%<latexrelease>\let\textestimated\@undefined
%<latexrelease>\let\textnumero\@undefined
%<latexrelease>
%<latexrelease>\let\textflorin\@undefined
%<latexrelease>\let\textcurrency\@undefined
%<latexrelease>
%<latexrelease>\let\textfractionsolidus\@undefined
%<latexrelease>\let\textohm\@undefined
%<latexrelease>\let\textmu\@undefined
%<latexrelease>\let\textminus\@undefined
%<latexrelease>
%<latexrelease>\let\textblank\@undefined
%<latexrelease>\let\textinterrobangdown\@undefined
%<latexrelease>\let\textinterrobang\@undefined
%<latexrelease>
%<latexrelease>\let\texteuro\@undefined
%<latexrelease>
%<latexrelease>\let\textcelsius\@undefined
%<latexrelease>\let\textonesuperior\@undefined
%<latexrelease>\let\textthreequartersemdash\@undefined
%<latexrelease>\let\textthreesuperior\@undefined
%<latexrelease>\let\texttwelveudash\@undefined
%<latexrelease>\let\texttwosuperior\@undefined
%<latexrelease>\let\textbardbl\@undefined
%<latexrelease>
%<latexrelease>\let\UseLegacyTextSymbols\@undefined
%<latexrelease>\let\textlegacyasteriskcentered\@undefined
%<latexrelease>\let\textlegacybardbl\@undefined
%<latexrelease>\let\textlegacybullet\@undefined
%<latexrelease>\let\textlegacydaggerdbl\@undefined
%<latexrelease>\let\textlegacydagger\@undefined
%<latexrelease>\let\textlegacyparagraph\@undefined
%<latexrelease>\let\textlegacyperiodcentered\@undefined
%<latexrelease>\let\textlegacysection\@undefined
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%</2ekernel>
%    \end{macrocode}
%
%
%
%
% \section{The \texttt{textcomp} package}
%
%
%    \begin{macrocode}
%<*TS1sty>
\providecommand\DeclareRelease[3]{}
\providecommand\DeclareCurrentRelease[2]{}

\DeclareRelease{}{2018-08-11}{textcomp-2018-08-11.sty}
\DeclareCurrentRelease{}{2020-02-02}

\ProvidesPackage{textcomp}
 [2020/02/02 v2.0n Standard LaTeX package]
%    \end{macrocode}
%
%    A precaution in case this is used without rebuilding the format.
% \changes{v2.0n}{2020/02/05}{Ensure we are on a new format (gh/260)}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2020/02/02]
%    \end{macrocode}
%
%    This is implemented by defining the default subset:
%    \begin{macrocode}
\DeclareOption{full}{\DeclareEncodingSubset{TS1}{?}{0}}
\DeclareOption{almostfull}{\DeclareEncodingSubset{TS1}{?}{1}}
\DeclareOption{euro}{\DeclareEncodingSubset{TS1}{?}{8}}
\DeclareOption{safe}{\DeclareEncodingSubset{TS1}{?}{9}}
%    \end{macrocode}
%    The default is set up in the kernel is  ``safe'' these days for
%    unknown fonts but LaTeX has definitions for most families so it
%    seldom applies.
%
%    If a different default is used then one needs to check the
%    results to ensure that there aren't ``missing glyphs''.
%
%    The next set of options define the warning level (default in the
%    kernel is info only). Using the package options you can change this behavior.
% \changes{v2.0n}{2020/02/05}{Changed the package default to info (gh/262)}
%    \begin{macrocode}
\DeclareOption{error}{\gdef\tc@errorwarn{\PackageError{textcomp}}}
\DeclareOption{warn}{\gdef\tc@errorwarn#1#2{\PackageWarning{textcomp}{#1}}}
\DeclareOption{info}{\gdef\tc@errorwarn#1#2{\PackageInfo{textcomp}{#1}}}
\DeclareOption{quiet}{\gdef\tc@errorwarn#1#2{}}
%    \end{macrocode}
%
%    The ``force'' option basically changes the sub-encoding  to that
%    of the default (which, unless changes, is 9 these days), i.e., it
%    no longer depends on the font in use. This is mainly there
%    because it might have been used in older documents, but not
%    somehting that is recommended.
%    \begin{macrocode}
\DeclareOption{force}{%
    \def\CheckEncodingSubset#1#2#3#4#5{%
      \ifnum #4>%
           0\csname #2:?\endcsname
           \relax
      \expandafter\@firstoftwo
     \else
      \expandafter\@secondoftwo
    \fi
     {#1{#2}}{#3}%
     #5}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\ExecuteOptions{info}
\ProcessOptions\relax
%    \end{macrocode}
%
%    There is not much else to do nowadays, because everything is
%    already set up in the \LaTeX{} kernel.
%
%    \begin{macrocode}
\InputIfFileExists{textcomp.cfg}
  {\PackageInfo{textcomp}{Local configuration file used}}{}
%    \end{macrocode}
%
%    \begin{macrocode}
%</TS1sty>
%    \end{macrocode}
%
%
%
% \subsection{The old textcomp package code}
%
%    This section contains the old code for the textcomp package and
%    its documentation. It is only used if we roll back prior to 2020.
%    Thus all the rest is mainly for historians. Note that the old
%    code categorised in the sub-encodings only into 6 classes not 10.
%
%    \begin{macrocode}
%<*TS1oldsty>
\ProvidesPackage{textcomp}
   [2018/08/11 v2.0j Standard LaTeX package]
%    \end{macrocode}
%
%    This one is for the |TS1| encoding which contains text symbols
%    for use with the |T1|-encoded text fonts.  It therefore first
%    inputs the file |TS1enc.def| and then sets (or resets) the
%    defaults for the symbols it contains.  The result of this is that
%    when one of these symbols is accessed and the current encoding
%    does not provide it, the symbol will be supplied by a silent,
%    local change to this encoding.
%
%    Since many PostScript fonts only implement a subset of |TS1| many
%    commands only produce black blobs of ink. To resolve the
%    resulting problems a number of options have been introduced and
%    some code  has been developed to distinguish sub-encodings.
%
%    The sub-encodings have a numerical id and are defined as follows
%    for \texttt{TS1}:
% \begin{description}
%
% \item[\#5] those \texttt{TS1} symbols that are also in the ISO-Adobe
%       character set; without \verb=textcurrency=, which is often
%       misused for the Euro.  Older Type1 fonts from the non-\TeX{}
%       world provide only this subset.
%
% \item[\#4] = \#5 + \verb=\texteuro=.  Most newer fonts provide this.
%
% \item[\#3] = \#4 + \verb=\textomega=.  Can also be described as
%       $\texttt{TS1} \cap (\texttt{ISO-Adobe} \cup
%       \texttt{MacRoman})$.  (Except for the missing "currency".)

%
% \item[\#2] = \#3 + \verb=\textestimated= + \verb=\textcurrency=.  Can
%       also be described as $\texttt{TS1} \cap
%       \texttt{Adobe-Western-2}$.  This may be relevant for OpenType
%       fonts, which usually show the Adobe-Western-2 character set.
%
%    \item[\#1] = \texttt{TS1} without \verb=\textcircled= and \verb=\t=.
%       These two glyphs are often not implemented and if their kernel
%       defaults are changed commands like \verb=\copyright=
%       unnecessarily fail.
%
%    \item[\#0] = full \texttt{TS1}
% \end{description}
%
%    And here a summary to go in the transcript file:
%    \begin{macrocode}
\PackageInfo{textcomp}{Sub-encoding information:\MessageBreak
    \space\space 5 = only ISO-Adobe without
                              \string\textcurrency\MessageBreak
    \space\space 4 = 5 + \string\texteuro\MessageBreak
    \space\space 3 = 4 + \string\textohm\MessageBreak
    \space\space 2 = 3 + \noexpand\textestimated+
                                \string\textcurrency\MessageBreak
    \space\space 1 = TS1 - \noexpand\textcircled-
                                            \string\t\MessageBreak
    \space\space 0 = TS1 (full)\MessageBreak
    Font families with sub-encoding setting implement\MessageBreak
    only a restricted character set as indicated.\MessageBreak
    Family '?' is the default used for unknown fonts.\MessageBreak
    See the documentation for details\@gobble}
%    \end{macrocode}
%
% \begin{macro}{\DeclareEncodingSubset}
%    An encoding subset to which a font family belongs is declared by
%    the command |\DeclareEncodingSubset| that takes the major encoding as the
%    first argument (e.g., |TS1|), the family name as the second
%    argument (e.g., |cmr|), and the subset encoding id as a third,
%    (e.g., |0| for |cmr|).
%
%    The default encoding subset to use when nothing is known about
%    the current font family is named |?|.
%    \begin{macrocode}
\def\DeclareEncodingSubset#1#2#3{%
   \@ifundefined{#1:#2}%
     {\PackageInfo{textcomp}{Setting #2 sub-encoding to #1/#3}}%
     {\PackageInfo{textcomp}{Changing #2 sub-encoding to #1/#3}}%
   \@namedef{#1:#2}{#3}}
\@onlypreamble\DeclareEncodingSubset
%    \end{macrocode}
% \end{macro}
%
%
%  The options for the package are the following:
%    \begin{description}
%    \item[safe]
%       for unknown font families enables only symbols that are also
%       in the ISO-Adobe character set; without "currency", which is
%       often misused for the Euro.  Older Type1 fonts from the
%       non-TeX world provide only this subset.
%
%    \item[euro]
%       enables the ``safe'' symbols plus the |\texteuro|
%       command. Most newer fonts provide this.
%
%    \item[full] enables all |TS1| commands; useful only with fonts
%       like EC or CM bright.
%
%    \item[almostfull]
%       same as ``full'', except that |\textcircled|
%       and |\t| are \emph{not} redefined from their defaults to avoid
%       that commands like |\copyright| suddenly no longer work.
%
%    \item[force]
%       ignore all subset encoding definitions stored in the package
%       itself or in the configuration file and always use the default
%       subset as specified by one of the other options (seldom useful,
%       only dangerous).
%    \end{description}
%
% \begin{macro}{\iftc@forced}
%    Switch used to implement the \texttt{force} option
%    \begin{macrocode}
\newif\iftc@forced   \tc@forcedfalse
%    \end{macrocode}
% \end{macro}

%    This is implemented by defining the default subset:
%    \begin{macrocode}
\DeclareOption{full}{\DeclareEncodingSubset{TS1}{?}{0}}
\DeclareOption{almostfull}{\DeclareEncodingSubset{TS1}{?}{1}}
\DeclareOption{euro}{\DeclareEncodingSubset{TS1}{?}{4}}
\DeclareOption{safe}{\DeclareEncodingSubset{TS1}{?}{5}}
%    \end{macrocode}
%    The default is ``almostfull'' which means that old documents will
%    work except that |\textcircled| and |\t| will use the kernel
%    defaults (with the advantage that this also works if the current
%    font (as often the case) doesn't implement these glyphs.
%
%    The ``force'' option simply sets the switch to true.
%    \begin{macrocode}
\DeclareOption{force}{\tc@forcedtrue}
%    \end{macrocode}
%
%    The suggestions to user is to use the ``safe'' option always
%    unless that balks in which case they could switch to
%    ``almostfull'' but then better check their output manually.
%
%    \begin{macrocode}
\def\tc@errorwarn{\PackageError}
\DeclareOption{warn}{\gdef\tc@errorwarn#1#2#3{\PackageWarning{#1}{#2}}}
\DeclareOption{quiet}{\gdef\tc@errorwarn#1#2#3{}}
%    \end{macrocode}
%
%    \begin{macrocode}
\ExecuteOptions{almostfull}
\ProcessOptions\relax
%    \end{macrocode}
%
%
%
%
% \begin{macro}{\CheckEncodingSubset}
%    The command |\CheckEncodingSubset| will check if the current font
%    family has the right encoding subset to typeset a certain
%    command. It takes five arguments as follows:
%    first argument is either |\UseTextSymbol|, |\UseTextAccent|
%    depending on whether or not the symbol is a text symbol or a text
%    accent.

%    The second argument is the encoding from which this symbol should
%    be fetched.
%
%    The third argument is either a fake accessor command or an error
%    message. the code in that argument (if ever executed) receives
%    two arguments: |#2| and |#5| of |\CheckEncodingSubset|.
%
%    Argument four is the subset encoding id to test against: if this
%    value is higher than the subset id of the current font family
%    then we typeset the symbol, i.e., execute |#1{#2}#5| otherwise
%    it runs |#3#5|, e.g., to produce an error message or fake the
%    glyph somehow.
%
%    Argument five is the symbol or accent command that is being
%    checked.
%
%    For usage examples see definitions below.
%    \begin{macrocode}
\iftc@forced
%    \end{macrocode}
%    If the ``force'' option was given we always use the default for
%    testing against.
%    \begin{macrocode}
\def\CheckEncodingSubset#1#2#3#4#5{%
    \ifnum #4>%
        0\csname #2:?\endcsname
        \relax
   \expandafter\@firstoftwo
  \else
   \expandafter\@secondoftwo
 \fi
  {#1{#2}}{#3}%
  #5%
}
%    \end{macrocode}
%
%    In normal circumstances the test is a bit more complicated: first
%    check if there exists a macro
%    |\|\meta{arg2}|:|\meta{current-family} and if so use that value
%    to test against, otherwise use the default to test against.
%    \begin{macrocode}
\else
\def\CheckEncodingSubset#1#2#3#4#5{%
    \ifnum #4>%
      \expandafter\ifx\csname #2:\f@family\endcsname\relax
        0\csname #2:?\endcsname
      \else
        \csname #2:\f@family\endcsname
      \fi
   \relax
   \expandafter\@firstoftwo
  \else
   \expandafter\@secondoftwo
 \fi
  {#1{#2}}{#3}%
  #5%
}
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tc@subst}
%    \begin{macrocode}
\def\tc@subst#1{%
   \tc@errorwarn{textcomp}%
    {Symbol \string#1 not provided by\MessageBreak
     font family \f@family\space
     in TS1 encoding.\MessageBreak Default family used instead}\@eha
  \bgroup\fontfamily\textcompsubstdefault\selectfont#1\egroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tc@error}
%    |\tc@error| is going to be used in arg |#3| of
%    |\CheckEncodingSubset| when a symbol is not available in a
%    certain font family. It gets pass the encoding it normally lives
%    in (arg one) and the name of the symbol or accent that has a
%    problem.
%
%    \begin{macrocode}
% error commands take argument:
% #1 symbol to be used
\def\tc@error#1{%
   \PackageError{textcomp}%  % should be latex error if general
    {Accent \string#1 not provided by\MessageBreak
     font family \f@family\space
     in TS1 encoding}\@eha
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tc@fake@euro}
%    |\tc@fake@euro|  is an example of a ``fake'' definition to use in  arg |#3| of
%    |\CheckEncodingSubset| when a symbol is not available in a
%    certain font family. Here we produce an Euro symbol by combining
%    a ``C'' with a ``=''.
%    \begin{macrocode}
\def\tc@fake@euro#1{%
   \leavevmode
   \PackageInfo{textcomp}{Faking \noexpand#1for font family
                          \f@family\MessageBreak in TS1 encoding}%
   \valign{##\cr
      \vfil\hbox to 0.07em{\dimen@\f@size\p@
                           \math@fontsfalse
                           \fontsize{.7\dimen@}\z@\selectfont=\hss}%
      \vfil\cr%
      \hbox{C}\crcr
   }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tc@check@symbol}
% \begin{macro}{\tc@check@accent}
%    These are two abbreviations that we use below to check symbols
%    and accents in TS1. Only there to save some space, e.g., we can
%    then write
%\begin{verbatim}
%\DeclareTextCommandDefault{\textcurrency}{\tc@check@symbol3\textcurrency}
%\end{verbatim}
%    to ensure that |\textcurrency| is only typeset if the current
%    font has a \texttt{TS1} subset id of less than 3. Otherwise
%    |\tc@error| is called telling the user that for this font family
%    |\textcurreny| is not available.
%    \begin{macrocode}
\def\tc@check@symbol{\CheckEncodingSubset\UseTextSymbol{TS1}\tc@subst}
\def\tc@check@accent{\CheckEncodingSubset\UseTextAccent{TS1}\tc@error}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    We start with the commands that are ``safe'' and which can be
%    unconditionally set up, first the accents\ldots
%    \begin{macrocode}
\DeclareTextAccentDefault{\capitalcedilla}{TS1}
\DeclareTextAccentDefault{\capitalogonek}{TS1}
\DeclareTextAccentDefault{\capitalgrave}{TS1}
\DeclareTextAccentDefault{\capitalacute}{TS1}
\DeclareTextAccentDefault{\capitalcircumflex}{TS1}
\DeclareTextAccentDefault{\capitaltilde}{TS1}
\DeclareTextAccentDefault{\capitaldieresis}{TS1}
\DeclareTextAccentDefault{\capitalhungarumlaut}{TS1}
\DeclareTextAccentDefault{\capitalring}{TS1}
\DeclareTextAccentDefault{\capitalcaron}{TS1}
\DeclareTextAccentDefault{\capitalbreve}{TS1}
\DeclareTextAccentDefault{\capitalmacron}{TS1}
\DeclareTextAccentDefault{\capitaldotaccent}{TS1}
%    \end{macrocode}
%    \ldots and then the other glyphs.
% \changes{v1.9p}{1998/06/12}{Renamed \cs{textmacron} pr/2840}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textcapitalcompwordmark}{TS1}
\DeclareTextSymbolDefault{\textascendercompwordmark}{TS1}
\DeclareTextSymbolDefault{\textquotestraightbase}{TS1}
\DeclareTextSymbolDefault{\textquotestraightdblbase}{TS1}
\DeclareTextSymbolDefault{\texttwelveudash}{TS1}
\DeclareTextSymbolDefault{\textthreequartersemdash}{TS1}
\DeclareTextSymbolDefault{\textdollar}{TS1}
\DeclareTextSymbolDefault{\textquotesingle}{TS1}
\DeclareTextSymbolDefault{\textasteriskcentered}{TS1}
\DeclareTextSymbolDefault{\textfractionsolidus}{TS1}
\DeclareTextSymbolDefault{\textminus}{TS1}
\DeclareTextSymbolDefault{\textlbrackdbl}{TS1}
\DeclareTextSymbolDefault{\textrbrackdbl}{TS1}
\DeclareTextSymbolDefault{\textasciigrave}{TS1}
\DeclareTextSymbolDefault{\texttildelow}{TS1}
\DeclareTextSymbolDefault{\textasciibreve}{TS1}
\DeclareTextSymbolDefault{\textasciicaron}{TS1}
\DeclareTextSymbolDefault{\textgravedbl}{TS1}
\DeclareTextSymbolDefault{\textacutedbl}{TS1}
\DeclareTextSymbolDefault{\textdagger}{TS1}
\DeclareTextSymbolDefault{\textdaggerdbl}{TS1}
\DeclareTextSymbolDefault{\textbardbl}{TS1}
\DeclareTextSymbolDefault{\textperthousand}{TS1}
\DeclareTextSymbolDefault{\textbullet}{TS1}
\DeclareTextSymbolDefault{\textcelsius}{TS1}
\DeclareTextSymbolDefault{\textflorin}{TS1}
\DeclareTextSymbolDefault{\texttrademark}{TS1}
\DeclareTextSymbolDefault{\textcent}{TS1}
\DeclareTextSymbolDefault{\textsterling}{TS1}
\DeclareTextSymbolDefault{\textyen}{TS1}
\DeclareTextSymbolDefault{\textbrokenbar}{TS1}
\DeclareTextSymbolDefault{\textsection}{TS1}
\DeclareTextSymbolDefault{\textasciidieresis}{TS1}
\DeclareTextSymbolDefault{\textcopyright}{TS1}
\DeclareTextSymbolDefault{\textordfeminine}{TS1}
\DeclareTextSymbolDefault{\textlnot}{TS1}
\DeclareTextSymbolDefault{\textregistered}{TS1}
\DeclareTextSymbolDefault{\textasciimacron}{TS1}
\DeclareTextSymbolDefault{\textdegree}{TS1}
\DeclareTextSymbolDefault{\textpm}{TS1}
\DeclareTextSymbolDefault{\texttwosuperior}{TS1}
\DeclareTextSymbolDefault{\textthreesuperior}{TS1}
\DeclareTextSymbolDefault{\textasciiacute}{TS1}
\DeclareTextSymbolDefault{\textmu}{TS1}
\DeclareTextSymbolDefault{\textparagraph}{TS1}
\DeclareTextSymbolDefault{\textperiodcentered}{TS1}
\DeclareTextSymbolDefault{\textonesuperior}{TS1}
\DeclareTextSymbolDefault{\textordmasculine}{TS1}
\DeclareTextSymbolDefault{\textonequarter}{TS1}
\DeclareTextSymbolDefault{\textonehalf}{TS1}
\DeclareTextSymbolDefault{\textthreequarters}{TS1}
\DeclareTextSymbolDefault{\texttimes}{TS1}
\DeclareTextSymbolDefault{\textdiv}{TS1}
%    \end{macrocode}
%
%    The |\texteuro| is only available for subsets with id 4 or
%    less. Otherwise we fake the glyph using |\tc@fake@euro|
%    \begin{macrocode}
\DeclareTextCommandDefault{\texteuro}
   {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@fake@euro5\texteuro}
%    \end{macrocode}
%
%    The |\textohm| is only available for subsets with id 3 or
%    less. Otherwise we produce an error.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textohm}{\tc@check@symbol4\textohm}
%    \end{macrocode}
%    The |\textestimated| and |\textcurrency| are only provided for
%    fonts with subset encoding with id 2 or less.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textestimated}%
    {\tc@check@symbol3\textestimated}
\DeclareTextCommandDefault{\textcurrency}%
    {\tc@check@symbol3\textcurrency}
%    \end{macrocode}
%    Nearly all of the remaining glyphs are provided only with fonts
%    with id 1 or 0, i.e., are essentially complete.
%    \begin{macrocode}
\DeclareTextCommandDefault{\capitaltie}%
    {\tc@check@accent2\capitaltie}
\DeclareTextCommandDefault{\newtie}%
    {\tc@check@accent2\newtie}
\DeclareTextCommandDefault{\capitalnewtie}%
    {\tc@check@accent2\capitalnewtie}
\DeclareTextCommandDefault{\textleftarrow}%
    {\tc@check@symbol2\textleftarrow}
\DeclareTextCommandDefault{\textrightarrow}%
    {\tc@check@symbol2\textrightarrow}
\DeclareTextCommandDefault{\textblank}%
    {\tc@check@symbol2\textblank}
\DeclareTextCommandDefault{\textdblhyphen}%
    {\tc@check@symbol2\textdblhyphen}
\DeclareTextCommandDefault{\textzerooldstyle}%
    {\tc@check@symbol2\textzerooldstyle}
\DeclareTextCommandDefault{\textoneoldstyle}%
    {\tc@check@symbol2\textoneoldstyle}
\DeclareTextCommandDefault{\texttwooldstyle}%
    {\tc@check@symbol2\texttwooldstyle}
\DeclareTextCommandDefault{\textthreeoldstyle}%
    {\tc@check@symbol2\textthreeoldstyle}
\DeclareTextCommandDefault{\textfouroldstyle}%
    {\tc@check@symbol2\textfouroldstyle}
\DeclareTextCommandDefault{\textfiveoldstyle}%
    {\tc@check@symbol2\textfiveoldstyle}
\DeclareTextCommandDefault{\textsixoldstyle}%
    {\tc@check@symbol2\textsixoldstyle}
\DeclareTextCommandDefault{\textsevenoldstyle}%
    {\tc@check@symbol2\textsevenoldstyle}
\DeclareTextCommandDefault{\texteightoldstyle}%
    {\tc@check@symbol2\texteightoldstyle}
\DeclareTextCommandDefault{\textnineoldstyle}%
    {\tc@check@symbol2\textnineoldstyle}
\DeclareTextCommandDefault{\textlangle}%
    {\tc@check@symbol2\textlangle}
\DeclareTextCommandDefault{\textrangle}%
    {\tc@check@symbol2\textrangle}
\DeclareTextCommandDefault{\textmho}%
    {\tc@check@symbol2\textmho}
\DeclareTextCommandDefault{\textbigcircle}%
    {\tc@check@symbol2\textbigcircle}
\DeclareTextCommandDefault{\textuparrow}%
    {\tc@check@symbol2\textuparrow}
\DeclareTextCommandDefault{\textdownarrow}%
    {\tc@check@symbol2\textdownarrow}
\DeclareTextCommandDefault{\textborn}%
    {\tc@check@symbol2\textborn}
\DeclareTextCommandDefault{\textdivorced}%
    {\tc@check@symbol2\textdivorced}
\DeclareTextCommandDefault{\textdied}%
    {\tc@check@symbol2\textdied}
\DeclareTextCommandDefault{\textleaf}%
    {\tc@check@symbol2\textleaf}
\DeclareTextCommandDefault{\textmarried}%
    {\tc@check@symbol2\textmarried}
\DeclareTextCommandDefault{\textmusicalnote}%
    {\tc@check@symbol2\textmusicalnote}
\DeclareTextCommandDefault{\textdblhyphenchar}%
    {\tc@check@symbol2\textdblhyphenchar}
\DeclareTextCommandDefault{\textdollaroldstyle}%
    {\tc@check@symbol2\textdollaroldstyle}
\DeclareTextCommandDefault{\textcentoldstyle}%
    {\tc@check@symbol2\textcentoldstyle}
\DeclareTextCommandDefault{\textcolonmonetary}%
    {\tc@check@symbol2\textcolonmonetary}
\DeclareTextCommandDefault{\textwon}%
    {\tc@check@symbol2\textwon}
\DeclareTextCommandDefault{\textnaira}%
    {\tc@check@symbol2\textnaira}
\DeclareTextCommandDefault{\textguarani}%
    {\tc@check@symbol2\textguarani}
\DeclareTextCommandDefault{\textpeso}%
    {\tc@check@symbol2\textpeso}
\DeclareTextCommandDefault{\textlira}%
    {\tc@check@symbol2\textlira}
\DeclareTextCommandDefault{\textrecipe}%
    {\tc@check@symbol2\textrecipe}
\DeclareTextCommandDefault{\textinterrobang}%
    {\tc@check@symbol2\textinterrobang}
\DeclareTextCommandDefault{\textinterrobangdown}%
    {\tc@check@symbol2\textinterrobangdown}
\DeclareTextCommandDefault{\textdong}%
    {\tc@check@symbol2\textdong}
\DeclareTextCommandDefault{\textpertenthousand}%
    {\tc@check@symbol2\textpertenthousand}
\DeclareTextCommandDefault{\textpilcrow}%
    {\tc@check@symbol2\textpilcrow}
\DeclareTextCommandDefault{\textbaht}%
    {\tc@check@symbol2\textbaht}
\DeclareTextCommandDefault{\textnumero}%
    {\tc@check@symbol2\textnumero}
\DeclareTextCommandDefault{\textdiscount}%
    {\tc@check@symbol2\textdiscount}
\DeclareTextCommandDefault{\textopenbullet}%
    {\tc@check@symbol2\textopenbullet}
\DeclareTextCommandDefault{\textservicemark}%
    {\tc@check@symbol2\textservicemark}
\DeclareTextCommandDefault{\textlquill}%
    {\tc@check@symbol2\textlquill}
\DeclareTextCommandDefault{\textrquill}%
    {\tc@check@symbol2\textrquill}
\DeclareTextCommandDefault{\textcopyleft}%
    {\tc@check@symbol2\textcopyleft}
\DeclareTextCommandDefault{\textcircledP}%
    {\tc@check@symbol2\textcircledP}
\DeclareTextCommandDefault{\textreferencemark}%
    {\tc@check@symbol2\textreferencemark}
\DeclareTextCommandDefault{\textsurd}%
    {\tc@check@symbol2\textsurd}
%    \end{macrocode}
%    The |\textcircled| and |\t| are handled specially, unless the
%    current font has a subset id of 0 (i.e. full \texttt{TS1}) we
%    pick the symbols up from the math font encodings, i.e., the
%    third argument to |\CheckEncodingSubset| uses |\UseTextAccent| to
%    get them from there.
%    \begin{macrocode}
\DeclareTextCommandDefault{\textcircled}
  {\CheckEncodingSubset\UseTextAccent{TS1}%
    {\UseTextAccent{OMS}}1\textcircled}
\DeclareTextCommandDefault{\t}
  {\CheckEncodingSubset\UseTextAccent{TS1}%
    {\UseTextAccent{OML}}1\t}
%    \end{macrocode}


%
%    Finally input the encoding-specific definitions for
%    \texttt{TS1} thus making the top-level definitions
%    optimised for this encoding (and not for the default
%    encoding).
% \changes{v1.9o}{1998/03/20}{Load decls after defaults for speed.}
%    \begin{macrocode}
\input{ts1enc.def}
%    \end{macrocode}
%    Now having the new glyphs available we also want to make sure
%    that they are used. For most cases this will automatically happen
%    but for some glyphs there are inferior definitions already known
%    to \LaTeX{} which will prevent the usage of the \texttt{TS1}
%    versions. So we better
%    get rid of them:
% \changes{v1.9o}{1998/03/20}{Added various \cs{UndeclareTextCommand}
%    declarations for pr/2783}
%    \begin{macrocode}
\UndeclareTextCommand{\textsterling}{OT1}
\UndeclareTextCommand{\textdollar}  {OT1}
%    \end{macrocode}
%    Similar declarations should probably be made for other encodings
%    like \texttt{OT4} if they are in use.
%    \begin{macrocode}
%\UndeclareTextCommand{\textsterling}{OT4}
%\UndeclareTextCommand{\textdollar}  {OT4}
%    \end{macrocode}
%    From the \texttt{T1} encoding there are two candidates for removal:
%    \textperthousand{} and \textpertenthousand{} since these are both
%    constructed from \% followed by a tiny
%    `{\fontencoding{T1}\selectfont \char 24}'
%    rather than being a single glyph. The problem with this
%    approach is that in PostScript fonts this small zero is usually not
%    available resulting in \%\rule{3pt}{3pt} rather than
%    \textperthousand{} while the real glyph (at least for
%    |\textperthousand|) is available in the PostScript version of
%    \texttt{TS1}.  So for the moment we compromise by removing the
%    \texttt{T1} declaration for |\textperthousand| but keeping the one
%    for |\textpertenthousand|. This will have the effect that with
%    Computer Modern fonts everything will come out (although
%    \textperthousand{} and \textpertenthousand{} are not taken from the
%    same physical font) and with PostScript fonts \textperthousand{}
%    will come out correctly while \textpertenthousand{} will most
%    likely look like \%\rule{6pt}{3pt} --- which is probably an
%    improvement over just getting a single `\rule{3pt}{3pt}' to
%    indicate a completely missing glyph, which would happen if we
%    also `undeclared' |\textpertenthousand|.
%    \begin{macrocode}
\UndeclareTextCommand{\textperthousand}{T1}
%\UndeclareTextCommand{\textpertenthousand}{T1}
%    \end{macrocode}
%
%
%  \subsubsection{Supporting oldstyle digits}
%
%    \begin{macrocode}
\DeclareRobustCommand\oldstylenums[1]{%
 \begingroup
  \ifmmode
   \mathgroup\symletters #1%
  \else
   \CheckEncodingSubset\@use@text@encoding{TS1}%
       {\PackageWarning{textcomp}%
          {Oldstyle digits unavailable for
           family \f@family.\MessageBreak
           Lining digits used instead}}%
       \tw@{#1}%
   \fi
 \endgroup
}
%    \end{macrocode}
%
%  \subsubsection{Subset encoding defaults}
%
%    For many font families commonly used in the \TeX{} world we
%    provide the subset encoding data here. Users can add additional
%    font families in the file \texttt{textcomp.cfg} if they own other
%    fonts.
%
%    However, if the option ``forced'' was given then all subset
%    encoding specifications are ignored, so there is no point in
%    setting any of them up:
%    \begin{macrocode}
\iftc@forced \else
%    \end{macrocode}
%
%    Computer modern based fonts (e.g., CM, CM-Bright, Concrete):
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{cmr}     {0}
\DeclareEncodingSubset{TS1}{cmss}    {0}
\DeclareEncodingSubset{TS1}{cmtt}    {0}
\DeclareEncodingSubset{TS1}{cmvtt}   {0}
\DeclareEncodingSubset{TS1}{cmbr}    {0}
\DeclareEncodingSubset{TS1}{cmtl}    {0}
\DeclareEncodingSubset{TS1}{ccr}     {0}
%    \end{macrocode}
%
%    PSNFSS fonts:
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{ptm}     {4}
\DeclareEncodingSubset{TS1}{pcr}     {4}
\DeclareEncodingSubset{TS1}{phv}     {4}
\DeclareEncodingSubset{TS1}{ppl}     {3}
\DeclareEncodingSubset{TS1}{pag}     {4}
\DeclareEncodingSubset{TS1}{pbk}     {4}
\DeclareEncodingSubset{TS1}{pnc}     {4}
\DeclareEncodingSubset{TS1}{pzc}     {4}
\DeclareEncodingSubset{TS1}{bch}     {4}
\DeclareEncodingSubset{TS1}{put}     {5}
%    \end{macrocode}
%
%    Other CTAN fonts (probably not complete):
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{uag}     {5}
\DeclareEncodingSubset{TS1}{ugq}     {5}
\DeclareEncodingSubset{TS1}{ul8}     {4}
\DeclareEncodingSubset{TS1}{ul9}     {4}  % (LuxiSans, one day)
\DeclareEncodingSubset{TS1}{augie}   {5}
\DeclareEncodingSubset{TS1}{dayrom}  {3}
\DeclareEncodingSubset{TS1}{dayroms} {3}
\DeclareEncodingSubset{TS1}{pxr}     {0}
\DeclareEncodingSubset{TS1}{pxss}    {0}
\DeclareEncodingSubset{TS1}{pxtt}    {0}
\DeclareEncodingSubset{TS1}{txr}     {0}
\DeclareEncodingSubset{TS1}{txss}    {0}
\DeclareEncodingSubset{TS1}{txtt}    {0}
%    \end{macrocode}
%
%    Latin Modern and TeX Gyre:
% \changes{v1.99k}{2009/10/28}{Added Latin Modern and TeX Gyre subsets}
% \changes{v1.99l}{2009/11/04}{Added more Latin Modern and TeX Gyre subsets}
% \changes{v1.99m}{2015/02/16}{Added lmtt (Heiko Oberdiek) latex/4415}
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{lmr}     {0}
\DeclareEncodingSubset{TS1}{lmdh}    {0}
\DeclareEncodingSubset{TS1}{lmss}    {0}
\DeclareEncodingSubset{TS1}{lmssq}   {0}
\DeclareEncodingSubset{TS1}{lmvtt}   {0}
\DeclareEncodingSubset{TS1}{lmtt}    {0}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{qhv}     {0}
\DeclareEncodingSubset{TS1}{qag}     {0}
\DeclareEncodingSubset{TS1}{qbk}     {0}
\DeclareEncodingSubset{TS1}{qcr}     {0}
\DeclareEncodingSubset{TS1}{qcs}     {0}
\DeclareEncodingSubset{TS1}{qpl}     {0}
\DeclareEncodingSubset{TS1}{qtm}     {0}
\DeclareEncodingSubset{TS1}{qzc}     {0}
\DeclareEncodingSubset{TS1}{qhvc}    {0}
%    \end{macrocode}
%
%    Fourier-GUTenberg:
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{futs}    {4}
\DeclareEncodingSubset{TS1}{futx}    {4}
\DeclareEncodingSubset{TS1}{futj}    {4}
%    \end{macrocode}
%
%  Y\&Y's Lucida Bright
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{hlh}     {3}
\DeclareEncodingSubset{TS1}{hls}     {3}
\DeclareEncodingSubset{TS1}{hlst}    {3}
%    \end{macrocode}
%    The remaining settings for Lucida are conservative: the following
%    fonts contain the |\textohm| character but not the |\texteuro|,
%    i.e., belong to neither subset~4 nor subset~3. If you want to
%    use the |\textohm| with these fonts copy these definition to
%    \texttt{textcomp.cfg} and change the subset to~3. However in that
%    case make sure that you do not use the |\texteuro|.
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{hlct}    {5}
\DeclareEncodingSubset{TS1}{hlx}     {5}
\DeclareEncodingSubset{TS1}{hlce}    {5}
\DeclareEncodingSubset{TS1}{hlcn}    {5}
\DeclareEncodingSubset{TS1}{hlcw}    {5}
\DeclareEncodingSubset{TS1}{hlcf}    {5}
%    \end{macrocode}
%
%    Other commercial families\ldots
%    \begin{macrocode}
\DeclareEncodingSubset{TS1}{pplx}    {3}
\DeclareEncodingSubset{TS1}{pplj}    {3}
\DeclareEncodingSubset{TS1}{ptmx}    {4}
\DeclareEncodingSubset{TS1}{ptmj}    {4}
%    \end{macrocode}
%
%    If the file \texttt{textcomp.cfg} exists it will be loaded at
%    this point. This allows to define further subset encodings for
%    font families not covered by default.
%
%    \begin{macrocode}
\InputIfFileExists{textcomp.cfg}
  {\PackageInfo{textcomp}{Local configuration file used}}{}
%    \end{macrocode}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
%</TS1oldsty>
%    \end{macrocode}


% \Finale
%




\endinput
