From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/substitutefont/README | 101 ++++++++++++++++++ .../contrib/substitutefont/cyrillic-lm-lgc.pdf | Bin 0 -> 322975 bytes .../contrib/substitutefont/cyrillic-lm-lgc.tex | 87 ++++++++++++++++ .../contrib/substitutefont/cyrillic-paratype.pdf | Bin 0 -> 261997 bytes .../contrib/substitutefont/cyrillic-paratype.tex | 95 +++++++++++++++++ .../substitutefont/greek-palatino-didot.pdf | Bin 0 -> 351177 bytes .../substitutefont/greek-palatino-didot.tex | 91 ++++++++++++++++ .../substitutefont/greek-times-artemisia.pdf | Bin 0 -> 393346 bytes .../substitutefont/greek-times-artemisia.tex | 71 +++++++++++++ .../contrib/substitutefont/substitutefont-doc.html | 106 +++++++++++++++++++ .../contrib/substitutefont/substitutefont-test.pdf | Bin 0 -> 147683 bytes .../contrib/substitutefont/substitutefont-test.tex | 55 ++++++++++ .../contrib/substitutefont/substitutefont.sty | 80 ++++++++++++++ .../contrib/substitutefont/substitutefont.sty.html | 115 +++++++++++++++++++++ 14 files changed, 801 insertions(+) create mode 100644 macros/latex/contrib/substitutefont/README create mode 100644 macros/latex/contrib/substitutefont/cyrillic-lm-lgc.pdf create mode 100644 macros/latex/contrib/substitutefont/cyrillic-lm-lgc.tex create mode 100644 macros/latex/contrib/substitutefont/cyrillic-paratype.pdf create mode 100644 macros/latex/contrib/substitutefont/cyrillic-paratype.tex create mode 100644 macros/latex/contrib/substitutefont/greek-palatino-didot.pdf create mode 100644 macros/latex/contrib/substitutefont/greek-palatino-didot.tex create mode 100644 macros/latex/contrib/substitutefont/greek-times-artemisia.pdf create mode 100644 macros/latex/contrib/substitutefont/greek-times-artemisia.tex create mode 100644 macros/latex/contrib/substitutefont/substitutefont-doc.html create mode 100644 macros/latex/contrib/substitutefont/substitutefont-test.pdf create mode 100644 macros/latex/contrib/substitutefont/substitutefont-test.tex create mode 100644 macros/latex/contrib/substitutefont/substitutefont.sty create mode 100644 macros/latex/contrib/substitutefont/substitutefont.sty.html (limited to 'macros/latex/contrib/substitutefont') diff --git a/macros/latex/contrib/substitutefont/README b/macros/latex/contrib/substitutefont/README new file mode 100644 index 0000000000..61c4a1416e --- /dev/null +++ b/macros/latex/contrib/substitutefont/README @@ -0,0 +1,101 @@ +substitutefont +-------------- +Combine font families +********************* + +: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 1.3 of this license or (at your option) + any later version. + +.. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt + +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 facilitates the task to set up a font family as +substitute for another one in a specified `font encoding `_. + +:News: 2013-11-04 Documentation/Test fixes. + +:Source: ``_ + + The literate source was converted with PyLit_ to reStructuredText_ and + with Docutils_ to the HTML documentation ``__. + +Usage +===== + +The macro ``\substitutefont{}{}{}`` selects +the font family as replacement for in the font +encoding . The substitution must be defined before the first use +of the specified font encoding, preferably in the document preamble. +In contrast to the (deprecated) ``\substitutefontfamily`` macro provided by +Babel_, ``\substitutefont`` does not write auxiliary files. + +The ```` is one of the LaTeX font encodings [encguide]_, e.g., T1 +for Latin, T2A for Cyrillic(Russian), or LGR for Greek. + +For ```` and ````, use the «TeX names» of the font. +There 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. + +Example: Set the font family to Palatino using the standard package +`mathpazo` for Latin and `GFS Didot`_ for Greek:: + + \usepackage[sc,slantedGreek]{mathpazo} + \usepackage{substitutefont} + \substitutefont{LGR}{\rmdefault}{udidot} + +For details on LaTeX font selection, see [encguide]_ and [fntguide]_. + +Tests/Examples +============== + +* Simple test with Latin fonts: + ``__, ``__ +* Palatino with Greek from `GFS Didot`_: + ``__, ``__ +* Times/Helvetica/Courier (newtx_) with `GFS Artemisia`_, `GFS + Neohellenic`_, and teletype from the CB_ fonts: txfontsb_ + ``__, ``__ +* Latin Modern with Cyrillic from `CM LGC`_: + ``__, ``__ +* Times/Helvetica/Courier (TeX Gyre) with Cyrillic ParaType_ fonts: + ``__, ``__ + + +References +========== + +.. [encguide] Frank Mittelbach, Robin Fairbairns, Werner Lemberg, + LaTeX3 Project Team, `LaTeX font encodings`: + http://mirror.ctan.org/macros/latex/doc/encguide.pdf. + +.. [fntguide] LaTeX3 Project Team, `LaTeX 2e font selection`: + http://mirror.ctan.org/macros/latex/doc/fntguide.pdf. + +.. _Babel: http://www.ctan.org/pkg/babel +.. _CM LGC: http://www.ctan.org/pkg/cm-lgc +.. _CB: http://www.ctan.org/pkg/cbgreek-complete +.. _GFS Artemisia: http://www.ctan.org/pkg/gfsartemisia +.. _GFS Didot: http://www.ctan.org/pkg/gfsdidot +.. _GFS Neohellenic: http://www.ctan.org/pkg/gfsneohellenic +.. _mathpazo: http://www.ctan.org/pkg/mathpazo +.. _newtx: http://www.ctan.org/pkg/newtx +.. _txfontsb: http://www.ctan.org/pkg/txfontsb +.. _ParaType: http://www.ctan.org/pkg/paratype + +.. _PyLit: http://pylit.berlios.de +.. _reStructuredText: http://docutils.sourceforge.net/rst.html +.. _Docutils: http://docutils.sourceforge.net/rst.html diff --git a/macros/latex/contrib/substitutefont/cyrillic-lm-lgc.pdf b/macros/latex/contrib/substitutefont/cyrillic-lm-lgc.pdf new file mode 100644 index 0000000000..027656c642 Binary files /dev/null and b/macros/latex/contrib/substitutefont/cyrillic-lm-lgc.pdf differ diff --git a/macros/latex/contrib/substitutefont/cyrillic-lm-lgc.tex b/macros/latex/contrib/substitutefont/cyrillic-lm-lgc.tex new file mode 100644 index 0000000000..2e68c7b876 --- /dev/null +++ b/macros/latex/contrib/substitutefont/cyrillic-lm-lgc.tex @@ -0,0 +1,87 @@ +\documentclass[a4paper]{scrartcl} +\usepackage{fixltx2e} % LaTeX patches, \textsubscript +\usepackage[T2A, T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[russian,english]{babel} +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +\usepackage{bookmark} +\usepackage{parskip} +\pagestyle{empty} + +% Combine "Latin Modern" fonts for Latin and +% "CLG" fonts for Cyrillic. +\usepackage{substitutefont} +\usepackage{lmodern} +\substitutefont{T2A}{lmr}{fcm} +\substitutefont{T2A}{lmss}{fcs} +\substitutefont{T2A}{lmtt}{fct} + +\begin{document} + +\section*{Cyrillic fonts to match Latin Modern} + +Declaring the font encoding T1 (by inclusion in the option list for fontenc) +is recommended, if the text contains accented Latin characters as is usual +in most European languages and even in some English words (e.g. \emph{Résumé +of Nathan Söderblom}). However, the original Computer Modern fonts (CM) are +not available in T1 encoding. There are two alternative CM-compatible vector +fonts supporting T1: + +\begin{itemize} + +\item The \href{http://www.ctan.org/pkg/cm-super}{CM-Super} package installes + itself as CM substitute and is used for Cyrillic text, too. + +\item \href{http://www.ctan.org/pkg/lm}{Latin Modern} does not include Cyrillic + fonts. The default substitution is CM, either CM-Super or + \href{http://www.ctan.org/pkg/LH}{LH} bitmap fonts. +\end{itemize} + +The preamble code of this document uses \emph{substitutefont} to set up the +vector-fonts from the \href{http://www.ctan.org/pkg/cm-lgc}{cm-lgc} +package as a Cyrillic replacement for Latin Modern. + +\section{\foreignlanguage{russian}{Тест шрифтов}} + +\newcommand{\teststring}{Hello world! + \foreignlanguage{russian}{Здравствуй, мир!}} + +\begin{description} + \item [Normal:] \teststring + + \item [it:] \textit{\teststring} + + \item [sl:] \textsl{\teststring} + + \item [bf:] \textbf{\teststring} + + \item [bf it:] \textbf{\textit\teststring} + + \item [sc:] \textsc{\teststring} + + % \item [bf sc:] \textsc{\textbf\teststring} missing in Didot + + \item [sf:] \textsf{\teststring} + + \item [sf bf:] \textsf{\textbf\teststring} + + \item [sf sl:] \textsf{\textsl\teststring} + + \item [sf sc:] \textsf{\textsc\teststring} + + \item [tt:] \texttt{\teststring} + +\end{description} + +\selectlanguage{english} + +The Russian language definition switches the font encoding from +\emph{cyrillicencoding} to \emph{latinencoding} when changing from Russian +to another language. Babel base sets the variable \emph{latinencoding} to T1 +if this font encoding is declared and to OT1 else. + +\selectlanguage{russian} + +До свидания! + +\end{document} diff --git a/macros/latex/contrib/substitutefont/cyrillic-paratype.pdf b/macros/latex/contrib/substitutefont/cyrillic-paratype.pdf new file mode 100644 index 0000000000..98a826b890 Binary files /dev/null and b/macros/latex/contrib/substitutefont/cyrillic-paratype.pdf differ diff --git a/macros/latex/contrib/substitutefont/cyrillic-paratype.tex b/macros/latex/contrib/substitutefont/cyrillic-paratype.tex new file mode 100644 index 0000000000..d5a4ac2a9f --- /dev/null +++ b/macros/latex/contrib/substitutefont/cyrillic-paratype.tex @@ -0,0 +1,95 @@ +\documentclass[a4paper]{article} +\usepackage{fixltx2e} % LaTeX patches, \textsubscript +\usepackage[T2A,T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[russian,english]{babel} +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +\usepackage{bookmark} + +\pagestyle{empty} + +% Combine "TeX Gyre" fonts for Latin and "ParaType" fonts for Cyrillic: + +% 1. Load paratype font-packages to get scaled Paratype fonts +\usepackage[scaled=0.9]{PTSerif} +\usepackage[scaled=0.9]{PTSans} +\usepackage[scaled=0.87]{PTMono} + +% 2. Load TeX Gyre font-packages (after Paratype to use them as default fonts) +\usepackage{tgtermes} +\usepackage[scale=.90]{tgheros} +\usepackage{tgcursor} + +% 3. Set up the substitutions: +\usepackage{substitutefont} +\substitutefont{T2A}{\rmdefault}{PTSerif-TLF} +\substitutefont{T2A}{\sfdefault}{PTSans-TLF} +\substitutefont{T2A}{\ttdefault}{PTMono-TLF} + + +\begin{document} + +\section*{Cyrillic fonts to match Times/Helvetica/Curier} + +The \href{http://www.ctan.org/pkg/tex-gyre}{TeX Gyre} project provides +extensions to the URW standard Postscript fonts. Cyrillic extensions by +Valek Filippov were part of TeXGyre but removed due to license +incompatibility. + +These fonts are still available in the +\href{http://packages.debian.org/stable/scalable-cyrfonts-tex}% +{scalable-cyrfonts-tex} Debian package but not on CTAN. Furthermore, both +\href{http://www.ctan.org/pkg/fouriernc}{Fourier New Century} and +\emph{Free New Century} use the TeX-name \emph{fnc}. Therefore +\emph{scalable-cyrfonts-tex} conflicts with the Debian +\href{http://packages.debian.org/stable/texlive-fonts-extra}% +{texlive-fonts-extra} package. + +The Cyrillic fonts from the +\href{http://www.ctan.org/pkg/paratype}{paratype} package are not exact +matches but fit quite well if they are downscaled a bit. As the Paratype +package includes also T1 encoded fonts, Paratype fonts can be used for both +Latin and Cyrillic text. + +Other vector fonts supporting Cyrillic include +\href{http://www.ctan.org/pkg/dejavu}{Deja Vu}, +\href{http://www.ctan.org/pkg/droid}{Droid}, +\href{http://www.ctan.org/pkg/gentium-tug}{Gentium}, and +\href{http://www.ctan.org/pkg/libertine}{Linux Libertine}. + +\section*{\selectlanguage{russian}Тест шрифтов} + +\newcommand{\teststring}{Hello world! + \foreignlanguage{russian}{Здравствуй, мир!}} + +\begin{description} + \item [Normal:] \teststring + + \item [it:] \textit{\teststring} + + \item [sl:] \textsl{\teststring}% + \footnote{TeX Gyre merges slanted and italic shapes} + + \item [bf:] \textbf{\teststring} + + \item [bf it:] \textbf{\textit\teststring} + + \item [sc:] not available in Paratype % \textsc{\teststring} + + \item [bf sc:] missing % \textsc{\textbf\teststring} + + \item [sf:] \textsf{\teststring} + + \item [sf bf:] \textsf{\textbf\teststring} + + \item [sf sl:] \textsf{\textsl\teststring} + + \item [sf sc:] not available in Paratype % \textsf{\textsc\teststring} + + \item [tt:] \texttt{\teststring} + +\end{description} + + + +\end{document} diff --git a/macros/latex/contrib/substitutefont/greek-palatino-didot.pdf b/macros/latex/contrib/substitutefont/greek-palatino-didot.pdf new file mode 100644 index 0000000000..933663d561 Binary files /dev/null and b/macros/latex/contrib/substitutefont/greek-palatino-didot.pdf differ diff --git a/macros/latex/contrib/substitutefont/greek-palatino-didot.tex b/macros/latex/contrib/substitutefont/greek-palatino-didot.tex new file mode 100644 index 0000000000..e8bddaf56c --- /dev/null +++ b/macros/latex/contrib/substitutefont/greek-palatino-didot.tex @@ -0,0 +1,91 @@ +% Example and test for the substitutefont package: +\documentclass[a4paper,DIV14]{scrartcl} +\usepackage{parskip} +\usepackage[LGR,T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[greek,english]{babel} +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +\usepackage{bookmark} +\pagestyle{empty} + +\usepackage{substitutefont} +% Serif +\usepackage[sc,slantedGreek]{mathpazo} +\substitutefont{LGR}{\rmdefault}{udidot} + +% Sans +\usepackage[scale=.90]{tgheros} +\substitutefont{LGR}{\sfdefault}{neohellenic} + +% Monospaced +% \usepackage[matchlowercase]{tgcursor} +\renewcommand{\ttdefault}{txtt} +\substitutefont{LGR}{\ttdefault}{cmtt} % CB fonts +% \substitutefont{LGR}{\ttdefault}{fdm} % Droid Sans Mono + + +% Teststring +\newcommand{\alphabet}{% + abcdefghjiklmnoprqrstuvwxyzäöüß + \foreignlanguage{greek}{abgdezhjiklmnxoprsctufqyw} \\ + ABCDEFGHJIKLMNOPRQRSTUVWXYZÄÖÜ + \foreignlanguage{greek}{ABGDEZHJIKLMNXOPRSTUFQYW} +} + +\begin{document} + +\section*{Palatino/Helvetica/TXTT and Greek replacements} + +Default font families after loading mathpazo, tgheros, and tgcursor:\\ +familydefault: \familydefault{}, +rmdefault: \rmdefault{}, +sfdefault: \sfdefault{}, +ttdefault: \ttdefault{} + +Palatino (mathpazo) with GFS Didot: + +\begin{description} + \item [Normal:] \alphabet + + \item [it:] \textit{\alphabet} + + \item [sl:] \textsl{\alphabet} + + \item [bf:] \textbf{\alphabet} + + \item [bf it:] \textbf{\textit\alphabet} + + \item [sc:] \textsc{\alphabet} + + % \item [bf sc:] \textsc{\textbf\alphabet} + +\end{description} + +Helvetica (TG Heros) with GFS Neohellenic: + +\begin{description} + + \item [sf:] \textsf{\alphabet} + + \item [sf bf:] \textsf{\textbf\alphabet} + + \item [sf sl:] \textsf{\textsl\alphabet} + + \item [sf sc:] \textsf{\textsc\alphabet} + +\end{description} + +There is no Greek extension for the monospaced standard PS font Curier. +A good replacement are the teletype fonts from +\href{http://www.ctan.org/pkg/newtx}{txfonts} and +\href{http://www.ctan.org/pkg/cbgreek-complete}{CB-Greek}: + +\begin{description} + + \item [tt:] \texttt{\alphabet} + % \item [tt bf:] \texttt{\textbf\alphabet} % not in CB-Greek + \item [tt it:] \texttt{\textit\alphabet} + +\end{description} + +\end{document} diff --git a/macros/latex/contrib/substitutefont/greek-times-artemisia.pdf b/macros/latex/contrib/substitutefont/greek-times-artemisia.pdf new file mode 100644 index 0000000000..9045f6c7a3 Binary files /dev/null and b/macros/latex/contrib/substitutefont/greek-times-artemisia.pdf differ diff --git a/macros/latex/contrib/substitutefont/greek-times-artemisia.tex b/macros/latex/contrib/substitutefont/greek-times-artemisia.tex new file mode 100644 index 0000000000..b6740a37f6 --- /dev/null +++ b/macros/latex/contrib/substitutefont/greek-times-artemisia.tex @@ -0,0 +1,71 @@ +% Example and test for the substitutefont package: +\documentclass{article} +\usepackage{parskip} +\usepackage[LGR,T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} +\usepackage{bookmark} +\pagestyle{empty} + +\usepackage{substitutefont} + +% Serif +\usepackage[scaled=0.97]{newtxtext} +\substitutefont{LGR}{\rmdefault}{artemisia} + +% Sans +\substitutefont{LGR}{\sfdefault}{neohellenic} + +% Monospaced +\substitutefont{LGR}{\ttdefault}{cmtt} % CB fonts + + +% Teststring +\newcommand{\alphabet}{% + abcdefghjiklmnoprqrstuvwxyzäöüß + {\fontencoding{LGR}\selectfont abgdezhjiklmnxoprsctufqyw} \\ + ABCDEFGHJIKLMNOPRQRSTUVWXYZÄÖÜ + {\fontencoding{LGR}\selectfont ABGDEZHJIKLMNXOPRSTUFQYW}% +} + +\begin{document} + +\section*{Times/Helvetica/TXTT and Greek replacements} + +Use Times, Helvetica, and TXTT from the +\href{http://www.ctan.org/pkg/newtx}{newtx} package and +\href{http://www.ctan.org/pkg/gfsartemisia}{GFS Artemisia}, +\href{http://www.ctan.org/pkg/gfsneohellenic}{GFS Neohellenic}, +and \href{http://www.ctan.org/pkg/cbgreek-complete}{CB-Fonts}, +for Greek text.\footnote{% +See the \href{http://www.ctan.org/pkg/txfontsb}{txfontsb} +package for an alternative.} + +\begin{description} + \item [Normal:] \alphabet + + \item [it:] \textit{\alphabet} + + \item [sl:] \textsl{\alphabet} + + \item [bf:] \textbf{\alphabet} + + \item [bf it:] \textbf{\textit\alphabet} + + \item [sc:] \textsc{\alphabet} + + % \item [bf sc:] \textsc{\textbf\alphabet} missing in Bodoni + + \item [sf:] \textsf{\alphabet} + + \item [sf bf:] \textsf{\textbf\alphabet} + + \item [sf sl:] \textsf{\textsl\alphabet} + + \item [sf sc:] \textsf{\textsc\alphabet} + + \item [tt:] \texttt{\alphabet} + +\end{description} + +\end{document} diff --git a/macros/latex/contrib/substitutefont/substitutefont-doc.html b/macros/latex/contrib/substitutefont/substitutefont-doc.html new file mode 100644 index 0000000000..8df4b99b40 --- /dev/null +++ b/macros/latex/contrib/substitutefont/substitutefont-doc.html @@ -0,0 +1,106 @@ + + + + + + +substitutefont + + + + + +
+

