pagella-math.lfg /size: 13 Kb    last modification: 2024-01-16 09:03
1local common  = fonts.goodies.load("common-math.lfg")
2local presets = common.mathematics.tweaks.presets
3
4local integral_variants = {  bottomright = -0.20 }
5----- integral_top      = {  topright    =  0.05 }
6local integral_bottom   = {  bottomright = -0.20 }
7
8return {
9    name = "pagella-math",
10    version = "1.00",
11    comment = "Goodies that complement pagella.",
12    author = "Hans Hagen & Mikael Sundqvist",
13    copyright = "ConTeXt development team",
14    mathematics = {
15        parameters = {
16            AccentTopShiftUp                  =   10,
17            FlattenedAccentTopShiftUp         =   10,
18            AccentBaseDepth                   =   80,
19            DelimiterPercent                  =   85,
20            DelimiterShortfall                =  400,
21            DelimiterDisplayPercent           =   90,
22            DelimiterDisplayShortfall         =  400,
23            DisplayOperatorMinHeight          = 1800, -- 1500 in font
24            SuperscriptShiftUp                =  386, -- 354 in font
25            SubscriptShiftDown                =  200, -- 232 in font
26            SubscriptShiftDownWithSuperscript = "1.4*SubscriptShiftDown", -- 1.5* in math-act
27            PrimeShiftUp                      = "1.3*SuperscriptShiftUp",
28            PrimeShiftUpCramped               = "1.3*SuperscriptShiftUp",
29        },
30        tweaks = {
31            aftercopying = {
32                {
33                    tweak    = "version",
34                    expected = "Version 1.632",
35                },
36                {
37                    tweak   = "fixprimes",
38                    factor  = 0.8,
39                },
40                {
41                    tweak    = "replacealphabets",
42                    feature  = "euleroverpagella",
43                    filename = "euler-math.otf",
44                    list     = {
45                        { source = "lowercasenormal",      target = "lowercaseitalic" },
46                        { source = "lowercasebold",        target = "lowercasebolditalic" },
47                        { source = "lowercasegreeknormal", target = "lowercasegreekitalic" },
48                        { source = "lowercasegreekbold",   target = "lowercasegreekbolditalic" },
49                        { source = "uppercasenormal",      target = "uppercaseitalic" },
50                        { source = "uppercasebold",        target = "uppercasebolditalic" },
51                        { source = "uppercasegreeknormal", target = "uppercasegreekitalic" },
52                        { source = "uppercasegreekbold",   target = "uppercasegreekbolditalic" },
53                        { source = "lowercasenormal",      target = "lowercasenormal" },
54                        { source = "lowercasebold",        target = "lowercasebold" },
55                        { source = "lowercasegreeknormal", target = "lowercasegreeknormal" },
56                        { source = "lowercasegreekbold",   target = "lowercasegreekbold" },
57                        { source = "uppercasenormal",      target = "uppercasenormal" },
58                        { source = "uppercasebold",        target = "uppercasebold" },
59                        { source = "uppercasegreeknormal", target = "uppercasegreeknormal" },
60                        { source = "uppercasegreekbold",   target = "uppercasegreekbold" },
61                        { source = "digitsnormal",         target = "digitsnormal" },
62                        --
63                        -- either
64                        --
65                     -- { source = { first = 0x0007B, last = 0x0007D } }, -- { }
66                     -- { source = { first = 0x0005B, last = 0x0005D } }, -- [ ]
67                     -- { source = { first = 0x00028, last = 0x00029 } }, -- ( )
68                     -- { source = { first = 0x02100, last = 0x02BFF } }, -- symbols -- has snippets of {} () []
69                        --
70                        -- or (probably even more)
71                        --
72                        { source = { first = 0x02100, last = 0x0239A } }, -- symbols -- has snippets of {} () []
73                        { source = { first = 0x023B5, last = 0x02BFF } }, -- symbols -- has snippets of {} () []
74                        --
75                        { source = { first = 0x1D400, last = 0x1D7FF } }, -- various alphabets
76                    },
77                },
78                {
79                    tweak = "addmirrors",
80                },
81                {
82                    tweak   = "fixoldschool",
83                    feature = "euleroverpagella",
84                },
85                {
86                    tweak   = "replacealphabets",
87                    list    = {
88                        {
89                            source   = { first = 0x02980 }, -- triplebar
90                            filename = "TeXGyrePagellaMath-Companion.otf",
91                        },
92                    },
93                },
94                presets.scripttocalligraphic { },
95                presets.rsfstoscript         { },
96                presets.rsfsuprighttoscript  { },
97                presets.moderntocalligraphic { },
98                presets.eulertocalligraphic  { },
99                presets.xitsarabic           { rscale  = 0.95 },
100                presets.fallbacks            { },
101                presets.moveitalics          { correct = true },
102                presets.moveitalics          { correct = true, letters = true },
103                presets.moveintegrals        { factor  = 1.5  }, -- we need to check the 1.5
104                presets.wipeanchors          { },
105                presets.wipeitalics          { },
106                {
107                    tweak = "checkaccents",
108                },
109                {
110                    tweak   = "parameters",
111                    feature = "euleroverpagella",
112                    list    = {
113                        RadicalRuleThickness = 54,
114                    }
115                },
116                {
117                    tweak = "setovershoots",
118                    list  = {
119                        {
120                            target       = "uppercasescript",
121                         -- quad         = true, -- to be decided
122                            topovershoot = 0.05,
123                        },
124                        {
125                            target       = "uppercaseboldscript",
126                         -- quad         = true, -- to be decided
127                            topovershoot = 0.05,
128                        },
129                    },
130                },
131                -- Accents are a mess. We migrate the extensibles from the combiners to the base accent
132                -- and then need to tweak the width (which is auto set because it was zero with a large
133                -- accent anchor offset). First we copy and fix.
134                {
135                    tweak = "extendaccents",
136                },
137                {
138                    tweak = "flattenaccents",
139                },
140                {
141                    tweak = "fixaccents",
142                },
143                -- First we set the dimensions of the initial accent which started out as zero but we want
144                -- a proper width.
145--                 {
146--                     tweak = "dimensions",
147--                     list  = {
148--                         [0x00300] = { width = 0.9 }, -- widegrave
149--                         [0x00301] = { width = 0.9 }, -- wideacute
150--                         [0x00302] = { width = 1.4, anchor = 1.20, xoffset =  .10 }, -- widehat
151--                         [0x00303] = { width = 1.4, anchor = 1.20, xoffset =  .10 }, -- widetilde
152--                         [0x00306] = { width = 1.4, anchor = 1.20, xoffset =  .10 }, -- widebreve
153--                         [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering -- weird this one
154--                         [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck
155--                     },
156--                 },
157                -- Then we deal with all offsets and heights in one go. So we treat the initial accent
158                -- as well as the variants here.
159                {
160                    tweak = "dimensions",
161                    list  = {
162                     -- here we want to apply to all
163                        [0x020DB] = { yoffset = -0.01, height = .95, all = true }, -- widedddot : 0x20DB (self)
164                    },
165                },
166                -- We now copy these to the not wide slots so that we can set these to stretch as well,
167                -- if only because it is less confusing and more consistent.
168                {
169                    tweak = "copyaccents",
170                },
171                -- So far for the accents.
172                {
173                    tweak = "radicaldegreeanchors",
174                    list  = {
175                        ["0x221A.parts.bottom"] = { location = "left", hfactor  = 0.0, vfactor  = 1.1 },
176                    }
177                },
178                {
179                    tweak = "fixslashes",
180                },
181                {
182                    tweak = "kerns",
183                    list  = {
184                        [0x002F]                = { topleft  = -0.2,  bottomright = -0.2  },
185                        --
186                        ["0x7D.parts.top"]      = { topright = -0.15,                     }, -- right brace top
187                        ["0x7D.parts.bottom"]   = {                   bottomright = -0.15 }, -- right brace bottom
188                        ["0x7D.variants.*"]     = { topright = -0.15, bottomright = -0.15 }, -- right brace variants
189                        ["0x29.parts.top"]      = { topright = -0.25,                     }, -- right parenthesis top
190                        ["0x29.parts.bottom"]   = {                   bottomright = -0.25 }, -- right parenthesis bottom
191                        ["0x29.variants.*"]     = { topright = -0.2,  bottomright = -0.2  }, -- right parenthesis variants
192                        ["0x221A.parts.top"]    = { topright =  0.2,                      }, -- right radical top
193                        ["0x221A.parts.bottom"] = {                   bottomright =  0.2  }, -- right radical bottom
194                        ["0x221A.variants.*"]   = { topright =  0.2,  bottomright =  0.2  }, -- right radical variants
195                        -- angle
196                        [0x27E9]                = { topright = -0.2,  bottomright = -0.2  },
197                        ["0x27E9.variants.*"]   = { topright = -0.3,  bottomright = -0.3  },
198                        [0x27EB]                = { topright = -0.2,  bottomright = -0.2  },
199                        ["0x27EB.variants.*"]   = { topright = -0.3,  bottomright = -0.3  },
200                        --
201                        [0x0393]                = { bottomright = -0.20, }, -- upright Gamma
202                        --
203                        ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int
204                        ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint
205                        ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint
206                        ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint
207                    },
208                },
209                presets.addmathkerns { },
210                {
211                    tweak = "checkspacing",
212                },
213                {
214                    tweak = "addscripts",
215                },
216                {
217                    tweak = "addprivates",
218                },
219                {
220                    tweak = "accentdimensions",
221                },
222                {
223                    tweak = "addrules",
224                },
225                {
226                    tweak = "addarrows",
227                },
228--                 {
229--                     tweak   = "addbars",
230--                     advance = 0.2,
231-- variant = 2,
232--                 },
233                {
234                    tweak    = "replacerules",
235                    fraction = { height = .215, yoffset = .785 },
236                    radical  = { height = .215, yoffset = .785, leftoffset = .1, rightoffset = .1 },
237                    stacker  = { height = .215, yoffset = .785 },
238                },
239                -- on the radical we adapt the offset and give some extra height (prevent clipping)
240                {
241                    tweak    = "replacerules",
242                    feature  = "euleroverpagella",
243                    fraction = { height = .15, yoffset = .85 },
244                    radical  = { height = .22, yoffset = .8, leftoffset = .05, rightoffset = .05, leftoverlap = .01 },
245                    stacker  = { height = .15, yoffset = .85 },
246                },
247                {
248                    tweak = "addactuarian",
249                },
250                {
251                    tweak = "addequals",
252                },
253                {
254                    tweak   = "addfourier",
255                    variant = 1,
256                },
257--                 {
258--                     tweak   = "addprimed",
259--                 },
260                {
261                    tweak = "kernpairs",
262                    list = {
263                        -- beware: we kept the italic correction in spite of punctuation class
264                        [0x1D453] = { -- f
265                            [0x3A] = -.1,
266                            [0x3B] = -.1,
267                        },
268                    },
269                },
270                -- this is the mkiv section
271                {
272                    tweak   = "emulatelmtx",
273                    feature = "emulatelmtx",
274                    comment = "this is for mkiv",
275                },
276                {
277                    tweak   = "parameters",
278                    feature = "emulatelmtx",
279                    comment = "this is for mkiv",
280                    list    = {
281                        AccentBaseHeight = 400,
282                    }
283                },
284            },
285        },
286        bigslots = {
287            1, 3, 5, 7
288        },
289        alternates = {
290            dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" },
291        },
292    },
293}
294