summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/substitutefont/substitutefont.sty.html
blob: 9d91bd89a9b04e823f26e563293d98bfa874e24c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
<title>Easy font substitution</title>
<meta name="copyright" content="© 2010 Günter Milde" />
<link rel="stylesheet" href="../../../../Python/docutils-svn/docutils/docutils/writers/html4strict/html4css1.css" type="text/css" />
<link rel="stylesheet" href="../../../../Python/docutils-svn/docutils/docutils/writers/html4strict/html4css2.css" type="text/css" />
</head>
<body>
<div class="document" id="easy-font-substitution">
<h1 class="title">Easy font substitution</h1>

<dl class="docinfo">
<dt class="copyright">Copyright</dt>
<dd class="copyright">© 2010 Günter Milde</dd>
<dt>Contributor</dt>
<dd><p>Special thanks to Ulrike Fischer who provided
the indirect definition with active <tt class="literal">\nfss&#64;catcodes</tt>.</p>
</dd>
<dt>Licence</dt>
<dd><p>This work may be distributed and/or modified under the
conditions of the <a class="reference external" href="http://www.latex-project.org/lppl.txt">LaTeX Project Public License</a>, either
version&nbsp;1.3 of this license or any later version.</p>
</dd>
<dt>Identification</dt>
<dd><pre class="literal-block">\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{substitutefont}
[2012/07/07 v0.1.3 combine font families]
</pre>
</dd>
</dl>
<div class="abstract topic">
<p class="topic-title first">Abstract</p>
<p>Provide the <tt class="literal">\substitutefont</tt> macro for defining
substitute fonts for specified font encodings.</p>
</div>
<dl class="docutils">
<dt>Changelog:</dt>
<dd><table class="borderless">
<colgroup>
<col width="18%" />
<col width="8%" />
<col width="74%" />
</colgroup>
<tbody>
<tr><td><p>2010-11-04</p></td>
<td><p>0.1</p></td>
<td><p>initial version</p></td>
</tr>
<tr><td><p>2012-04-30</p></td>
<td><p>0.1.1</p></td>
<td><p>documentation update, upload to CTAN</p></td>
</tr>
<tr><td><p>2012-07-05</p></td>
<td><p>0.1.2</p></td>
<td><p>documentation/example update</p></td>
</tr>
<tr><td><p>2012-07-07</p></td>
<td><p>0.1.3</p></td>
<td><p>bugfix (comment usage example)</p></td>
</tr>
<tr><td><p>2013-11-04</p></td>
<td><p>0.1.4</p></td>
<td><p>documentation update</p></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<div class="section" id="usage">
<h1>Usage</h1>
<p>The macro <tt class="literal"><span class="pre">\substitutefont{&lt;encoding&gt;}{&lt;family&gt;}{&lt;new-family&gt;}</span></tt>
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”.</p>
<dl class="docutils">
<dt>Example:</dt>
<dd><p>Palatino with the standard package <a class="reference external" href="http://www.ctan.org/pkg/mathpazo">mathpazo</a> for Latin and
<a class="reference external" href="http://mirror.ctan.org/help/Catalogue/entries/gfsdidot.html">GFS Didot</a> for Greek:</p>
<pre class="code latex literal-block"><span class="keyword">\usepackage</span><span class="name attribute">[sc,slantedGreek]</span><span class="name builtin">{</span>mathpazo<span class="name builtin">}</span>
<span class="keyword">\usepackage</span><span class="name builtin">{</span>substitutefont<span class="name builtin">}</span>
<span class="keyword">\substitutefont</span><span class="name builtin">{</span>LGR<span class="name builtin">}{</span><span class="keyword">\rmdefault</span><span class="name builtin">}{</span>udidot<span class="name builtin">}</span>
</pre>
</dd>
</dl>
</div>
<div class="section" id="implementation">
<h1>Implementation</h1>
<pre class="literal-block">\begingroup
\nfss&#64;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
</pre>
</div>
</div>
</body>
</html>