substitutefont

+

Combine font families

+ +
+ + +
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.

+
+
+

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 facilitates the task to set up a font family as +substitute for another one in a specified font encoding.

+
+
News
+

2013-11-04 Documentation/Test fixes.

+
+
Source
+

substitutefont.sty

+

The literate source was converted with PyLit to reStructuredText and +with Docutils to the HTML documentation substitutefont.sty.html.

+
+
+
+

Usage

+

The macro \substitutefont{<encoding>}{<family>}{<new-family>} selects +the font family <new-family> as replacement for <family> in the font +encoding <encoding>. The substitution must be defined before the first use +of the specified font encoding, preferably in the document preamble. +In contrast to the (deprecated) \substitutefontfamily macro provided by +Babel, \substitutefont does not write auxiliary files.

+

The <encoding> is one of the LaTeX font encodings [encguide], e.g., T1 +for Latin, T2A for Cyrillic(Russian), or LGR for Greek.

+

For <family> and <new-family>, use the «TeX names» of the font. +There 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.

+

Example: Set the font family to Palatino using the standard package +mathpazo for Latin and GFS Didot for Greek:

+
\usepackage[sc,slantedGreek]{mathpazo}
+\usepackage{substitutefont}
+\substitutefont{LGR}{\rmdefault}{udidot}
+
+

