1local common = fonts.goodies.load("common-math.lfg") 2local presets = common.mathematics.tweaks.presets 3 4-- local integral_variants = { bottomright = -0.4 } 5-- ----- integral_top = { topright = 0.05 } 6-- local integral_bottom = { bottomright = -0.35 } 7 8return { 9 name = "stix-two-math", 10 version = "1.00", 11 comment = "Goodies that complement stix two opentype.", 12 author = "Hans Hagen & Mikael Sundqvist", 13 copyright = "ConTeXt development team", 14 mathematics = { 15 alternates = { 16-- lambdabar = { feature = 'cv01', value = 1, comment = "Mathematical Alternative Lambda Bar" }, 17-- ramshorn = { feature = 'cv02', value = 1, comment = "Mathematical Alternative Rams Horn" }, 18-- emptyset = { feature = 'cv03', value = 1, comment = "Mathematical Alternative Empty Set" }, 19-- setminus = { feature = 'cv04', value = 1, comment = "Mathematical Alternative Setminus" }, 20-- calligraphic = { feature = 'ss01', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, -- We do this differently 21-- italic = { feature = 'ss02', value = 1, comment = "Mathematical Alternative Lowercase Italic" }, 22-- barred = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Barred Characters" }, -- hbar, lambdabar etc 23-- primes = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Primes" }, -- larger/lower primes, minute etc 24-- arrow = { feature = 'ss05', value = 1, comment = "Mathematical Alternative Smaller Arrows" }, 25-- narrower = { feature = 'ss06', value = 1, comment = "Mathematical Alternative Narrower Elements" }, -- narrower/shorter element etc 26-- small = { feature = 'ss07', value = 1, comment = "Mathematical Alternative Smaller Operators" }, 27-- upright = { feature = 'ss08', value = 1, comment = "Mathematical Alternative Upright Symbols" }, -- upright integrals etc. 28-- negated = { feature = 'ss09', value = 1, comment = "Mathematical Alternative Negated Symbols" }, 29-- relation = { feature = 'ss10', value = 1, comment = "Mathematical Alternative Relations" }, 30-- negatedset = { feature = 'ss11', value = 1, comment = "Mathematical Alternative Negated Set Symbols" }, 31-- propfrown = { feature = 'ss12', value = 1, comment = "Mathematical Alternative Proportional and Frown" }, 32-- negsine = { feature = 'ss13', value = 1, comment = "Mathematical Alternative Negated Sine Wave" }, 33-- intprod = { feature = 'ss14', value = 1, comment = "Mathematical Alternative Interior Products" }, 34-- capcup = { feature = 'ss15', value = 1, comment = "Mathematical Alternative Intersection and Union with serif" }, 35-- circled = { feature = 'ss16', value = 1, comment = "Mathematical Alternative Circled Operators" }, 36-- simvar = { feature = 'ss20', value = 1, comment = "Mathematical Alternative Similar and some more unrelated" }, 37-- -- demo features: 38-- negated8774 = { 39-- feature = 'ss09', 40-- value = 1, 41-- comment = "Mathematical Alternative Negated 8774", 42-- list = { [8774] = true }, 43-- }, 44-- negated8775 = { 45-- feature = 'ss09', 46-- value = 1, 47-- comment = "Mathematical Alternative Negated 8775", 48-- list = { [8775] = true }, 49-- }, 50 }, 51 parameters = { 52-- AccentBaseDepth = 30, 53-- FlattenedAccentTopShiftUp = 0, 54-- RadicalKernAfterDegree = -500, 55 DelimiterPercent = 90, 56 DelimiterShortfall = 400, 57 DelimiterDisplayPercent = 90, 58 DelimiterDisplayShortfall = 400, 59-- DisplayOperatorMinHeight = 1800, -- 1800 in font 60 PrimeShiftUp = "1.15*SuperscriptShiftUp", 61 PrimeShiftUpCramped = "1.15*SuperscriptShiftUp", 62-- RadicalDisplayStyleVerticalGap = "RadicalVerticalGap", --170, 85 63-- -- SuperscriptSnap = 1000, 64-- -- SubscriptSnap = 500, 65 }, 66 tweaks = { 67 aftercopying = { 68 { 69 tweak = "version", 70 expected = "Version 2.12 b168", 71 }, 72 { 73 tweak = "fixprimes", 74 factor = 0.9, 75 }, 76 { 77 tweak = "addmirrors", 78 }, 79 { 80 tweak = "addcomposites", 81 }, 82 -- MS: we need to check this, I moved it up 83-- { 84-- tweak = "replacealphabets", 85-- list = { 86-- { 87-- source = "uppercasescript", 88-- target = "uppercasecalligraphic", 89-- unicode = "uppercasescript", 90-- }, 91-- { 92-- source = "uppercasescript", 93-- target = "uppercasescript", 94-- feature = "ss01", 95-- }, 96-- { 97-- source = "uppercaseboldscript", 98-- target = "uppercaseboldcalligraphic", 99-- unicode = "uppercasescriptbold", 100-- }, 101-- { 102-- source = "uppercaseboldscript", 103-- target = "uppercaseboldscript", 104-- feature = "ss01", 105-- }, 106-- { 107-- source = { first = 0xE17D, last = 0xE195 }, 108-- target = "uppercasesansgreek", 109-- unicode = "uppercasegreeknormal", 110-- }, 111-- { 112-- source = { first = 0xE196, last = 0xE1AE }, -- maybe last = E1B3 113-- target = "lowercasesansgreek", 114-- unicode = "lowercasegreeknormal", 115-- }, 116-- { 117-- source = { first = 0xE1BF, last = 0xE1D7 }, 118-- target = "uppercaseitalicsansgreek", 119-- unicode = "uppercasegreekitalic", 120-- }, 121-- { 122-- source = { first = 0xE1D8, last = 0xE1F0 }, -- maybe last = E1F5 123-- target = "lowercaseitalicsansgreek", 124-- unicode = "lowercasegreekitalic", 125-- }, 126-- }, 127-- }, 128-- { 129-- tweak = "replacealphabets", 130-- filename = "TeXGyrePagellaMath.otf", 131-- list = { 132-- { unicodes = { 0x007C, 0x2223, 0x2016, 0x2980, 0x007C } }, -- single single double triple 133-- } 134-- }, 135 presets.scripttocalligraphic { }, 136 presets.rsfstoscript { }, 137 presets.rsfsuprighttoscript { }, 138 presets.moderntocalligraphic { }, 139 presets.eulertocalligraphic { }, 140 presets.xitsarabic { rscale = 0.95 }, 141 presets.fallbacks { }, 142 presets.moveitalics { correct = true }, 143 presets.moveitalics { correct = true, letters = true }, 144 presets.moveintegrals { }, 145 presets.wipeitalics { }, 146 { 147 tweak = "checkaccents", 148 }, 149 -- Extensibles use .s1 (variant 1), so we cannot wipe all 150-- { 151-- tweak = "wipevariants", 152-- list = { 153-- [0x20D6] = 3, 154-- [0x20D7] = 3, 155-- [0x20EE] = 3, 156-- [0x20EF] = 3, 157-- }, 158-- }, 159 { 160 tweak = "simplifykerns", 161 }, 162-- { 163-- tweak = "kerns", 164-- list = { 165-- [0x002F] = { topleft = -0.2, bottomright = -0.2 }, 166-- ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top 167-- ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom 168-- ["0x29.parts.top"] = { topright = -0.1, }, -- right parenthesis top 169-- ["0x29.parts.bottom"] = { bottomright = -0.1 }, -- right parenthesis bottom 170-- ["0x29.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- right parenthesis variants 171-- ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top 172-- ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom 173-- ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants 174-- [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle 175-- ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, 176-- [0x27EB] = { topright = -0.1, bottomright = -0.1 }, 177-- ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, 178-- -- 179-- ["0x222B.parts.bottom"] = { bottomright = -0.30 }, -- int 180-- }, 181-- }, 182 -- Accents are a mess. We migrate the extensibles from the combiners to the base accent 183 -- and then need to tweak the width (which is auto set because it was zero with a large 184 -- accent anchor offset). First we copy and fix. 185 { 186 tweak = "extendaccents", 187 }, 188-- { 189-- tweak = "radicaldegreeanchors", 190-- list = { 191-- [0x221A] = { location = "left", hfactor = 0.00, vfactor = 0.7 }, 192-- ["0x221A.variants.*"] = { location = "left", hfactor = 0.00, vfactor = 0.55 }, 193-- ["0x221A.variants.3"] = { location = "left", hfactor = 0.00, vfactor = .525 }, 194-- ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.00 }, 195-- } 196-- }, 197 { 198 tweak = "flattenaccents", 199 }, 200 { 201 tweak = "fixaccents", 202 }, 203-- -- First we set the dimensions of the initial accent which started out as zero but we want 204-- -- a proper width. 205-- -- { 206-- -- tweak = "dimensions", 207-- -- list = { 208-- -- [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat 209-- -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde 210-- -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve 211-- -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck 212-- -- }, 213-- -- }, 214-- -- Then we deal with all offsets and heights in one go. So we treat the initial accent 215-- -- as well as the variants here. 216-- { 217-- tweak = "dimensions", 218-- list = { 219-- -- here we want to apply to all 220-- [0x020DB] = { yoffset = 0.025, height = .95, all = true }, -- widedddot : 0x20DB (self) 221-- }, 222-- }, 223 -- We now copy these to the not wide slots so that we can set these to stretch as well, 224 -- if only because it is less confusing and more consistent. 225 { 226 tweak = "copyaccents", 227 }, 228 -- So far for the accents. 229 { 230 tweak = "checkspacing", 231 }, 232 { 233 tweak = "addscripts", 234 }, 235 { 236 tweak = "accentdimensions", 237 }, 238 { 239 tweak = "addrules", 240 }, 241 { 242 tweak = "addarrows", 243 }, 244 { 245 tweak = "fixslashes", 246 }, 247 { 248 tweak = "replacerules", 249-- minus = { 250-- height = .233, 251-- yoffset = .768, 252-- leftoffset = .08, 253-- rightoffset = .08, 254-- }, 255-- fraction = { 256-- height = .233, 257-- yoffset = .768, 258-- }, 259-- radical = { 260-- height = .233, 261-- yoffset = .768, 262-- leftoffset = .08, 263-- rightoffset = .08, 264-- }, 265-- stacker = { 266-- height = .233, 267-- yoffset = .768, 268-- }, 269 }, 270 { 271 tweak = "addactuarian", 272 }, 273 { 274 tweak = "addfourier", 275 variant = 1, 276 }, 277 { 278 tweak = "addprimed", 279 }, 280-- { 281-- tweak = "addparts", 282-- list = { 283-- [0x21F4] = { 284-- horizontal = true, 285-- template = 0x2192, 286-- sequence = { 287-- { glyph = "first", factor = 2 }, 288-- { glyph = 0x2218 }, 289-- { glyph = "first", factor = 2 }, 290-- { glyph = "last" }, 291-- } 292-- } 293-- } 294-- }, 295-- { 296-- tweak = "addbars", 297-- advance = 0.3, 298-- check = true, -- only add triples 299-- }, 300 -- this is the mkiv section 301-- { 302-- tweak = "emulatelmtx", 303-- feature = "emulatelmtx", 304-- comment = "this is for mkiv", 305-- }, 306 }, 307 }, 308 bigslots = { 309 1, 3, 5, 7 310 }, 311 }, 312} 313 |