<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% Easy font substitution
% **********************
%
% :Copyright: © 2010 Günter Milde
%
% :Contributor: Special thanks to Ulrike Fischer who provided
%               the indirect definition with active ``\nfss@catcodes``.
%
% :Licence:   This work may be distributed and/or modified under the
%             conditions of the `LaTeX Project Public License`_, either
%             version&nbsp;1.3 of this license or any later version.
%
% :Abstract: Provide the ``\substitutefont`` macro for defining
%            substitute fonts for specified font encodings.
%
% :Identification:
%  ::

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{substitutefont}
[2023-09-05 v0.1.7 combine font families (obsolete)]

% Changelog:
%   .. class:: borderless
%
%   ============  ===== ================================================
%    2010-11-04   0.1   initial version
%    2012-04-30   0.1.1 documentation update, upload to CTAN
%    2012-07-05   0.1.2 documentation/example update
%    2012-07-07   0.1.3 bugfix (comment usage example)
%    2013-11-04   0.1.4 documentation update
%    2023-08-13   0.1.5 declare obsolete, update documentation and tests
%    2023-08-17   0.1.6 documentation fixes
%    2023-09-05   0.1.7 documentation update
%   ============  ===== ================================================
%
%
% Usage
% =====
%
% The macro ``\substitutefont{&lt;encoding&gt;}{&lt;family&gt;}{&lt;new-family&gt;}``
% selects the font &lt;new-family&gt; as replacement for &lt;family&gt; if the font
% encoding is &lt;encoding&gt; in the variants "normal", "italic", "slanted",
% and "small-caps" and the shapes "medium", "bold", and "bold-extended".
%
% Example:
%   Palatino with the standard package `mathpazo`_ for Latin and
%   `GFS Didot`_ for Greek:
%
%   .. code:: latex
%
%     \usepackage[sc,slantedGreek]{mathpazo}
%     \usepackage{substitutefont}
%     \substitutefont{LGR}{\rmdefault}{udidot}
%
%
% Implementation
% ==============
% ::

\begingroup
\nfss@catcodes
\newcommand*{\substitutefont}[3]{%
 \DeclareFontFamily{#1}{#2}{}
 \DeclareFontShape{#1}{#2}{m}{n}{&lt;-&gt;ssub * #3/m/n}{}
 \DeclareFontShape{#1}{#2}{m}{it}{&lt;-&gt;ssub * #3/m/it}{}
 \DeclareFontShape{#1}{#2}{m}{sl}{&lt;-&gt;ssub * #3/m/sl}{}
 \DeclareFontShape{#1}{#2}{m}{sc}{&lt;-&gt;ssub * #3/m/sc}{}
 \DeclareFontShape{#1}{#2}{b}{n}{&lt;-&gt;ssub * #3/b/n}{}
 \DeclareFontShape{#1}{#2}{b}{it}{&lt;-&gt;ssub * #3/b/it}{}
 \DeclareFontShape{#1}{#2}{b}{sl}{&lt;-&gt;ssub * #3/b/sl}{}
 \DeclareFontShape{#1}{#2}{b}{sc}{&lt;-&gt;ssub * #3/b/sc}{}
 \DeclareFontShape{#1}{#2}{bx}{n}{&lt;-&gt;ssub * #3/bx/n}{}
 \DeclareFontShape{#1}{#2}{bx}{it}{&lt;-&gt;ssub * #3/bx/it}{}
 \DeclareFontShape{#1}{#2}{bx}{sl}{&lt;-&gt;ssub * #3/bx/sl}{}
 \DeclareFontShape{#1}{#2}{bx}{sc}{&lt;-&gt;ssub * #3/bx/sc}{}
}
\global\let\substitutefont\substitutefont
\endgroup

% .. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt
% .. _GFS Didot: https://mirrors.ctan.org/help/Catalogue/entries/gfsdidot.html
% .. _mathpazo: https://ctan.org/pkg/mathpazo
</pre></body></html>