summaryrefslogtreecommitdiff
path: root/tex/context/fonts/mkiv/ebgaramond-math.lfg
blob: bf9a2e02741f3b0edcff29c28cd41d7ee058ed09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
local common  = fonts.goodies.load("common-math.lfg")
local presets = common.mathematics.tweaks.presets

return {
    name = "ebgaramond",
    version = "1.00",
    comment = "Goodies that complement ebgaramond.",
    author = "Hans Hagen & Mikael Sundqvist",
    copyright = "ConTeXt development team",
    mathematics = {
        parameters = {
            FractionRuleThickness             =  60,
            OverbarRuleThickness              =  60,
            UnderbarRuleThickness             =  60,
            AccentTopShiftUp                  = -25, -- was 075
            FlattenedAccentTopShiftUp         = -25, -- was 075
            AccentBaseDepth                   =  75,
            DelimiterPercent                  =  90,
            DelimiterShortfall                = 400,
            SubscriptShiftDown                = 200, -- 250 in font
            SuperscriptShiftUp                = 400, -- 430 in font
            SubscriptShiftDownWithSuperscript = "1.25*SubscriptShiftDown", -- trial and error
            SubSuperscriptGapMin              = 200, -- 250 in font
            PrimeShiftUp                      = "1.2*SuperscriptShiftUp",
            PrimeShiftUpCramped               = "1.2*SuperscriptShiftUp",
            PrimeBaselineDropMax              = "0.5*SuperscriptBaselineDropMax",
        },
        tweaks = {
            aftercopying = {
                {
                    tweak    = "version",
                    expected = "Version 2019-08-16",
                },
                {
                    tweak   = "fixprimes",
                    factor  = 0.73,
                },
                {
                    tweak = "addmirrors",
                },
                presets.scripttocalligraphic { },
                presets.rsfstoscript         { rscale = 0.95  },
                presets.rsfsuprighttoscript  { rscale = 0.95  },
                presets.moderntocalligraphic { rscale = 0.95  },
                presets.eulertocalligraphic  { rscale = 0.95  },
                presets.xitsarabic           { rscale = 0.80  },
                presets.fallbacks            { },
                presets.moveitalics          { correct = true },
                presets.moveitalics          { correct = true, letters = true },
                presets.moveintegrals        { factor  = 1.5  },
                presets.wipeitalics          { },
                {
                    tweak = "simplifykerns",
                },
                {
                    tweak = "topanchors",
                    list  = {
                        [0x1D453] = 0.88, -- italic f
                    },
                },
                {
                    tweak = "dimensions",
                    list  = {
                        [0x1D453] = {  width = 1.1 }, -- italic f
                    },
                },
                {
                    tweak = "kerns",
                    list  = {
                        [0x002F]                = { topleft  = -0.2,  bottomright = -0.2  },
                        ["0x7D.parts.top"]      = { topright = -0.15,                     }, -- right brace top
                        ["0x7D.parts.bottom"]   = {                   bottomright = -0.15 }, -- right brace bottom
                        ["0x7D.variants.*"]     = { topright = -0.05, bottomright = -0.05 }, -- right brace variants
                        ["0x29.parts.top"]      = { topright = -0.25,                     }, -- right parenthesis top
                        ["0x29.parts.bottom"]   = {                   bottomright = -0.25 }, -- right parenthesis bottom
                        ["0x29.variants.*"]     = { topright = -0.2,  bottomright = -0.2  }, -- right parenthesis variants
                        ["0x221A.parts.top"]    = { topright =  0.2,                      }, -- right radical top
                        ["0x221A.parts.bottom"] = {                   bottomright =  0.2  }, -- right radical bottom
                        ["0x221A.variants.*"]   = { topright =  0.2,  bottomright =  0.2  }, -- right radical variants                        -- angle
                        [0x27E9]                = { topright = -0.1,  bottomright = -0.1  },
                        ["0x27E9.variants.*"]   = { topright = -0.2,  bottomright = -0.2  },
                        [0x27EB]                = { topright = -0.1,  bottomright = -0.1  },
                        ["0x27EB.variants.*"]   = { topright = -0.2,  bottomright = -0.2  },

                        [0x00051]               = { bottomright = 0.25 }, -- Upright Q
                        [0x0211A]               = { bottomright = 0.2  }, -- Blackboard bold Q
                        [0x1D410]               = { bottomright = 0.2  }, -- Bold Q
                        [0x1D478]               = { bottomright = 0.05 }, -- Bold Q
                        [0x1D5B0]               = { bottomright = 0.05 }, -- Sans Q
                    },
                },
                {
                    -- to be considered
                    -- tweak = "kernpairs",
                    list = {
                        [mathematics.tweaks.subsets.gjqy] = {
                            [mathematics.tweaks.subsets.f] = -.1,
                            [0x1D70C]                      = -.1, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.bhklt] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.d] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.f] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                            [mathematics.tweaks.subsets.gjqy]  = -.25,
                            [mathematics.tweaks.subsets.bhklt] = -.1,
                            [mathematics.tweaks.subsets.d] = -.25,
                            [mathematics.tweaks.subsets.i] = -.25,
                            [mathematics.tweaks.subsets.mw] = -.25,
                            [mathematics.tweaks.subsets.p] = -.25,
                            [mathematics.tweaks.subsets.acenorsuvxz] = -.25,
                            [mathematics.tweaks.subsets.dotless] = -.25,
                        },
                        [mathematics.tweaks.subsets.i] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.mw] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.p] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.acenorsuvxz] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                        [mathematics.tweaks.subsets.dotless] = {
                            [mathematics.tweaks.subsets.f] = -.25,
                            [0x1D70C]                      = -.25, -- italic \rho
                        },
                    },
                },
                -- Accents are a mess. We migrate the extensibles from the combiners to the base accent
                -- and then need to tweak the width (which is auto set because it was zero with a large
                -- accent anchor offset). First we copy and fix.
                {
                    tweak = "extendaccents",
                },
                {
                    tweak   = "radicaldegreeanchors",
                    list = {
                        ["0x221A.parts.bottom"] = { location = "left", hfactor  = .0, vfactor  = 1.0 },
                    }
                },
                -- First we set the dimensions of the initial accent which started out as zero but we want
                -- a proper width. None in ebgaramond.
                -- Then we deal with all offsets and heights in one go. So we treat the initial accent
                -- as well as the variants here. None in ebgaramond
                -- We now copy these to the not wide slots so that we can set these to stretch as well,
                -- if only because it is less confusing and more consistent.
                {
                    tweak = "copyaccents",
                },
                {
                    tweak = "checkspacing",
                },
                {
                    tweak = "addscripts",
                },
                {
                    tweak = "accentdimensions",
                },
                {
                    tweak = "addrules",
                },
                {
                    tweak    = "replacerules",
                    minus = {
                        leftoffset  = .075,
                        rightoffset = .075,
                    },
                    fraction = {
                        height  = .2,
                        yoffset = .8,
                    },
                    radical = {
                        height     = .2,
                        yoffset    = .8,
                        leftoffset = .075,
                        yscale     = .9775,
                    },
                    stacker = {
                        height  = .2,
                        yoffset = .8,
                    },
                },
                {
                    tweak   = "addbars",
                    advance = 0.6,
                },
                {
                    tweak = "addactuarian",
                },
                {
                    tweak = "addequals",
                },
                {
                    tweak = "addfourier",
                    variant = 2,
                },
                {
                    tweak = "addprimed",
                },
                -- this is the mkiv section
                {
                    tweak   = "emulatelmtx",
                    feature = "emulatelmtx",
                    comment = "this is for mkiv",
                },
                {
                    tweak = "diagnose",
                },
            },
        },
        alternates = {
            partial        = { feature = 'ss02', value = 1, comment = "Curved partial" },
            semibold       = { feature = 'ss04', value = 1, comment = "Semibold" },
            extrabold      = { feature = 'ss05', value = 1, comment = "Extrabold" },
            hbar           = { feature = 'ss06', value = 1, comment = "Horizontal bar for h-bar" },
            integral       = { feature = 'ss07', value = 1, comment = "A more slanted integral sign" },
            tilde          = { feature = 'ss09', value = 1, comment = "A tilde variant" },
            outbendingh    = { feature = 'ss10', value = 1, comment = "Out-bending h" },
            largeoperators = { feature = 'ss11', value = 1, comment = "Larger operators" },
        },
        bigslots = {
            1, 3, 5, 7
        },
    },
}