kpfonts-math.lfg /size: 7487 b    last modification: 2025-02-21 11:03
1-- This font is under active development so we don't want to tweek it too much
2-- before all issues are sorted out.
3
4local common  = fonts.goodies.load("common-math.lfg")
5local presets = common.mathematics.tweaks.presets
6
7return {
8    name = "kpfonts-math",
9    version = "1.00",
10    comment = "KP Fonts.",
11    author = "Hans Hagen & Mikael Sundqvist",
12    copyright = "ConTeXt development team",
13    mathematics = {
14        parameters = {
15            DelimiterPercent                  =   85,
16            DelimiterShortfall                =  400,
17            DelimiterDisplayPercent           =   90,
18            DelimiterDisplayShortfall         =  400,
19            AccentBaseDepth                   =   30,
20            DelimiterPercent                  =   90,
21            DelimiterShortfall                =  400,
22            PrimeShiftUp                      = "1.15*SuperscriptShiftUp",
23            PrimeShiftUpCramped               = "1.15*SuperscriptShiftUp",
24            SubscriptShiftDownWithSuperscript = "1.2*SubscriptShiftDown", -- unclear original value, trial and error
25            RadicalDisplayStyleVerticalGap    = "RadicalVerticalGap", --170, 62
26        },
27        tweaks = {
28            aftercopying = {
29                {
30                    tweak    = "version",
31                    expected = "Version 0.61",
32                },
33                {
34                    tweak = "checkaccents",
35                },
36                {
37                    tweak = "dimensions",
38                    list  = {
39                        [0x2A3F] = { factor = 0.84625 }
40                    },
41                },
42                {
43                    tweak = "kerns",
44                    list  = {
45                        [0x002F]                = { topleft  = -0.2,  bottomright = -0.2  },
46                        ["0x7D.parts.top"]      = { topright = -0.25                      }, -- right brace top
47                        ["0x7D.parts.bottom"]   = {                   bottomright = -0.25 }, -- right brace bottom
48                        ["0x7D.variants.*"]     = { topright = -0.1,  bottomright = -0.1  }, -- right brace variants
49                        ["0x29.parts.top"]      = { topright = -0.05                      }, -- right parenthesis top
50                        ["0x29.parts.bottom"]   = {                   bottomright = -0.05 }, -- right parenthesis bottom
51                        ["0x29.variants.*"]     = { topright = -0.05, bottomright = -0.05 }, -- right parenthesis variants
52                        ["0x221A.parts.top"]    = { topright = 0.2                        }, -- right radical top
53                        ["0x221A.parts.bottom"] = {                   bottomright =  0.2  }, -- right radical bottom
54                        ["0x221A.variants.*"]   = { topright = 0.2,   bottomright =  0.2  }, -- right radical variants
55
56                    },
57                },
58                {
59                    tweak   = "fixprimes",
60                    factor  = 0.86, -- accent base height
61                    smaller = true, -- replace multiples
62                    scale   = 1, -- glyph scale
63                    fake    = 0.8, -- replace multiples with this width proportion
64                },
65                {
66                    tweak = "addmirrors",
67                },
68                {
69                    tweak = "addcomposites",
70                },
71                {
72                    -- kpfonts have calligraphic at private slots
73                    tweak   = "replacealphabets",
74                    list    = {
75                        {
76                            source   = "uppercasescript",
77                            target   = "uppercasecalligraphic",
78                        },
79                        {
80                            source   = { first = 0x0E7E1, last = 0x0E7FA },
81                            target   = "uppercasecalligraphic",
82                        },
83                        {
84                            source   = "uppercaseboldscript",
85                            target   = "uppercaseboldcalligraphic",
86                        },
87                        {
88                            source   = { first = 0x0E701, last = 0x0E71A },
89                            target   = "uppercaseboldcalligraphic",
90                        },
91                    },
92                },
93                presets.scripttocalligraphic { },
94                presets.rsfstoscript         { rscale  = 0.95 },
95                presets.rsfsuprighttoscript  { rscale  = 0.95 },
96                presets.moderntocalligraphic { rscale  = 0.95 },
97                presets.eulertocalligraphic  { rscale  = 0.95 },
98                presets.xitsarabic           { rscale  = 0.92 },
99                presets.fallbacks            { },
100                presets.moveitalics          { correct = true },
101                presets.moveitalics          { correct = true, letters = true },
102                presets.moveintegrals        { factor  = 1.4 },
103                presets.wipeitalics          { },
104                {
105                    tweak = "checkspacing",
106                },
107                {
108                    tweak   = "radicaldegreeanchors",
109                    list = {
110                        [0x221A]                = { location = "left", hfactor  = .0, vfactor  = .75 },
111                        ["0x221A.variants.*"]   = { location = "left", hfactor  = .0, vfactor  = .55 },
112                        ["0x221A.variants.1"]   = { location = "left", hfactor  = .0, vfactor  = .6 },
113                        ["0x221A.parts.bottom"] = { location = "left", hfactor  = .0, vfactor  = 0.65 },
114                    }
115                },
116                {
117                    tweak = "flattenaccents",
118                },
119                {
120                    tweak = "addscripts",
121                },
122                {
123                    tweak = "accentdimensions",
124                },
125                {
126                    tweak = "addrules",
127                },
128{
129    tweak    = "replacerules",
130    -- minus = {
131    --     height      = 0.1818,
132    --     yoffset     = 0.818,
133    --     leftoffset  = 0.2,
134    --     rightoffset = 0.2,
135    -- },
136    fraction = {
137        height  = .1818,
138        yoffset = .818,
139    },
140    radical = {
141        height      = .1818,
142        yoffset     = .818,
143        leftoffset  = 0.08,
144        rightoffset = 0.08,
145    },
146    stacker = {
147        height  = .1818,
148        yoffset = .818,
149    },
150},
151                {
152                    -- This will be fixed. Check if new version comes out!
153                    tweak   = "addbars",
154                    advance = 0.5,
155                },
156                {
157                    tweak = "addactuarian",
158                },
159                {
160                    tweak = "addequals",
161                },
162                {
163                    tweak = "addfourier",
164                    variant = 2,
165                },
166                {
167                    tweak = "addprimed",
168                },
169                {
170                    tweak = "setoptions",
171                    set   = { "ignorekerndimensions" }
172                },
173-- {
174--     tweak = "inspect",
175--     unicode = 0x2192
176-- },
177-- {
178--     tweak = "inspect",
179--     unicode = 0x20EF
180-- },
181-- {
182            }
183
184        },
185        alternates = {
186         -- italic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" },
187        },
188        bigslots = {
189            1, 2, 3, 4
190        },
191    },
192}
193