font.tex (11751B)
1 % Default font size parameters. Layouts can define more if they wish (e.g., 2 % for titles, headers, etc.). 3 \newdimen\Fhsize % default (horizontal mode) 4 \newdimen\Ftsize % display and text 5 \newdimen\Fssize % script 6 \newdimen\Fzsize % script script 7 8 \newdimen\Ftarget % Target size when searching font sets 9 \newcount\Fscale % Used by Foptical; scales by this value divided by 1000 10 11 \newdimen\Fbight 12 \newdimen\FBight 13 \newdimen\Fbigght 14 \newdimen\FBigght 15 16 \mathchardef\Fbigchar="0300 17 \mathchardef\FBigchar="0310 18 \mathchardef\Fbiggchar="0312 19 \mathchardef\FBiggchar="0320 20 21 \defevent[Fresize] 22 \def\Fresize{\event[Fresize]} 23 24 \def\FSnull{\let\Ffont=\nullfont} 25 26 % Foptical is for use inside font sets 27 % Usage: \Foptical[name_for_caching]{% 28 % \\5:font_used_when_Ftarget_is_at_most_5 %<- Need space after each line 29 % \\6:font_used_when_Ftarget_is_greater_than_5_and_at_most_6 30 % \\7:font_used_when_Ftarget_is_greater_than_7_and_at_most_7 31 % % Etc.. 32 % \\*:font_used_when_Ftarget_is_greater_than_all_previous % optional 33 % } 34 \def\Foptical[#1]#2{% 35 \ifcs#1@\the\Ftarget\endcs \else 36 \beggroup 37 \Fscale=1000 38 \let\Ffont=\nullfont 39 \let\\=\@Fopticalsearch #2% 40 \gcslet{#1@\the\Ftarget}\Ffont 41 \endgroup 42 \fi 43 \letcs\Ffont{#1@\the\Ftarget}% 44 } 45 \def\@Fopticalsearch#1:#2 {% 46 \if*#1% 47 \dimenA=\maxdimen 48 \else 49 \dimenA=\dimexpr#1pt\relax 50 \fi 51 \ifdim\dimenA<\Ftarget \else 52 \font\Ffont={#2}at\dimexpr\Ftarget*\Fscale/1000\relax 53 \let\\=\@Fopticalgobble 54 \fi 55 } 56 \def\@Fopticalgobble#1:#2 {} 57 58 % Usage: \Fdef\myfont\FSmyfontset3.14pt 59 \def\Fdef#1#2{\def\csA{#2\let#1=\Ffont}\afterassignment\csA\Ftarget=} 60 61 \addhook[Fresize]{% 62 \lineht=.7\normalbaselineskip 63 \linedp=.3\normalbaselineskip 64 } 65 66 \def\Fsetfam{\afterassignment\@Fsetfam\countA=} 67 \def\@Fsetfam#1#2#3{% 68 \gcsdef{FMt:\number\countA}{#1}% 69 \gcsdef{FMs:\number\countA}{#2}% 70 \gcsdef{FMz:\number\countA}{#3}% 71 } 72 73 % Initialize all 256 math families. 74 % Need braces here to prevent expansion. 75 \fornum\i="00.."FF+1\do{\Fsetfam\i{\FSnull}\FSnull\FSnull} 76 77 \Fsetfam"00 \FSpnrutl\FSpnrutl\FSpnrutl 78 \Fsetfam"01 \FSeurm\FSeurm\FSeurm 79 \Fsetfam"02 \FSmpalsy\FSmpalsy\FSmpalsy 80 \Fsetfam"03 \FSmpalexx\FSmpalexx\FSmpalexx 81 \Fsetfam"04 \FSeuex\FSeuex\FSeuex 82 \Fsetfam"05 \FSeurb\FSeurb\FSeurb 83 \Fsetfam"06 \FSeusm\FSeusm\FSeusm 84 \Fsetfam"07 \FSeusb\FSeusb\FSeusb 85 \Fsetfam"08 \FSeufm\FSeufm\FSeufm 86 \Fsetfam"09 \FSeufb\FSeufb\FSeufb 87 \Fsetfam"0A \FSpmds\FSpmds\FSpmds 88 % "0B 89 % "0C 90 % "0D 91 \Fsetfam"0E \FSmpalmia\FSmpalmia\FSmpalmia 92 \Fsetfam"0F \FSmpalsym\FSmpalsym\FSmpalsym 93 \Fsetfam"10 \FSmpalmi\FSmpalmi\FSmpalmi 94 \Fsetfam"11 \FSmpalexa\FSmpalexa\FSmpalexa 95 \Fsetfam"12 \FSmpalsyc\FSmpalsyc\FSmpalsyc 96 \Fsetfam"13 \FSincr\FSincr\FSincr 97 \Fsetfam"14 \FSincb\FSincb\FSincb 98 % "15 99 % "16 100 % "17 101 % "18 102 \Fsetfam"19 \FSrrrmpalwidecheck\FSrrrmpalwidecheck\FSrrrmpalwidecheck 103 \Fsetfam"1A \FSpalr\FSpalr\FSpalr 104 % "1B 105 % "1C 106 107 \addhook[Fresize]{% 108 \fornum\i="00.."FF+1\do{% 109 \Ftarget=\Ftsize \cs{FMt:\number\i}\textfont\i=\Ffont 110 \Ftarget=\Fssize \cs{FMs:\number\i}\scriptfont\i=\Ffont 111 \Ftarget=\Fzsize \cs{FMz:\number\i}\scriptscriptfont\i=\Ffont 112 }% 113 } 114 115 \def\Fupdatedelim#1#2{% 116 \setbox\boxA=\vbox{\hbox{$\nosurround#2$}\kern0pt}% 117 #1=\dimexpr\ht\boxA/2 + \fontdimen22 \textfont2\relax 118 } 119 120 \addhook[Fresize]{% 121 \Fupdatedelim\Fbight\Fbigchar 122 \Fupdatedelim\FBight\FBigchar 123 \Fupdatedelim\Fbigght\Fbiggchar 124 \Fupdatedelim\FBigght\FBiggchar 125 } 126 127 \def\ffamdef[#1]{\ea\chardef\begcs ffam:#1\endcs=} 128 \def\ffam[#1]{\numexpr\ifcs ffam:#1\endcs \cs{ffam:#1}\else -1\fi\relax} 129 \def\ffontdef[#1]{\ea\Fdef\begcs ffont:#1\endcs} 130 \def\ffont[#1]{\ifcs ffont:#1\endcs\cs{ffont:#1}\fi} 131 \def\f[#1]{\fam=\ffam[#1]\ffont[#1]} 132 133 \countB="80 134 \foreach /n s/s \do#1/#2 { 135 \foreach l/l r/r m/m b/b \do##1/##2 { 136 \foreach /u i/i \do####1/####2 { 137 \foreach /tl o/to p/pl po/po s/st sp/sp \do########1/########2 { 138 \ea\Fsetfam\ea\countB 139 \begcs FSp#2##2####2########2\ea\endcs 140 \begcs FSp#2##2####2########2\ea\endcs 141 \begcs FSp#2##2####2########2\endcs 142 \ffamdef[#1##1####1########1]\countB 143 \incr\countB 144 } 145 } 146 } 147 } 148 149 \ffamdef[r]"00 150 \ffamdef[b]"05 151 \ffamdef[hr]"06 152 \ffamdef[hb]"07 153 \ffamdef[fr]"08 154 \ffamdef[fb]"09 155 \ffamdef[d]"0A 156 \ffamdef[t]"13 157 \ffamdef[tb]"14 158 159 % Math operators 160 % XXX: is this a hack? 161 \csdef{ffam:o}{\ffam[sr]} 162 \csdef{ffont:o}{\ffont[sr]} 163 164 \addhook[Fresize]{% 165 % Palatino Nova and Nova Sans 166 \foreach /n s/s \do##1/##2 {% 167 \foreach l/l r/r m/m b/b \do####1/####2 {% 168 \foreach /u i/i \do########1/########2 {% 169 \foreach /tl o/to p/pl po/po s/st sp/sp \do################1/################2 {% 170 \def\csA{\ffontdef[##1####1########1################1]}% 171 \ea\csA\begcs FSp##2####2########2################2\endcs\Fhsize 172 }% 173 }% 174 }% 175 }% 176 % Typewriter 177 \ffontdef[t]\FSincr\Fhsize 178 \ffontdef[tb]\FSincb\Fhsize 179 } 180 181 \def\tenpt{% 182 % Looser baselines and tighter display skips 183 \Fhsize=10pt \Ftsize=10pt \Fssize=7pt \Fzsize=5pt 184 \normalbaselineskip=12.5pt 185 \abovedisplayskip=8pt plus3pt minus5pt 186 \belowdisplayskip=8pt plus3pt minus5pt 187 \abovedisplayshortskip=0pt plus3pt 188 \belowdisplayshortskip=5pt plus3pt minus2pt 189 \Fresize 190 } 191 192 \def\ninept{% 193 \Fhsize=9pt \Ftsize=9pt \Fssize=6pt \Fzsize=5pt 194 \normalbaselineskip=11pt 195 \abovedisplayskip=7pt plus3pt minus5pt 196 \belowdisplayskip=7pt plus3pt minus5pt 197 \abovedisplayshortskip=0pt plus3pt 198 \belowdisplayshortskip=4pt plus3pt minus1pt 199 \Fresize 200 } 201 202 \def\rm{\errmessage{Hard-coded rm! Fix me!}} 203 204 \beggroup 205 \catcode`\_=11 206 207 \foreach 208 n/nova 209 s/sans 210 \do#1/#2 {% 211 \foreach 212 lu/light 213 li/light_italic 214 ru/regular 215 ri/regular_italic 216 mu/medium 217 mi/medium_italic 218 bu/bold 219 bi/bold_italic 220 \do##1/##2 { 221 \gcsdef{FSp#1##1tl}{\Foptical[p#1##1tl]{\\*:r3-palatino_#2-##2-tlf }} 222 \gcsdef{FSp#1##1to}{\Foptical[p#1##1to]{\\*:r3-palatino_#2-##2-tof }} 223 \gcsdef{FSp#1##1pl}{\Foptical[p#1##1pl]{\\*:r3-palatino_#2-##2-plf }} 224 \gcsdef{FSp#1##1po}{\Foptical[p#1##1po]{\\*:r3-palatino_#2-##2-pof }} 225 \gcsdef{FSp#1##1st}{\Foptical[p#1##1st]{\\*:r3-palatino_#2-##2-sc-tf }} 226 \gcsdef{FSp#1##1sp}{\Foptical[p#1##1sp]{\\*:r3-palatino_#2-##2-sc-pf }} 227 } 228 } 229 230 \gdef\FSpntit{\Foptical[pntit]{\\*:r3-palatino_nova-titling }} 231 \gdef\FSpntits{\Foptical[pntits]{\\*:r3-palatino_nova-titling-sc }} 232 233 \gdef\FSpnimp{\Foptical[pnimp]{\\*:r3-palatino_nova-imperial }} 234 \gdef\FSpnimps{\Foptical[pnimps]{\\*:r3-palatino_nova-imperial-sc }} 235 236 \gdef\FSpmds{\Foptical[pmds]{\\*:r3-palatino_math-ds }} 237 238 \gdef\FSpalr{\Foptical[palr]{\\*:zpl-Regular-tlf-t1 }} 239 240 \gdef\FSmpalmi {\Foptical[mpali]{\defaultskewchar127 \\*:zplmi }} 241 \gdef\FSmpalmia{\Foptical[mpalia]{\defaultskewchar127 \\*:zplmia }} 242 \gdef\FSmpalsy {\Foptical[mpalsy]{\defaultskewchar120 \\*:zplsy }} 243 \gdef\FSmpalsym{\Foptical[mpalsym]{\\*:zplsym }} 244 \gdef\FSmpalsyc{\Foptical[mpalsyc]{\\*:zplsyc }} 245 \gdef\FSmpalexx{\Foptical[mpalexx]{\\*:zplexx }} 246 \gdef\FSmpalexa{\Foptical[mpalexa]{\\*:zplexa }} 247 248 \gdef\FSmpalbmi {\Foptical[mpalbi]{\defaultskewchar127 \\*:zplbmi }} 249 \gdef\FSmpalbmia{\Foptical[mpalbia]{\defaultskewchar127 \\*:zplbmia }} 250 \gdef\FSmpalbsy {\Foptical[mpalbsy]{\defaultskewchar120 \\*:zplbsy }} 251 \gdef\FSmpalbsym{\Foptical[mpalbsym]{\\*:zplbsym }} 252 \gdef\FSmpalbsyc{\Foptical[mpalbsyc]{\\*:zplbsyc }} 253 \gdef\FSmpalbexx{\Foptical[mpalbexx]{\\*:zplbexx }} 254 \gdef\FSmpalbexa{\Foptical[mpalbexa]{\\*:zplbexa }} 255 256 \gdef\FSrrrmpalwidecheck{\Foptical[r3mpalwidecheck]{\\*:r3-widecheck }} 257 258 % Inconsolata (not narrow and without variant 0, l, but with straight quotes) 259 \gdef\FSincr{\Foptical[incr]{\Fscale1100 \\*:t1-zi4r-4 }} 260 \gdef\FSincb{\Foptical[incb]{\Fscale1100 \\*:t1-zi4b-4 }} 261 262 \gdef\FSeurm{\Foptical[eurm]{\defaultskewchar'177 \\6:eurm5 \\8.5:eurm7 \\*:eurm10 }} 263 \gdef\FSeurb{\Foptical[eurb]{\defaultskewchar'177 \\6:eurb5 \\8.5:eurb7 \\*:eurb10 }} 264 \gdef\FSeusm{\Foptical[eusm]{\defaultskewchar'60 \\6:eusm5 \\8.5:eusm7 \\*:eusm10 }} 265 \gdef\FSeusb{\Foptical[eusb]{\defaultskewchar'60 \\6:eusb5 \\8.5:eusb7 \\*:eusb10 }} 266 \gdef\FSeufm{\Foptical[eufm]{\\6:eufm5 \\8.5:eufm7 \\*:eufm10 }} 267 \gdef\FSeufb{\Foptical[eufb]{\\6:eufb5 \\8.5:eufb7 \\*:eufb10 }} 268 \gdef\FSeuex{\Foptical[euex]{\\7.5:euex7 \\8.5:euex8 \\9.5:euex9 \\*:euex10 }} 269 270 \endgroup 271 272 273 274 275 % Encoding stuff necessary for euler (see gkpmac.tex) 276 % Actually, we take most non-letter symbols from newpx instead. This keeps 277 % things consistent (since euler is somewhat incomplete) and easy (since 278 % we needn't change many of the conventions from plain). 279 280 % Take numerals from euler rm (default is fam 0) 281 \mathcode`\0="7130 282 \mathcode`\1="7131 283 \mathcode`\2="7132 284 \mathcode`\3="7133 285 \mathcode`\4="7134 286 \mathcode`\5="7135 287 \mathcode`\6="7136 288 \mathcode`\7="7137 289 \mathcode`\8="7138 290 \mathcode`\9="7139 291 292 % Take certain symbols from euler sm/fm (default is cmsy) 293 % \mathcode`\!="0821 294 % \mathcode`\(="4828 \delcode`(="828300 295 % \mathcode`\)="5829 \delcode`)="829301 296 % \mathcode`\+="282B 297 % \mathcode`\-="282D 298 % \mathcode`\:="383A 299 % \mathcode`\;="683B 300 % \mathcode`\=="383D 301 % \mathcode`\?="583F 302 % \mathcode`\[="485B \delcode`[="85B302 303 % \mathcode`\]="585D \delcode`]="85D303 304 % \mathcode`\{="4666 305 % \mathcode`\}="5667 306 307 % Euler doesn't have these 308 \let\varsigma=\sigma 309 \let\varrho=\rho 310 311 % Take uppercase Greek from euler rm (default is fam 0) 312 \mathchardef\Alpha="0141 313 \mathchardef\Beta="0142 314 \mathchardef\Gamma="0100 315 \mathchardef\Delta="0101 316 \mathchardef\Epsilon="0145 317 \mathchardef\Zeta="015A 318 \mathchardef\Eta="0148 319 \mathchardef\Theta="0102 320 \mathchardef\Iota="0149 321 \mathchardef\Kappa="014B 322 \mathchardef\Lambda="0103 323 \mathchardef\Mu="014D 324 \mathchardef\Nu="014E 325 \mathchardef\Xi="0104 326 \mathchardef\Omicron="014F 327 \mathchardef\Pi="0105 328 \mathchardef\Rho="0150 329 \mathchardef\Sigma="0106 330 \mathchardef\Tau="0154 331 \mathchardef\Upsilon="0107 332 \mathchardef\Phi="0108 333 \mathchardef\Chi="0158 334 \mathchardef\Psi="0109 335 \mathchardef\Omega="010A 336 337 % TODO: arrows? 338 \mathchardef\intop="1452 339 \mathchardef\ointop="1448 340 % \mathchardef\coprod="1460 341 % \mathchardef\prod="1451 342 \mathchardef\sum="1450 343 % \mathchardef\braceld="047A \mathchardef\bracerd="047B 344 % \mathchardef\bracelu="047C \mathchardef\braceru="047D 345 % \mathchardef\infty="0431 346 % \def\rbrace{\delimiter"5667409 } 347 % \def\lbrace{\delimiter"4666408 } 348 % \def\vert{\delimiter"066A30C } 349 % \def\backslash{\delimiter"066E30F } 350 351 \mathcode`\(="42B9 352 \mathcode`\)="52BA 353 \mathcode`\[="42BB 354 \mathcode`\]="52BC 355 \mathcode`\,="602C 356 \mathcode`\.="002E 357 \Umathcode`\/="0"10"3D 358 \Umathcode`\<="3"10"3C 359 \Umathcode`\>="3"10"3E 360 \Umathcode`\=="3"1A"3D 361 \Umathcode`\+="2"1A"2B 362 \Umathchardef\star="2"10"3F 363 \Umathchardef\ldotp="6"10"3A 364 \mathchardef\nmid="3F2D 365 \mathchardef\notto="3F39 366 % \mathchardef\emptyset="029B 367 \def\emptyset{{\mathpalette\@emptyset{}}} 368 \def\@emptyset#1#2{\hbox{% 369 \Fdef\csA\FSmpalsy\dimexpr\Ftsize+1.5pt\relax \textfont2=\csA 370 \Fdef\csA\FSmpalsy\dimexpr\Fssize+1.5pt\relax \scriptfont2=\csA 371 \Fdef\csA\FSmpalsy\dimexpr\Fzsize+1pt\relax \scriptscriptfont2=\csA 372 $\nosurround\sty#1\mathchar"029B$% 373 }} 374 \mathchardef\neq="3E3C 375 \Umathchardef\notin="3"12"3C 376 \Umathchardef\notsimeq="3"12"3B 377 \def\Relbar{\mathrel{\mathchar"3E35}} 378 \def\divides{\mid} 379 \Umathchardef\ldbrack="4"12"7E 380 \Umathchardef\rdbrack="5"12"7F 381 \mathchardef\models="3F8F 382 \mathchardef\notmodels="3F32 383 \mathchardef\forces="3F8D 384 \mathchardef\notforces="3F31 385 \mathchardef\notprec="3F06 386 \mathchardef\notpreceq="3F0E 387 \mathchardef\notsucc="3F07 388 \mathchardef\notsucceq="3F0F 389 \mathchardef\notsubseteq="3F2A 390 \mathchardef\notsupseteq="3F2B 391 \mathchardef\surjto="3F90 392 \mathchardef\symdiff="2234 393 \mathchardef\Re="0852 394 \mathchardef\Im="0849 395 \Umathchardef\notsim="3"12"2F 396 \mathchardef\transpose="0FFC 397 \mathchardef\notleq="3F02 398 \mathchardef\notgeq="3F03 399 \mathchardef\notl="3F04 400 \mathchardef\notg="3F05 401 \def\grave{\mathaccent"029E } 402 \def\acute{\mathaccent"029F } 403 \def\hat{\mathaccent"02A0 } 404 \def\tilde{\mathaccent"02A1 } 405 \def\dot{\mathaccent"02A4 } 406 \def\ddot{\mathaccent"02A5 } 407 \def\ring{\mathaccent"02A6 } 408 \def\check{\mathaccent"02A7 } 409 410 411 \endinput