kpfonts-math.lfg /size: 7405 b    last modification: 2024-01-16 10:22
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.40",
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                    -- kpfonts have calligraphic at private slots
70                    tweak   = "replacealphabets",
71                    list    = {
72                        {
73                            source   = "uppercasescript",
74                            target   = "uppercasecalligraphic",
75                        },
76                        {
77                            source   = { first = 0x0E7E1, last = 0x0E7FA },
78                            target   = "uppercasecalligraphic",
79                        },
80                        {
81                            source   = "uppercaseboldscript",
82                            target   = "uppercaseboldcalligraphic",
83                        },
84                        {
85                            source   = { first = 0x0E701, last = 0x0E71A },
86                            target   = "uppercaseboldcalligraphic",
87                        },
88                    },
89                },
90                presets.scripttocalligraphic { },
91                presets.rsfstoscript         { rscale  = 0.95 },
92                presets.rsfsuprighttoscript  { rscale  = 0.95 },
93                presets.moderntocalligraphic { rscale  = 0.95 },
94                presets.eulertocalligraphic  { rscale  = 0.95 },
95                presets.xitsarabic           { rscale  = 0.92 },
96                presets.fallbacks            { },
97                presets.moveitalics          { correct = true },
98                presets.moveitalics          { correct = true, letters = true },
99                presets.moveintegrals        { factor  = 1.4 },
100                presets.wipeitalics          { },
101                {
102                    tweak = "checkspacing",
103                },
104                {
105                    tweak   = "radicaldegreeanchors",
106                    list = {
107                        [0x221A]                = { location = "left", hfactor  = .0, vfactor  = .75 },
108                        ["0x221A.variants.*"]   = { location = "left", hfactor  = .0, vfactor  = .55 },
109                        ["0x221A.variants.1"]   = { location = "left", hfactor  = .0, vfactor  = .6 },
110                        ["0x221A.parts.bottom"] = { location = "left", hfactor  = .0, vfactor  = 0.65 },
111                    }
112                },
113                {
114                    tweak = "flattenaccents",
115                },
116                {
117                    tweak = "addscripts",
118                },
119                {
120                    tweak = "accentdimensions",
121                },
122                {
123                    tweak = "addrules",
124                },
125{
126    tweak    = "replacerules",
127    -- minus = {
128    --     height      = 0.1818,
129    --     yoffset     = 0.818,
130    --     leftoffset  = 0.2,
131    --     rightoffset = 0.2,
132    -- },
133    fraction = {
134        height  = .1818,
135        yoffset = .818,
136    },
137    radical = {
138        height      = .1818,
139        yoffset     = .818,
140        leftoffset  = 0.08,
141        rightoffset = 0.08,
142    },
143    stacker = {
144        height  = .1818,
145        yoffset = .818,
146    },
147},
148                {
149                    -- This will be fixed. Check if new version comes out!
150                    tweak   = "addbars",
151                    advance = 0.5,
152                },
153                {
154                    tweak = "addactuarian",
155                },
156                {
157                    tweak = "addequals",
158                },
159                {
160                    tweak = "addfourier",
161                    variant = 2,
162                },
163                {
164                    tweak = "addprimed",
165                },
166                {
167                    tweak = "setoptions",
168                    set   = { "ignorekerndimensions" }
169                },
170-- {
171--     tweak = "inspect",
172--     unicode = 0x2192
173-- },
174-- {
175--     tweak = "inspect",
176--     unicode = 0x20EF
177-- },
178-- {
179            }
180
181        },
182        alternates = {
183         -- italic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Lowercase Italic" },
184        },
185        bigslots = {
186            1, 2, 3, 4
187        },
188    },
189}
190