summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/math-preload.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/optex/math-preload.opm')
-rw-r--r--macros/luatex/optex/math-preload.opm109
1 files changed, 87 insertions, 22 deletions
diff --git a/macros/luatex/optex/math-preload.opm b/macros/luatex/optex/math-preload.opm
index 5251f09424..b367a70d26 100644
--- a/macros/luatex/optex/math-preload.opm
+++ b/macros/luatex/optex/math-preload.opm
@@ -1,8 +1,13 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \normalmath {Math fonts CM + AMS preloaded <2020-02-25>} % preloaded in format
+\_codedecl \normalmath {Math fonts CM + AMS preloaded <2020-04-14>} % preloaded in format
-% Only few text fonts are preloaded:
+ \_doc ------------------------------
+ We have two math macros \`\normalmath` for normal shape of all math
+ symbols and \`\boldmath` for bold shape of all math symbos. The second one
+ can be used in bold titles, for example.
+ These macros load all fonts from all given math font families.
+ \_cod ------------------------------
\_def\_normalmath{%
\_loadmathfamily 0 cmr % CM Roman
@@ -36,11 +41,23 @@
}
\count18=11 % families declared by \newfam are 12, 13, ...
+\_def \normalmath {\_normalmath} \_def\boldmath {\_boldmath}
+
+ \_doc -----------------------------
+ The classical math family selectors
+ \`\mit`, \`\cal`, \`\bbchar`, \`\frak` and \`\script`
+ are defined here.
+ The \`\rm`, \`\bf`, \`\it`, \`\bi` and \`\tt` does two things:
+ they are variant selectors for text fonts and math family selectors for math fonts.
+ The idea was adapted from plain \TeX/.
+ \_cod -----------------------------
+
\_chardef\_bffam = 8
\_chardef\_bifam = 9
\_chardef\_ttfam = 10
\_chardef\_itfam = 11
+\_protected\_def \_rm {\_tryloadrm \_tenrm \_fam0 }
\_protected\_def \_bf {\_tryloadbf \_tenbf \_fam\_bffam}
\_protected\_def \_it {\_tryloadit \_tenit \_fam\_itfam}
\_protected\_def \_bi {\_tryloadbi \_tenbi \_fam\_bifam}
@@ -52,6 +69,13 @@
\_protected\_def \_frak {\_fam7 } % fraktur
\_protected\_def \_script {\_fam6 } % more extensive script than \cal
+\_public \rm \bf \it \bi \tt \mit \cal \bbchar \frak \script ;
+
+ \_doc -----------------------------
+ The optical sizes of Computer Modern fonts, AMS and other fonts
+ are declared here.
+ \_cod -----------------------------
+
%% CM math fonts, optical sizes:
\_regtfm cmmi 0 cmmi5 5.5 cmmi6 6.5 cmmi7 7.5 cmmi8 8.5 cmmi9 9.5
@@ -70,7 +94,6 @@
\_regtfm cmti 0 cmti7 7.5 cmti8 8.5 cmti9 9.5 cmti10 11.1 cmti12 *
\_regtfm cmtt 0 cmtt10 11.1 cmtt12 *
-
%% AMS math fonts, optical sizes:
\_regtfm msam 0 msam5 5.5 msam6 6.5 msam7 7.5 msam8 8.5 msam9 9.5 msam10 *
@@ -93,7 +116,26 @@
\_regtfm bbisans 0 ecso0500 5.5 ecso0600 6.5 ecso0700 7.5 ecso0800
8.5 ecso0900 9.5 ecso1000 11.1 ecso1200 *
-%% macros:
+ \_doc -----------------------------
+ \`\_loadmathfamily` `<number> <font>` loads one math family, i.\,e.\
+ the triple of fonts in the text size, script size and script-script size.
+ The `<font>` is `<font-id>` used in the `\_regtfm` parameter or
+ the real TFM name. The family is saved as `\fam<number>`.
+ \nl
+ \`\_setmathfamily` `<number> \<font-switch>` loads one math family
+ like `\_loadmathfamily` does it. But the second parameter is a
+ `\<font-switch>` declared previously by the `\font` primitive.
+ \nl
+ The font family is loaded at \`\_sizemtext`, \`\_sizemscript` and
+ \`\_sizemsscript` sizes. These sizes are set by the
+ \`\setmathsizes` `[<text-size>/<script-size>/<scriptscript-size>]` macro.
+ These parameters are given in the \`\ptmunit` unit, it is set to
+ 1\`\ptunit` and it is set to 1\,pt by defaut.
+ \nl
+ \`\_corrmsizes` should be used in the \^`\normalmath` and \^`\boldmath`
+ macros if you need a size correction when a selected math family is
+ loaded. It is similar as ex-height correction but for math fonts.
+ \_cod -----------------------------
\_def\_corrmsizes{\_ptmunit=1\_ptunit\_relax} % for corrections of sizes in diferent fomts
@@ -111,6 +153,22 @@
\_optsize=\_sizemsscript \_fontlet#2=#2 at\_optsize \_scriptscriptfont#1=#2%
\_optsize=\_optsizesave \_let#2=\_mF
}
+\_def\_setmathsizes[#1/#2/#3]{%
+ \_def\_sizemtext{#1\_ptmunit}\_def\_sizemscript{#2\_ptmunit}%
+ \_def\_sizemsscript{#3\_ptmunit}%
+}
+\_newdimen\_ptunit \_ptunit=1pt
+\_newdimen\_ptmunit \_ptmunit=1\_ptunit
+
+\_public \setmathsizes \ptunit \ptmunit ;
+
+ \_doc -----------------------------
+ The \`\_setmathdimens` macro is used in \^`\normalmath` or \^`\boldmath`
+ macros. It makes math dimensions dependent on the font size (plain \TeX/ sets
+ them only for 10\,pt typesetting). The `\skewchar` of some math families are
+ set here too.
+ \_cod -----------------------------
+
\_def\_setmathdimens{% PlainTeX sets these dimens for 10pt size only:
\_delimitershortfall=0.5\_fontdimen6\_textfont3
\_nulldelimiterspace=0.12\_fontdimen6\_textfont3
@@ -119,35 +177,42 @@
\_skewchar\_scriptscriptfont1=127
\_skewchar\_textfont2=48 \_skewchar\_scriptfont2=48
\_skewchar\_scriptscriptfont2=48
+ \_skewchar\_textfont6=127 \_skewchar\_scriptfont6=127
+ \_skewchar\_scriptscriptfont6=127
}
-%% \setmathsizes:
-
-\_def\_setmathsizes[#1/#2/#3]{%
- \_def\_sizemtext{#1\_ptmunit}\_def\_sizemscript{#2\_ptmunit}%
- \_def\_sizemsscript{#3\_ptmunit}%
-}
-\_newdimen\_ptunit \_ptunit=1pt
-\_newdimen\_ptmunit \_ptmunit=1\_ptunit
+ \_doc -----------------------------
+ Finaly, we preload a math fonts colleciton in [10/7/5] sizes
+ when the format is generated. This is done when
+ `\_suppressfontnotfounderror=1` because we need not errors when format is
+ generated. Maybe there are not all fonts in the \TeX/ distribution
+ installed.
+ \_cod -----------------------------
\_suppressfontnotfounderror=1
\_setmathsizes[10/7/5]\_normalmath
\_suppressfontnotfounderror=0
-\_public
- \setmathsizes \bf \it \bi \tt \mit \cal \bbchar \frak \script \ptunit ;
-
-\_def \normalmath {\_normalmath} \_def\boldmath {\_boldmath}
\_endcode %---------------------------------------------------
The Computer Modern and AMS fonts are preloaded here in classical math-fam
-concept, where each math family includes three fonts with max 256 characters.
+concept, where each math family includes three fonts with max 256 characters
+(typically 128 characters).
+
+On the other hand, when \^`\fontfam` macro is used in the document then text
+font family and appropriate math family is loaded with Unicoded fonts, i.e.
+Unicoded-math is used. It re-defines all settings given here.
-On the other hand, when `\fontfam` macro is used in the document then text
-font family and appropriate math family is loaded with unicoded fonts, i.e.
-unicoded math is used.
+The general rule of usage the math fonts in different sizes in \OpTeX/ says: set three
+sizes by the macro
+\^`\setmathsizes` `[<text-size>/<script-size>/<scriptscript-size>]` and then
+load all math fonts in given sizes by \^`\normalmath` or \^`\boldmath` macros.
+For example
+\begtt
+\setmathsizes[12/8.4/6]\normalmath ... math typesetting at 12 pt is ready.
+\endtt
-The code here is inspired by `ams-math.tex file`.
+\_endinput
- \ No newline at end of file
+2020-04-14: \skewchar\fam6 added