For details on LaTeX font selection, see [encguide] and [fntguide].

+
+
+

Tests/Examples

+ +
+
+

References

+
[encguide]
+
+(1, 2, 3)

Frank Mittelbach, Robin Fairbairns, Werner Lemberg, +LaTeX3 Project Team, LaTeX font encodings: +http://mirror.ctan.org/macros/latex/doc/encguide.pdf.

+
+
+
[fntguide]
+
+

LaTeX3 Project Team, LaTeX 2e font selection: +http://mirror.ctan.org/macros/latex/doc/fntguide.pdf.

+
+
+
+
+ + diff --git a/macros/latex/contrib/substitutefont/substitutefont-test.pdf b/macros/latex/contrib/substitutefont/substitutefont-test.pdf new file mode 100644 index 0000000000..d357cf6764 Binary files /dev/null and b/macros/latex/contrib/substitutefont/substitutefont-test.pdf differ diff --git a/macros/latex/contrib/substitutefont/substitutefont-test.tex b/macros/latex/contrib/substitutefont/substitutefont-test.tex new file mode 100644 index 0000000000..0d32eb18ce --- /dev/null +++ b/macros/latex/contrib/substitutefont/substitutefont-test.tex @@ -0,0 +1,55 @@ +\documentclass[a4paper]{article} +\usepackage{fixltx2e} % LaTeX patches, \textsubscript +\usepackage[T1,OT1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{parskip} + +\title{Simple substitutefont test} +\author{Günter Milde} + +% Combine "Latin Modern" fonts for OT1 and Bookman for T1. +\usepackage{substitutefont} +\usepackage{lmodern} +% Substitution also works for fonts that exist in the specified encoding: +\substitutefont{T1}{lmr}{pbk} + +% \addto\extrasgerman{\fontencoding{T1}\selectfont} +% \addto\noextrasgerman{\fontencoding{\encodingdefault}\selectfont} + +\begin{document} + +\maketitle + +This document is a test that should work with any standard basic LaTeX +installation. For real use cases, see the test documents setting up matching +Latin and Greek or Cyrillic fonts. + +Some text in \encodingdefault{} encoding, the font is Latin Modern: +Résumé of Nathan Söderblom. + +% (Defining the substitution in the document body is possible (but not +% recommended) if it is done before the first use of a font in the specified +% encoding.) +% \substitutefont{T1}{lmr}{pbk} + +\fontencoding{T1}\selectfont + +Some text in T1 encoding, the font is Bookmark: Résumé of Nathan Söderblom% +\footnote{Compare the result of drag-and-drop or text search for words with +accented characters for OT1 and T1 encoded text.} + +\fontencoding{OT1}\selectfont + +Back to OT1 and Latin Modern. + +% The following substitution definition is ignored, because T1 fonts are +% already set up: +\substitutefont{T1}{lmr}{pag} + + + +\fontencoding{T1}\selectfont + +Some more text in T1 encoding and Bookmark. + +\end{document} diff --git a/macros/latex/contrib/substitutefont/substitutefont.sty b/macros/latex/contrib/substitutefont/substitutefont.sty new file mode 100644 index 0000000000..1960c8cff9 --- /dev/null +++ b/macros/latex/contrib/substitutefont/substitutefont.sty @@ -0,0 +1,80 @@ +% 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 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} +[2012/07/07 v0.1.3 combine font families] + +% 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 +% ============ ===== ================================================= +% +% +% Usage +% ===== +% +% The macro ``\substitutefont{}{}{}`` +% selects the font as replacement for if the font +% encoding is 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}{<->ssub * #3/m/n}{} + \DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{} + \DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{} + \DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{} + \DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/b/n}{} + \DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/b/it}{} + \DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/b/sl}{} + \DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/b/sc}{} + \DeclareFontShape{#1}{#2}{bx}{n}{<->ssub * #3/bx/n}{} + \DeclareFontShape{#1}{#2}{bx}{it}{<->ssub * #3/bx/it}{} + \DeclareFontShape{#1}{#2}{bx}{sl}{<->ssub * #3/bx/sl}{} + \DeclareFontShape{#1}{#2}{bx}{sc}{<->ssub * #3/bx/sc}{} +} +\global\let\substitutefont\substitutefont +\endgroup + +% .. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt +% .. _GFS Didot: http://mirror.ctan.org/help/Catalogue/entries/gfsdidot.html +% .. _mathpazo: http://www.ctan.org/pkg/mathpazo diff --git a/macros/latex/contrib/substitutefont/substitutefont.sty.html b/macros/latex/contrib/substitutefont/substitutefont.sty.html new file mode 100644 index 0000000000..9d91bd89a9 --- /dev/null +++ b/macros/latex/contrib/substitutefont/substitutefont.sty.html @@ -0,0 +1,115 @@ + + + + + + +Easy font substitution + + + + + +
+

Easy font substitution

+ +
+ + +
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 any later version.

+
+
Identification
+
\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{substitutefont}
+[2012/07/07 v0.1.3 combine font families]
+
+
+
+
+

Abstract

+

Provide the \substitutefont macro for defining +substitute fonts for specified font encodings.

+
+
+
Changelog:
+
+++++ + + + + + + + + + + + + + + + + + + + + + + +

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

+
+
+
+

Usage

+

The macro \substitutefont{<encoding>}{<family>}{<new-family>} +selects the font <new-family> as replacement for <family> if the font +encoding is <encoding> 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:

+
\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}{<->ssub * #3/m/n}{}
+ \DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}
+ \DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}
+ \DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}
+ \DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/b/n}{}
+ \DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/b/it}{}
+ \DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/b/sl}{}
+ \DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/b/sc}{}
+ \DeclareFontShape{#1}{#2}{bx}{n}{<->ssub * #3/bx/n}{}
+ \DeclareFontShape{#1}{#2}{bx}{it}{<->ssub * #3/bx/it}{}
+ \DeclareFontShape{#1}{#2}{bx}{sl}{<->ssub * #3/bx/sl}{}
+ \DeclareFontShape{#1}{#2}{bx}{sc}{<->ssub * #3/bx/sc}{}
+}
+\global\let\substitutefont\substitutefont
+\endgroup
+
+
+
+ + -- cgit v1.2.3