schola-math.lfg /size: 7693 b    last modification: 2025-02-21 11:03
1local common  = fonts.goodies.load("common-math.lfg")
2local presets = common.mathematics.tweaks.presets
3
4local integral_variants = {  bottomright = -0.20 }
5local integral_bottom   = {  bottomright = -0.20 }
6
7return {
8    name = "schola-math",
9    version = "1.00",
10    comment = "Goodies that complement schola.",
11    author = "Hans Hagen & Mikael Sundqvist",
12    copyright = "ConTeXt development team",
13    mathematics = {
14        parameters = {
15            AccentTopShiftUp          =  -15,
16            FlattenedAccentTopShiftUp =  -15,
17            AccentBaseDepth           =   30,
18            DelimiterPercent          =   90,
19            DelimiterShortfall        =  400,
20            DisplayOperatorMinHeight  = 1800, -- 1333 in font
21            PrimeShiftUp              = "1.35*SuperscriptShiftUp",
22            PrimeShiftUpCramped       = "1.35*SuperscriptShiftUp",
23            -- Can be improved: Smaller script and scriptscript, modified SuperShiftUp and SubShiftDown, ...
24        },
25        tweaks = {
26            aftercopying = {
27                {
28                    tweak    = "version",
29                    expected = "Version 1.533",
30                },
31                {
32                    tweak   = "fixprimes",
33                    factor  = 0.74,
34                },
35                {
36                    tweak = "addmirrors",
37                },
38                {
39                    tweak = "addcomposites",
40                },
41                presets.scripttocalligraphic { },
42                presets.rsfstoscript         { },
43                presets.rsfsuprighttoscript  { },
44                presets.moderntocalligraphic { },
45                presets.eulertocalligraphic  { },
46                presets.xitsarabic           { rscale  = 0.93 },
47                presets.fallbacks            { },
48                presets.moveitalics          { correct = true },
49                presets.moveitalics          { correct = true, letters = true },
50                presets.moveintegrals        { },
51                presets.wipeitalics          { },
52                {
53                    tweak = "checkaccents",
54                },
55                {
56                    tweak = "wipecues",
57                },
58                {
59                    tweak = "kerns",
60                    list  = {
61                        [0x002F]                = { topleft  = -0.2,  bottomright = -0.2  },
62                        ["0x7D.parts.top"]      = { topright = -0.15,                     }, -- right brace top
63                        ["0x7D.parts.bottom"]   = {                   bottomright = -0.15 }, -- right brace bottom
64                        ["0x7D.variants.*"]     = { topright = -0.15, bottomright = -0.15 }, -- right brace variants
65                        ["0x29.parts.top"]      = { topright = -0.25,                     }, -- right parenthesis top
66                        ["0x29.parts.bottom"]   = {                   bottomright = -0.25 }, -- right parenthesis bottom
67                        ["0x29.variants.*"]     = { topright = -0.2,  bottomright = -0.2  }, -- right parenthesis variants
68                        ["0x221A.parts.top"]    = { topright =  0.2,                      }, -- right radical top
69                        ["0x221A.parts.bottom"] = {                   bottomright =  0.2  }, -- right radical bottom
70                        ["0x221A.variants.*"]   = { topright =  0.2,  bottomright =  0.2  }, -- right radical variants
71                        [0x27E9]                = { topright = -0.1,  bottomright = -0.1  }, -- angle
72                        ["0x27E9.variants.*"]   = { topright = -0.2,  bottomright = -0.2  },
73                        [0x27EB]                = { topright = -0.1,  bottomright = -0.1  },
74                        ["0x27EB.variants.*"]   = { topright = -0.2,  bottomright = -0.2  },
75                        --
76                        ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int
77                        ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint
78                        ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint
79                        ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint
80                    },
81                },
82
83                -- Accents are a mess. We migrate the extensibles from the combiners to the base accent
84                -- and then need to tweak the width (which is auto set because it was zero with a large
85                -- accent anchor offset). First we copy and fix.
86                {
87                    tweak = "extendaccents",
88                },
89                {
90                    tweak = "radicaldegreeanchors",
91                    list  = {
92                        ["0x221A.parts.bottom"] = { location = "left", hfactor  = 0.05, vfactor  = 1.1 },
93                    }
94                },
95                {
96                    tweak = "flattenaccents",
97                },
98                {
99                    tweak = "fixaccents",
100                },
101                -- First we set the dimensions of the initial accent which started out as zero but we want
102                -- a proper width.
103                -- {
104                --     tweak = "dimensions",
105                --     list  = {
106                --         [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
107                --         [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
108                --         [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
109                --         [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
110                --     },
111                -- },
112                -- Then we deal with all offsets and heights in one go. So we treat the initial accent
113                -- as well as the variants here. Not in schola
114                -- We now copy these to the not wide slots so that we can set these to stretch as well,
115                -- if only because it is less confusing and more consistent.
116                {
117                    tweak = "copyaccents",
118                },
119                presets.addmathkerns { },
120                {
121                    tweak = "checkspacing",
122                },
123                {
124                    tweak = "addscripts",
125                },
126                {
127                    tweak = "accentdimensions",
128                },
129                {
130                    tweak = "addrules",
131                },
132                {
133                    tweak    = "replacerules",
134                    fraction = { height = .25, yoffset = .7625 },
135                    radical  = { height = .25, leftoffset = .1, rightoffset = .1, yoffset = .7625 },
136                    stacker  = { height = .25, yoffset = .7625 },
137                },
138                {
139                    tweak   = "addbars",
140                    advance = 0.27,
141                },
142                {
143                    tweak = "addactuarian",
144                },
145                {
146                    tweak = "addequals",
147                },
148                {
149                    tweak   = "addfourier",
150                    variant = 1,
151                },
152                {
153                    tweak = "addprimed",
154                },
155                -- this is the mkiv section
156                {
157                    tweak   = "emulatelmtx",
158                    feature = "emulatelmtx",
159                    comment = "this is for mkiv",
160                },
161            },
162        },
163        bigslots = {
164            1, 3, 5, 7
165        },
166        alternates = {
167            dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" },
168        },
169    },
170}
171