schola-math.lfg /size: 7534 b    last modification: 2023-12-21 09:44
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                presets.scripttocalligraphic { },
39                presets.rsfstoscript         { },
40                presets.rsfsuprighttoscript  { },
41                presets.moderntocalligraphic { },
42                presets.eulertocalligraphic  { },
43                presets.xitsarabic           { rscale  = 0.93 },
44                presets.fallbacks            { },
45                presets.moveitalics          { correct = true },
46                presets.moveitalics          { correct = true, letters = true },
47                presets.moveintegrals        { },
48                presets.wipeitalics          { },
49                {
50                    tweak = "checkaccents",
51                },
52                {
53                    tweak = "kerns",
54                    list  = {
55                        [0x002F]                = { topleft  = -0.2,  bottomright = -0.2  },
56                        ["0x7D.parts.top"]      = { topright = -0.15,                     }, -- right brace top
57                        ["0x7D.parts.bottom"]   = {                   bottomright = -0.15 }, -- right brace bottom
58                        ["0x7D.variants.*"]     = { topright = -0.15, bottomright = -0.15 }, -- right brace variants
59                        ["0x29.parts.top"]      = { topright = -0.25,                     }, -- right parenthesis top
60                        ["0x29.parts.bottom"]   = {                   bottomright = -0.25 }, -- right parenthesis bottom
61                        ["0x29.variants.*"]     = { topright = -0.2,  bottomright = -0.2  }, -- right parenthesis variants
62                        ["0x221A.parts.top"]    = { topright =  0.2,                      }, -- right radical top
63                        ["0x221A.parts.bottom"] = {                   bottomright =  0.2  }, -- right radical bottom
64                        ["0x221A.variants.*"]   = { topright =  0.2,  bottomright =  0.2  }, -- right radical variants
65                        [0x27E9]                = { topright = -0.1,  bottomright = -0.1  }, -- angle
66                        ["0x27E9.variants.*"]   = { topright = -0.2,  bottomright = -0.2  },
67                        [0x27EB]                = { topright = -0.1,  bottomright = -0.1  },
68                        ["0x27EB.variants.*"]   = { topright = -0.2,  bottomright = -0.2  },
69                        --
70                        ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int
71                        ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint
72                        ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint
73                        ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint
74                    },
75                },
76
77                -- Accents are a mess. We migrate the extensibles from the combiners to the base accent
78                -- and then need to tweak the width (which is auto set because it was zero with a large
79                -- accent anchor offset). First we copy and fix.
80                {
81                    tweak = "extendaccents",
82                },
83                {
84                    tweak = "radicaldegreeanchors",
85                    list  = {
86                        ["0x221A.parts.bottom"] = { location = "left", hfactor  = 0.05, vfactor  = 1.1 },
87                    }
88                },
89                {
90                    tweak = "flattenaccents",
91                },
92                {
93                    tweak = "fixaccents",
94                },
95                -- First we set the dimensions of the initial accent which started out as zero but we want
96                -- a proper width.
97                -- {
98                --     tweak = "dimensions",
99                --     list  = {
100                --         [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat
101                --         [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde
102                --         [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve
103                --         [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
104                --     },
105                -- },
106                -- Then we deal with all offsets and heights in one go. So we treat the initial accent
107                -- as well as the variants here. Not in schola
108                -- We now copy these to the not wide slots so that we can set these to stretch as well,
109                -- if only because it is less confusing and more consistent.
110                {
111                    tweak = "copyaccents",
112                },
113                presets.addmathkerns { },
114                {
115                    tweak = "checkspacing",
116                },
117                {
118                    tweak = "addscripts",
119                },
120                {
121                    tweak = "accentdimensions",
122                },
123                {
124                    tweak = "addrules",
125                },
126                {
127                    tweak    = "replacerules",
128                    fraction = { height = .25, yoffset = .7625 },
129                    radical  = { height = .25, leftoffset = .1, rightoffset = .1, yoffset = .7625 },
130                    stacker  = { height = .25, yoffset = .7625 },
131                },
132                {
133                    tweak   = "addbars",
134                    advance = 0.27,
135                },
136                {
137                    tweak = "addactuarian",
138                },
139                {
140                    tweak = "addequals",
141                },
142                {
143                    tweak   = "addfourier",
144                    variant = 1,
145                },
146                {
147                    tweak = "addprimed",
148                },
149                -- this is the mkiv section
150                {
151                    tweak   = "emulatelmtx",
152                    feature = "emulatelmtx",
153                    comment = "this is for mkiv",
154                },
155            },
156        },
157        bigslots = {
158            1, 3, 5, 7
159        },
160        alternates = {
161            dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" },
162        },
163    },
164}
165