summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/addfont/addfont.sty
blob: 74d6bf63a4018ee5f97939086302f8d7d68f4f0d (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
% Copyright 2016-21 (c) Palle Joergensen
%
% This file is part of addfont.
%
% addfont is free software: you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% addfont is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with addfont. If not, see <http://www.gnu.org/licenses/>.
\ProvidesPackage{addfont}%
  [2021/03/20 v. 1.1 Easier usage of fonts without LaTeX support.]
\newif\ifaddfont@fixed
\addfont@fixedtrue
\RequirePackage{twoopt}
\RequirePackage{ifthen}
\newcommandtwoopt*\addfont@all[5][][]{% #1:scale, #2:sel-cmd, #3:enc, #4:family/font, #5:cmd
  \addfont@fixedfalse
  \def\addfont@latestencoding{#3}%
  \def\addfont@latestfamily{#4}%
  \ifthenelse{\equal{#1}{\@empty}}{\let\addfont@latestscale\@empty}{\def\addfont@latestscale{s*[#1]}}
  \DeclareFontFamily{#3}{#4}{#2}%
  \DeclareFontShape{#3}{#4}{m}{n}{<->#4}{}%
  \def#5{\fontencoding{#3}\fontfamily{#4}\mdseries\upshape}}

\newcommandtwoopt*\addfont@fixed[5][][]{% #1:scale, #2:sel-cmd, #3:enc, #4:font, #5:cmd
  \addfont@fixedtrue
  \def\addfont@latestencoding{#3}%
  \def\addfont@latestfamily{#4}%
  \ifthenelse{\equal{#1}{\@empty}}{\let\addfont@latestscale\@empty}{\def\addfont@latestscale{s*[#1]}}
  \DeclareFontFamily{#3}{#4}{#2}%
  \DeclareFontShape{#3}{#4}{m}{n}{%
    <5><6><7><8><9><10><10.95><12>%
    <14.4><17.28><20.74><24.88>\addfont@latestscale #4}{}%
  \def#5{\fontencoding{#3}\fontfamily{#4}\mdseries\upshape}}

\newcommand*\addfont@addshape@fixed[4]{% series, shape, font, sel-cmd
  \DeclareFontShape{\addfont@latestencoding}{\addfont@latestfamily}{#1}{#2}{%
    <5><6><7><8><9><10><10.95><12>%
    <14.4><17.28><20.74><24.88>\addfont@latestscale #3}{#4}}

\newcommand*\addfont@addshape@all[4]{% series, shape, font, sel-cmd
  \DeclareFontShape{\addfont@latestencoding}{\addfont@latestfamily}{#1}{#2}{%
    <->\addfont@latestscale #3}{#4}}

\def\addfont{\@ifstar{\addfont@all}{\addfont@fixed}}
\newcommand*\addshape[4][]{%
  \ifaddfont@fixed%
  \addfont@addshape@fixed{#2}{#3}{#4}{#1}%
  \else%
  \addfont@addshape@all{#2}{#3}{#4}{#1}%
  \fi}
\endinput