asana-math.lfg /size: 2276 b    last modification: 2020-07-01 14:35
1-- This patch code is moved from font-pat.lua to this goodies
2-- files as it does not belong in the core code.
3
4local patches = fonts.handlers.otf.enhancers.patches
5
6local function patch(data,filename,threshold)
7    local m = data.metadata.math
8    if m then
9        local d = m.DisplayOperatorMinHeight or 0
10        if d < threshold then
11            patches.report("DisplayOperatorMinHeight(%s -> %s)",d,threshold)
12            m.DisplayOperatorMinHeight = threshold
13        end
14    end
15end
16
17patches.register("after","analyze math","asana",function(data,filename) patch(data,filename,1350) end)
18
19local function less(value,target,original)
20    -- officially we should check the original
21    return 0.25 * value
22end
23
24local function more(value,target,original)
25    local o = original.mathparameters.DisplayOperatorMinHeight
26    if o < 2800 then
27        return 2800 * target.parameters.factor
28    else
29        return value -- already scaled
30    end
31end
32
33
34return {
35    name = "asana-math",
36    version = "1.00",
37    comment = "Goodies that complement asana.",
38    author = "Hans Hagen",
39    copyright = "ConTeXt development team",
40    mathematics = {
41        parameters = {
42         -- DisplayOperatorMinHeight         = 0, -- more
43         -- StackBottomDisplayStyleShiftDown = 0,
44         -- StackBottomShiftDown             = 0,
45         -- StackDisplayStyleGapMin          = 0,
46         -- StackGapMin                      = 0,
47         -- StackTopDisplayStyleShiftUp      = 0,
48         -- StackTopShiftUp                  = 0,
49         -- StretchStackBottomShiftDown      = 0,
50         -- StretchStackGapAboveMin          = 0,
51         -- StretchStackGapBelowMin          = 0,
52         -- StretchStackTopShiftUp           = 0,
53            StackBottomDisplayStyleShiftDown = less,
54            StackBottomShiftDown             = less,
55            StackDisplayStyleGapMin          = less,
56            StackGapMin                      = less,
57            StackTopDisplayStyleShiftUp      = less,
58            StackTopShiftUp                  = less,
59            StretchStackBottomShiftDown      = less,
60            StretchStackGapAboveMin          = less,
61            StretchStackGapBelowMin          = less,
62            StretchStackTopShiftUp           = less,
63        }
64    }
65}
66
67