newcomputermodern-math.lfg /size: 15 Kb    last modification: 2024-01-16 10:22
1local common  = fonts.goodies.load("common-math.lfg")
2local presets = common.mathematics.tweaks.presets
3-- In order to be able to use beta math fonts, we use our own file name and
4-- always remap. As this font is experimental we don't spend too much time
5-- on it now. Even then, we migth stick to design sizes only.
6
7local dimensions, kerns  if CONTEXTLMTXMODE == 0 then
8
9    local kern_150 = { bottomright = { { kern = -150 } } }
10    local kern_200 = { bottomright = { { kern = -200 } } }
11
12    kerns = {
13        [0x1D449] = kern_150, --
14        [0x1D44A] = kern_200, -- 𝑊
15    }
16
17    dimensions = {
18        -- always applied
19     -- default = {
20     -- },
21        -- driven by 'mathdimensions' feature
22        default = {
23            -- the root is quite displaced
24            [0x221A] = {
25                -- 73, -960, 853, 40
26                yoffset = 960 - 40,
27                height  = 960,
28                depth   =  40,
29            },
30        -- [0xFE932] = { xoffset = 50, width = 290 }, -- used prime
31        -- [0x2032]  = { xoffset = 50, width = 290 }, -- prime
32        },
33    -- -- seems ok now --
34    -- signs   = {
35    --  -- [0x00B1] = { -- ±
36    --  --     height = 500, depth = 0,
37    --  -- },
38    --  -- [0x2213] = { -- ∓
39    --  --     height = 500, depth = 0,
40    --  -- },
41    --     -- move in boundingbox
42    --     [0x00B1] = { -- ±
43    --         yoffset =  100,
44    --     },
45    --     [0x2213] = { -- ∓
46    --         yoffset = -100,
47    --     },
48    -- },
49    }
50
51end
52
53return {
54    name = "newcomputermodern",
55    version = "1.00",
56    comment = "Goodies that complement newcomputermodern.",
57    author = "Hans Hagen & Mikael Sundqvist",
58    copyright = "ConTeXt development team",
59    mathematics = {
60        parameters = {
61            -- Borrow values from lm:
62            FractionNumeratorDisplayStyleShiftUp = function(value,target,original)
63                local o = original.mathparameters.FractionNumeratorDisplayStyleShiftUp
64                if o > 675 then
65                    o = 600
66                else
67                    -- probably tuned
68                end
69                return o * target.parameters.factor
70            end,
71            NoLimitSupFactor                     =   0,
72            NoLimitSubFactor                     = 1200,
73            DelimiterPercent                     =  85,
74            DelimiterShortfall                   = 400,
75            DelimiterDisplayPercent              =  90, -- MS
76            DelimiterDisplayShortfall            = 400,
77            AccentTopShiftUp                     = -60,
78            FlattenedAccentTopShiftUp            = -60,
79            SubscriptBaselineDropMin             =  50, -- 200 in font (multiplied by 0.59999/2.39868)
80            SubscriptShiftDown                   =  150, -- 247 in font (multiplied to be consistent with cm)
81            SubscriptShiftDownWithSuperscript    =  247, -- relates to the previous one (see math-act)
82            SuperscriptBaselineDropMax           =  386, -- 250 in font (multiplied by 4.6333/2.99 (values in cm/values in lm))
83            SuperscriptShiftUp                   =  413, -- 363 in font (multiplied with 4.9547/4.3536, got 413)
84            SuperscriptShiftUpCramped            =  329, -- 289 in font (same factor as uncramped one (no distinction, old TeX)
85            PrimeShiftUp                         = "1.1*SuperscriptShiftUp",
86            PrimeShiftUpCramped                  = "1.1*SuperscriptShiftUp",
87            RadicalDisplayStyleVerticalGap       = 100,--"RadicalVerticalGap" too small, 148, 50
88        },
89        tweaks = {
90            aftercopying = {
91                {
92                    tweak    = "version",
93                    expected = "Version 1.958",
94                },
95                {
96                    tweak   = "fixprimes",
97                    factor  = 0.825,
98                    smaller = true,
99                    fake    = 0.6,
100                },
101                presets.scripttocalligraphic { },
102                presets.rsfstoscript         { },
103                presets.rsfsuprighttoscript  { },
104                presets.moderntocalligraphic { },
105                presets.eulertocalligraphic  { },
106                presets.xitsarabic           { rscale  = 0.80 },
107                presets.fallbacks            { },
108                presets.moveitalics          { correct = true },
109                presets.moveitalics          { correct = true, letters = true },
110                presets.moveintegrals        { factor = 1.4, icfactor = 0.8 }, -- the icfactor is due to the very slanted integral.
111                presets.wipeanchors          { },
112                presets.wipeitalics          { },
113                {
114                    tweak = "checkaccents",
115                },
116                {
117                    tweak = "kerns",
118                    list  = {
119                        [0x0002F] = { topleft = -0.2, bottomright = -0.2 }, -- solidus
120                        --
121                        [0x00393] = { bottomright = -0.20, }, -- upright Gamma
122                        --
123                        ["0x7D.parts.top"]      = { topright = -0.25                      }, -- right brace top
124                        ["0x7D.parts.bottom"]   = {                   bottomright = -0.25 }, -- right brace bottom
125                        ["0x7D.variants.*"]     = { topright = -0.25, bottomright = -0.25 }, -- right brace variants
126                        ["0x29.parts.top"]      = { topright =  -0.3,                     }, -- right parenthesis top
127                        ["0x29.parts.bottom"]   = {                   bottomright = -0.3  }, -- right parenthesis bottom
128                        ["0x29.variants.*"]     = { topright = -0.15, bottomright = -0.15 }, -- right parenthesis variants
129                        ["0x221A.parts.top"]    = { topright =  0.2,                      }, -- right radical top
130                        ["0x221A.parts.bottom"] = {                   bottomright =  0.2  }, -- right radical bottom
131                        ["0x221A.variants.*"]   = { topright =  0.2,  bottomright =  0.2  }, -- right radical variants
132                        [0x27E9]                = { topright = -0.2,  bottomright = -0.2  }, -- angles
133                        ["0x27E9.variants.*"]   = { topright = -0.3,  bottomright = -0.3  },
134                        [0x27EB]                = { topright = -0.2,  bottomright = -0.2  },
135                        ["0x27EB.variants.*"]   = { topright = -0.3,  bottomright = -0.3  },
136
137                    },
138                },
139                {
140                    tweak = "flattenaccents",
141                },
142                {
143                    tweak = "checkspacing",
144                },
145                {
146                    tweak = "fixradicals",
147                },
148                {
149                    tweak = "addscripts",
150                },
151                {
152                    tweak = "accentdimensions",
153                },
154                {
155                    tweak = "addrules",
156                },
157                {
158                    tweak    = "replacerules",
159                 -- minus    = true, -- we have an extensible
160                    fraction = { height = .15, yoffset = .85 },
161                    radical  = { height = .15, yoffset = .823, leftoffset = .065, rightoffset = .065, leftoverlap = 0.03 },
162                    stacker  = { height = .15, yoffset = .85 },
163                },
164                {
165                    tweak = "fixvariants",
166                    list  = {
167                        [0x007C] = { template = 0x005B, index = 1, yoffset = .03 },
168                        [0x2016] = { template = 0x005B, index = 1, yoffset = .03 },
169                        [0x2980] = { template = 0x005B, index = 1, yoffset = .03 },
170                    }
171                },
172                {
173                    tweak = "addfourier",
174                    variant = 1,
175                },
176                {
177                    tweak   = "addprimed",
178                },
179            },
180        },
181        bigs = {
182            1, 3, 5, 7
183        },
184        --
185        -- experimental fixes for mkiv:
186        --
187        dimensions = dimensions,
188        kerns = kerns,
189    },
190    filenames = {
191        ["latinmodern-math-regular.otf"] = {
192            "latinmodern-math.otf", -- the beta
193            "lmmath-regular.otf",
194            "latinmodernmath-regular.otf",
195            "lmmath-regular.otf",
196            "lmodernmath-regular.otf",
197            "lmodern-math.otf",
198        },
199    },
200    designsizes = {
201        ["LMMathRoman-Regular"] = {
202            ["4pt"]  = "LMMath5-Regular@lmroman5-math",
203            ["5pt"]  = "LMMath5-Regular@lmroman5-math",
204            ["6pt"]  = "LMMath6-Regular@lmroman6-math",
205            ["7pt"]  = "LMMath7-Regular@lmroman7-math",
206            ["8pt"]  = "LMMath8-Regular@lmroman8-math",
207            ["9pt"]  = "LMMath9-Regular@lmroman9-math",
208            ["10pt"] = "LMMath10-Regular@lmroman10-math",
209            ["11pt"] = "LMMath10-Regular@lmroman10-math",
210            ["12pt"] = "LMMath12-Regular@lmroman12-math",
211            default  = "LMMath10-Regular@lmroman10-math"
212        },
213        ["LMMathRoman-Bold"] = { -- not yet ready
214            ["4pt"]  = "LMMath5-Regular@lmroman5-math",
215            ["5pt"]  = "LMMath5-Regular@lmroman5-math",
216            ["6pt"]  = "LMMath6-Regular@lmroman6-math",
217            ["7pt"]  = "LMMath7-Regular@lmroman7-math",
218            ["8pt"]  = "LMMath8-Regular@lmroman8-math",
219            ["9pt"]  = "LMMath9-Regular@lmroman9-math",
220            ["10pt"] = "LMMath10-Regular@lmroman10-math",
221            ["11pt"] = "LMMath10-Regular@lmroman10-math",
222            ["12pt"] = "LMMath12-Regular@lmroman12-math",
223            default  = "LMMath10-Regular@lmroman10-math"
224        },
225        ["LMRoman-Regular"] = {
226            ["4pt"]  = "file:lmroman5-regular",
227            ["5pt"]  = "file:lmroman5-regular",
228            ["6pt"]  = "file:lmroman6-regular",
229            ["7pt"]  = "file:lmroman7-regular",
230            ["8pt"]  = "file:lmroman8-regular",
231            ["9pt"]  = "file:lmroman9-regular",
232            ["10pt"] = "file:lmroman10-regular",
233            ["11pt"] = "file:lmroman10-regular",
234            ["12pt"] = "file:lmroman12-regular",
235            default  = "file:lmroman10-regular",
236        },
237        ["LMRoman-Bold"] = {
238            ["4pt"]  = "file:lmroman5-bold",
239            ["5pt"]  = "file:lmroman5-bold",
240            ["6pt"]  = "file:lmroman6-bold",
241            ["7pt"]  = "file:lmroman7-bold",
242            ["8pt"]  = "file:lmroman8-bold",
243            ["9pt"]  = "file:lmroman9-bold",
244            ["10pt"] = "file:lmroman10-bold",
245            ["11pt"] = "file:lmroman10-bold",
246            ["12pt"] = "file:lmroman12-bold",
247            default  = "file:lmroman10-bold",
248        },
249        ["LMRoman-Demi"] = {
250            default  = "file:lmromandemi10-regular",
251        },
252        ["LMRoman-Italic"] = {
253            ["4pt"]  = "file:lmroman7-italic",
254            ["5pt"]  = "file:lmroman7-italic",
255            ["6pt"]  = "file:lmroman7-italic",
256            ["7pt"]  = "file:lmroman7-italic",
257            ["8pt"]  = "file:lmroman8-italic",
258            ["9pt"]  = "file:lmroman9-italic",
259            ["10pt"] = "file:lmroman10-italic",
260            ["11pt"] = "file:lmroman10-italic",
261            ["12pt"] = "file:lmroman12-italic",
262            default  = "file:lmroman10-italic",
263        },
264        ["LMRoman-Oblique"] = {
265            ["4pt"]  = "file:lmromanslant8-regular",
266            ["5pt"]  = "file:lmromanslant8-regular",
267            ["6pt"]  = "file:lmromanslant8-regular",
268            ["7pt"]  = "file:lmromanslant8-regular",
269            ["8pt"]  = "file:lmromanslant8-regular",
270            ["9pt"]  = "file:lmromanslant9-regular",
271            ["10pt"] = "file:lmromanslant10-regular",
272            ["11pt"] = "file:lmromanslant10-regular",
273            ["12pt"] = "file:lmromanslant12-regular",
274            default  = "file:lmromanslant10-regular",
275        },
276        ["LMRoman-BoldItalic"] = {
277            default  = "file:lmroman10-bolditalic",
278        },
279        ["LMRoman-BoldOblique"] = {
280            default  = "file:lmromanslant10-bold",
281        },
282        ["LMRoman-DemiOblique"] = {
283            default  = "file:lmromandemi10-oblique",
284        },
285        ["LMRoman-CapsRegular"] = {
286            default  = "file:lmromancaps10-regular",
287        },
288        ["LMRoman-CapsOblique"] = {
289            default  = "file:lmromancaps10-oblique",
290        },
291        ["LMRoman-Dunhill"] = {
292            default  = "file:lmromandunh10-regular",
293        },
294        ["LMRoman-DunhillOblique"] = {
295            default  = "file:lmromandunh10-oblique",
296        },
297        ["LMRoman-Unslanted"] = {
298            default  = "file:lmromanunsl10-regular",
299        },
300        ["LMSans-Regular"] = {
301            ["8pt"]  = "file:lmsans8-regular",
302            ["9pt"]  = "file:lmsans9-regular",
303            ["10pt"] = "file:lmsans10-regular",
304            ["11pt"] = "file:lmsans10-regular",
305            ["12pt"] = "file:lmsans12-regular",
306            default  = "file:lmsans10-regular",
307        },
308        ["LMSans-Oblique"] = {
309            ["8pt"]  = "file:lmsans8-oblique",
310            ["9pt"]  = "file:lmsans9-oblique",
311            ["10pt"] = "file:lmsans10-oblique",
312            ["11pt"] = "file:lmsans10-oblique",
313            ["12pt"] = "file:lmsans12-oblique",
314            default  = "file:lmsans10-oblique",
315        },
316        ["LMSans-Bold"] = {
317            default  = "file:lmsans10-bold",
318        },
319        ["LMSans-BoldOblique"] = {
320            default  = "file:lmsans10-boldoblique",
321        },
322        ["LMSans-DemiCondensed"] = {
323            default  = "file:lmsansdemicond10-regular",
324        },
325        ["LMSans-DemiCondensedOblique"] = {
326            default  = "file:lmsansdemicond10-oblique",
327        },
328        ["LMTypewriter-Regular"] = {
329            ["8pt"]  = "file:lmmono8-regular",
330            ["9pt"]  = "file:lmmono9-regular",
331            ["10pt"] = "file:lmmono10-regular",
332            ["11pt"] = "file:lmmono10-regular",
333            ["12pt"] = "file:lmmono12-regular",
334            default  = "file:lmmono10-regular",
335        },
336        ["LMTypewriter-Light"] = {
337            default  = "file:lmmonolt10-regular",
338        },
339        ["LMTypewriter-Dark"] = {
340            default  = "file:lmmonolt10-bold",
341        },
342        ["LMTypewriter-Italic"] = {
343            default  = "file:lmmono10-italic",
344        },
345        ["LMTypewriter-LightOblique"] = {
346            default  = "file:lmmonolt10-oblique",
347        },
348        ["LMTypewriter-Oblique"] = {
349            default  = "file:lmmonoslant10-regular",
350        },
351        ["LMTypewriter-DarkOblique"] = {
352            default  = "file:lmmonolt10-boldoblique",
353        },
354        ["LMTypewriter-LightCondensed"] = {
355            default  = "file:lmmonoltcond10-regular",
356        },
357        ["LMTypewriter-LightCondensedOblique"] = {
358            default  = "file:lmmonoltcond10-oblique",
359        },
360        ["LMTypewriterVarWd-Regular"] = {
361            default  = "file:lmmonoproplt10-regular",
362        },
363        ["LMTypewriterVarWd-Oblique"] = {
364            default  = "file:lmmonoproplt10-oblique",
365        },
366        ["LMTypewriterVarWd-Light"] = {
367            default  = "file:lmmonoprop10-regular",
368        },
369        ["LMTypewriterVarWd-LightOblique"] = {
370            default  = "file:lmmonoprop10-oblique",
371        },
372        ["LMTypewriterVarWd-Dark"] = {
373            default  = "file:lmmonoproplt10-bold",
374        },
375        ["LMTypewriterVarWd-DarkOblique"] = {
376            default  = "file:lmmonoproplt10-boldoblique",
377        },
378        ["LMTypewriter-CapsRegular"] = {
379            default  = "file:lmmonocaps10-regular",
380        },
381        ["LMTypewriter-CapsOblique"] = {
382            default  = "file:lmmonocaps10-oblique",
383        },
384    }
385}
386