substitutefont
Combine font families
- Copyright:
- © 2010, 2023 Günter Milde <milde@users.sf.net>
- 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 1.3 of this license or (at your option) any later version.
Description
In traditional 8-bit LaTeX, fonts are restricted to 256 glyphs per file. To support different languages and scripts, the New Font Selection Scheme uses a set of TeX font encodings [encguide].
Many Latin TeX fonts do not support Greek or Cyrillic, while many non-Latin fonts are extensions of a Latin font family but use a different family name due to license reasons or the creators preference.
The substitutefont package facilitated the task to set up a font family as substitute for another one in a specified font encoding. It is obsoleted by the standard LaTeX kernel command \DeclareFontFamilySubstitution.
Usage
The macro \DeclareFontFamilySubstitution{<encoding>}{<family>}{<new-family>} selects the font family <new-family> as replacement for <family> in the font encoding <encoding> [fntguide]. The substitution must be defined before the first use of the specified font encoding, preferably in the document preamble.[1]
The <encoding> is one of the LaTeX font encodings, e.g., T1 for Latin, T2A for Cyrillic(Russian), or LGR for Greek [encguide].
For <family> and <new-family>, use the «TeX names» of the font. They are defined by a TeX font package’s *.fd or *.sty file(s). LaTeX stores the default family names for Roman, Sans-Serif, and Teletype fonts in the \rmdefault, \sfdefault, and \ttdefault macros respectively.
Examples
Set the font family to Palatino using the standard package mathpazo for Latin and GFS Didot for Greek.
Using the obsolete substitutefont package:
\usepackage[sc,slantedGreek]{mathpazo} \usepackage{substitutefont} \substitutefont{LGR}{\rmdefault}{udidot}
Using the standard command:
\usepackage[sc,slantedGreek]{mathpazo} \DeclareFontFamilySubstitution{LGR}{\rmdefault}{udidot}
Example documents:
Palatino with Greek from GFS Didot: greek-palatino-didot.tex, greek-palatino-didot.pdf
Times/Helvetica/Courier (newtx) with GFS Artemisia, GFS Neohellenic, and teletype from the CB fonts: greek-times-artemisia.tex, greek-times-artemisia.pdf (see also package txfontsb)
Latin Modern with Cyrillic from CM LGC: cyrillic-lm-lgc.tex, cyrillic-lm-lgc.pdf
Times/Helvetica/Courier (TeX Gyre) with Cyrillic ParaType fonts: cyrillic-paratype.tex, cyrillic-paratype.pdf
Simple test with Latin fonts: substitutefont-test.tex, substitutefont-test.pdf
Source
- substitutefont.sty
The literate source was converted with PyLit to reStructuredText and with Docutils to the HTML documentation substitutefont.sty.html.
References
Frank Mittelbach, Robin Fairbairns, Werner Lemberg, LaTeX3 Project Team, LaTeX font encodings: https://mirrors.ctan.org/macros/latex/doc/encguide.pdf.
LaTeX3 Project Team, LaTeX 2e font selection: https://mirrors.ctan.org/macros/latex/doc/fntguide.pdf.
LaATeX News, Issue 31, February 2020, p. 3: https://www.latex-project.org/news/latex2e-news/ltnews31.pdf.