Debian Codegraph @

texmf-dist/tex/plain/pdftoolbox/pdfDstruct/ptb-fonts.tex

raw
1 \input ptb-utils
2 \input ptb-pdfData
3
4 \createarray{available fonts}
5
6 \def\___setfontsizes#1#2#3{%
7 \def\_temp{#2}%
8 \def\_tempA{default}%
9 \font\@@=#3\relax%
10 \ifx\_temp\_tempA%
11 \_xp\edef\csname #1 default\endcsname{#3}%
12 \else%
13 \_xp\edef\csname #1 at #2\endcsname{#3}%
14 \fi%
15 }
16
17 \def\__setfontsizes#1#2{%
18 \ifx\_nul#2%
19 \else%
20 \___setfontsizes{#1}#2%
21 \_afterfi{\__setfontsizes{#1}}%
22 \fi%
23 }
24
25 \def\_setfontsizes#1#2{%
26 \def\_temp{\__setfontsizes{#1}}%
27 \_xp\_temp#2\_nul%
28 }
29
30 \def\addfont#1#2{%
31 \_mapkeys_with_setter\_vanilla_mapkey\lastkeys{#2}%
32 \keyexists{default}\_defaultcode\lastkeys%
33 \ifx\_defaultcode\_nul%
34 {\newlinechar=`^^J
35 \errhelp={Default codes are used for when a specific font size is not specified but requested, in which case the default code is scaled up to the requested font size.^^J%
36 For example, if the font name is `rm', the default code may be `cmr10'.^^J%
37 If a font size of 20 is requested, but not specified, then the font `cmr10 at 20pt' will be utilized.}%
38 \errmessage{Default code was not specified}%
39 }%
40 \fi%
41 \_setfontsizes{#1}\lastkeys%
42 \appendarray{available fonts}{#1}%
43 }
44
45 \def\applyfontcode{\afterassignment\@@ \font\@@}
46
47 \def\getfontcode#1#2{%
48 \ifcsname #1 at #2\endcsname%
49 \csname #1 at #2\endcsname%
50 \else%
51 \csname #1 default\endcsname\_space at #2
52 \fi%
53 }
54
55 \def\textfontcalc#1{\def\fontsize{#1}}
56 \def\scriptfontcalc#1{\edef\fontsize{\the\dimexpr #1 * 7 / 10\relax}}
57 \def\scriptscriptfontcalc#1{\edef\fontsize{\the\dimexpr #1 / 2\relax}}
58
59 % #1: Family
60 % #2: Font
61 \def\_setfontfamily#1#2{%
62 \textfontcalc{\currscale}%
63 \expanded{\noexpand\font\noexpand\@@=\getfontcode{#2}{\fontsize}}%
64 \textfont#1=\@@%
65 \scriptfontcalc{\currscale}%
66 \expanded{\noexpand\font\noexpand\@@=\getfontcode{#2}{\fontsize}}%
67 \scriptfont#1=\@@%
68 \scriptscriptfontcalc{\currscale}%
69 \expanded{\noexpand\font\noexpand\@@=\getfontcode{#2}{\fontsize}}%
70 \scriptscriptfont#1=\@@%
71 }
72
73 \def\_rsetfontfamily#1#2#3{\_setfontfamily{#2}{#1}}
74
75 \createarray{math@fonts}
76
77 \def\setfontfamily#1#2{%
78 \ifcsname family@#1@font\endcsname%
79 \removeitemarray{font@\csname family@#1@font\endcsname @family}{#1}%
80 \fi%
81 \_setfontfamily{#1}{#2}%
82 \_xp\def\csname family@#1@font\endcsname{#2}%
83 \ensurearray{font@#2@family}%
84 \appendarray{font@#2@family}{#1}%
85 \appendarray{math@fonts}{#2}%
86 }
87
88 \def\_updatefontfamily#1#2{%
89 \arraymap{font@#1@family}{\_rsetfontfamily{#1}}%
90 }
91
92 \def\updatefontfamilies{%
93 \arraymap{math@fonts}\_updatefontfamily%
94 }
95
96 \def\_setfont_and_scale#1#2{%
97 \applyfontcode\getfontcode{#1}{#2}\relax%
98 }
99
100 \protected\def\setfont#1{%
101 \edef\currfont{#1}%
102 \_setfont_and_scale\currfont\currscale%
103 }
104
105 \protected\def\setscale#1{%
106 \edef\currscale{\the\dimexpr#1\relax}%
107 \_setfont_and_scale\currfont\currscale%
108 \updatefontfamilies%
109 }
110
111 \protected\def\setfontandscale#1#2{%
112 \edef\currfont{#1}%
113 \edef\currscale{\the\dimexpr#2\relax}%
114 \_setfont_and_scale\currfont\currscale%
115 \updatefontfamilies%
116 }
117
118 \addfont{rm}{%
119 default=cmr10,
120 5pt=cmr5,
121 6pt=cmr6,
122 7pt=cmr7,
123 8pt=cmr8,
124 9pt=cmr9,
125 10pt=cmr10,
126 12pt=cmr12,
127 17pt=cmr17
128 }
129
130 \addfont{it}{%
131 default=cmti10,
132 7pt=cmti7,
133 8pt=cmti8,
134 9pt=cmti9,
135 10pt=cmti10,
136 12pt=cmti12
137 }
138
139 \addfont{bf}{%
140 default=cmbx10,
141 5pt=cmbx5,
142 6pt=cmbx6,
143 7pt=cmbx7,
144 8pt=cmbx8,
145 9pt=cmbx9,
146 10pt=cmbx10,
147 12pt=cmbx12
148 }
149
150 \addfont{sc}{%
151 default=cmcsc10,
152 8pt=cmcsc8,
153 9pt=cmcsc9,
154 10pt=cmcsc10
155 }
156
157 \addfont{mi}{%
158 default=cmmi10,
159 5pt=cmmi5,
160 6pt=cmmi6,
161 7pt=cmmi7,
162 8pt=cmmi8,
163 9pt=cmmi9,
164 10pt=cmmi10,
165 12pt=cmmi12
166 }
167
168 \addfont{sy}{%
169 default=cmsy10,
170 5pt=cmsy5,
171 6pt=cmsy6,
172 7pt=cmsy7,
173 8pt=cmsy8,
174 9pt=cmsy9,
175 10pt=cmsy10
176 }
177
178 \addfont{ex}{%
179 default=cmex10,
180 7pt=cmex7,
181 8pt=cmex8,
182 9pt=cmex9,
183 10pt=cmex10
184 }
185
186 \addfont{sl}{%
187 default=cmsl10,
188 8pt=cmsl8,
189 9pt=cmsl9,
190 10pt=cmsl10,
191 12pt=cmsl12
192 }
193
194 \addfont{ss}{%
195 default=cmss10,
196 8pt=cmss8,
197 9pt=cmss9,
198 10pt=cmss10,
199 12pt=cmss12
200 }
201
202 \addfont{tt}{%
203 default=cmtt10,
204 8pt=cmtt8,
205 9pt=cmtt9,
206 10pt=cmtt10,
207 12pt=cmtt12
208 }
209
210 \addfont{sl}{%
211 default=cmsl10,
212 8pt=cmsl8,
213 9pt=cmsl9,
214 10pt=cmsl10,
215 12pt=cmsl12
216 }
217
218 \addfont{msam}{%
219 default=msam10,
220 8pt=msam8,
221 9pt=msam9,
222 10pt=msam10
223 }
224
225 \addfont{msbm}{%
226 default=msbm10,
227 8pt=msbm8,
228 9pt=msbm9,
229 10pt=msbm10
230 }
231
232 \addfont{eufm}{%
233 default=eufm10,
234 8pt=eufm8,
235 9pt=eufm9,
236 10pt=eufm10
237 }
238
239 \addfont{rsfs}{
240 default=rsfs10,
241 10pt=rsfs10
242 }
243
244 \setfontandscale{rm}{10pt}
245 \setfontfamily{0}{rm}
246 \setfontfamily{1}{mi}
247 \setfontfamily{2}{sy}
248 \setfontfamily{3}{ex}
249 \setfontfamily{4}{msam}
250 \setfontfamily{5}{msbm}
251 \setfontfamily{6}{bf}
252 \setfontfamily{7}{tt}
253 \setfontfamily{8}{it}
254 \setfontfamily{9}{ss}
255 \setfontfamily{10}{sl}
256 \setfontfamily{11}{eufm}
257 \setfontfamily{12}{rsfs}
258 \def\bf{\setfont{bf}\fam=6\relax}
259 \def\it{\setfont{it}\fam=8\relax}
260 \def\bb{\fam=5\relax}
261 \def\sf{\setfont{ss}\fam=9\relax}
262 \def\sl{\setfont{sl}\fam=10\relax}
263 \def\frak{\setfont{eufm}\fam=11\relax}
264 \def\scr{\setfont{rsfs}\fam=12\relax}
265
266 \def\__{\__}
267
268 \def\__mathftable#1#2#3{%
269 \mathchardef#2=\the\numexpr"#3#100 + \the\_ptbcountA\relax%
270 \advance\_ptbcountA by 1\relax%
271 \_mathftable{#1}%
272 }
273
274 \def\_mathftable#1#2{%
275 \ifx\_nul#2%
276 \else%
277 \_afterfi{%
278 \ifx\__#2%
279 \advance\_ptbcountA by 1\relax%
280 \_afterfi{\_mathftable{#1}}%
281 \else%
282 \_afterfi{\__mathftable{#1}{#2}}%
283 \fi%
284 }%
285 \fi%
286 }
287
288 \def\_mathfonttable#1[#2]#3{%
289 \_ptbcountA=#2\relax%
290 \_mathftable{#1}#3\_nul%
291 }
292
293 \def\mathfonttable#1{%
294 \_ifnextchar[ {\_mathfonttable{#1}}{\_mathfonttable{#1}[0]}%
295 }
296
297 \mathfonttable{4}[0]{%
298 \boxdot2\boxplus2\boxtimes2\square0\blacksquare0\__\diamond0\blackdiamond0\rotateclockwise0%
299 \rotatecounterclockwise0\rightleftharpoons3\leftrightharpoons3\boxminus2\Vdash3\Vvdash3\vDash3%
300 \twoheadrightarrow3\twoheadleftarrow3\leftleftarrows3\rightrightarrows3\upuparrows3%
301 \downdownarrows3\uprightharpoon3\downrightharpoon3\upleftharppon3\downleftharpoon3%
302 \rightarrowtail3\leftarrowtail3\leftrightarrows3\rightleftarrows3\Lsh3\Rsh3\rightsquigarrow3%
303 \leftrightsquigarrow3\looparrowleft3\looparrowright3\circeq3\succsim3\gtrsim3\gtrapprox3%
304 \multimap3\therefore2\because2\Doteq3\triangleq3\precsim3\lesssim3\lessapprox3%
305 }
306