diff options
Diffstat (limited to 'tex')
68 files changed, 2719 insertions, 2464 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index e1de3bd24..506b3f703 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2022.10.15 10:32} +\newcontextversion{2022.10.21 21:11} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 85524aa83..828709ead 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2022.10.15 10:32} +\edef\contextversion{2022.10.21 21:11} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii index b5e93a66c..8f5571627 100644 --- a/tex/context/base/mkii/mult-cs.mkii +++ b/tex/context/base/mkii/mult-cs.mkii @@ -93,7 +93,6 @@ \setinterfacevariable{author}{autor} \setinterfacevariable{auto}{auto} \setinterfacevariable{autointro}{autouvod} -\setinterfacevariable{autopunctuation}{autopunctuation} \setinterfacevariable{back}{zpet} \setinterfacevariable{background}{pozadi} \setinterfacevariable{backmatter}{epilogy} @@ -677,9 +676,13 @@ \setinterfaceconstant{authoretaltext}{authoretaltext} \setinterfaceconstant{auto}{auto} \setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofencing}{autofencing} \setinterfaceconstant{autofile}{autofile} \setinterfaceconstant{autofocus}{autoostreni} \setinterfaceconstant{autohang}{autohang} +\setinterfaceconstant{autonumbers}{autonumbers} +\setinterfaceconstant{autopunctuation}{autopunctuation} +\setinterfaceconstant{autospacing}{autospacing} \setinterfaceconstant{autostrut}{autostrut} \setinterfaceconstant{autowidth}{autosirka} \setinterfaceconstant{availableheight}{availableheight} diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index 18840146a..cb91a058e 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -676,6 +676,7 @@ \setinterfaceconstant{authoretaltext}{authoretaltext} \setinterfaceconstant{auto}{auto} \setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofencing}{autofencing} \setinterfaceconstant{autofile}{autofile} \setinterfaceconstant{autofocus}{autofocus} \setinterfaceconstant{autohang}{autohang} diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index 4deb21401..6fe56a062 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -406,24 +406,24 @@ local blocks = allocate { ["lisusupplement"] = { first = 0x11FB0, last = 0x11FBF, description = "Lisu Supplement" }, ["lowercasebold"] = { first = 0x1D41A, last = 0x1D433, math = true }, ["lowercaseboldfraktur"] = { first = 0x1D586, last = 0x1D59F, math = true }, - ["lowercasebolditalic"] = { first = 0x1D482, last = 0x1D49B, math = true }, - ["lowercaseboldscript"] = { first = 0x1D4EA, last = 0x1D503, math = true }, + ["lowercasebolditalic"] = { first = 0x1D482, last = 0x1D49B, math = true, italic = true }, + ["lowercaseboldscript"] = { first = 0x1D4EA, last = 0x1D503, math = true, italic = true }, ["lowercasedoublestruck"] = { first = 0x1D552, last = 0x1D56B, math = true }, ["lowercasefraktur"] = { first = 0x1D51E, last = 0x1D537, math = true }, ["lowercasegreekbold"] = { first = 0x1D6C2, last = 0x1D6DB, math = true }, - ["lowercasegreekbolditalic"] = { first = 0x1D736, last = 0x1D74F, math = true }, - ["lowercasegreekitalic"] = { first = 0x1D6FC, last = 0x1D715, math = true }, + ["lowercasegreekbolditalic"] = { first = 0x1D736, last = 0x1D74F, math = true, italic = true }, + ["lowercasegreekitalic"] = { first = 0x1D6FC, last = 0x1D715, math = true, italic = true }, ["lowercasegreeknormal"] = { first = 0x003B1, last = 0x003C9, math = true }, ["lowercasegreeksansserifbold"] = { first = 0x1D770, last = 0x1D789, math = true }, - ["lowercasegreeksansserifbolditalic"] = { first = 0x1D7AA, last = 0x1D7C3, math = true }, - ["lowercaseitalic"] = { first = 0x1D44E, last = 0x1D467, math = true }, + ["lowercasegreeksansserifbolditalic"] = { first = 0x1D7AA, last = 0x1D7C3, math = true, italic = true }, + ["lowercaseitalic"] = { first = 0x1D44E, last = 0x1D467, math = true, italic = true }, ["lowercasemonospace"] = { first = 0x1D68A, last = 0x1D6A3, math = true }, ["lowercasenormal"] = { first = 0x00061, last = 0x0007A, math = true }, ["lowercasesansserifbold"] = { first = 0x1D5EE, last = 0x1D607, math = true }, - ["lowercasesansserifbolditalic"] = { first = 0x1D656, last = 0x1D66F, math = true }, - ["lowercasesansserifitalic"] = { first = 0x1D622, last = 0x1D63B, math = true }, + ["lowercasesansserifbolditalic"] = { first = 0x1D656, last = 0x1D66F, math = true, italic = true }, + ["lowercasesansserifitalic"] = { first = 0x1D622, last = 0x1D63B, math = true, italic = true }, ["lowercasesansserifnormal"] = { first = 0x1D5BA, last = 0x1D5D3, math = true }, - ["lowercasescript"] = { first = 0x1D4B6, last = 0x1D4CF, math = true }, + ["lowercasescript"] = { first = 0x1D4B6, last = 0x1D4CF, math = true, italic = true }, ["lowsurrogates"] = { first = 0x0DC00, last = 0x0DFFF, description = "Low Surrogates" }, ["lycian"] = { first = 0x10280, last = 0x1029F, description = "Lycian" }, ["lydian"] = { first = 0x10920, last = 0x1093F, description = "Lydian" }, @@ -561,24 +561,24 @@ local blocks = allocate { ["unifiedcanadianaboriginalsyllabicsextendeda"] = { first = 0x11AB0, last = 0x11ABF, description = "Unified Canadian Aboriginal Syllabics Extended-A" }, ["uppercasebold"] = { first = 0x1D400, last = 0x1D419, math = true }, ["uppercaseboldfraktur"] = { first = 0x1D56C, last = 0x1D585, math = true }, - ["uppercasebolditalic"] = { first = 0x1D468, last = 0x1D481, math = true }, - ["uppercaseboldscript"] = { first = 0x1D4D0, last = 0x1D4E9, math = true }, + ["uppercasebolditalic"] = { first = 0x1D468, last = 0x1D481, math = true, italic = true }, + ["uppercaseboldscript"] = { first = 0x1D4D0, last = 0x1D4E9, math = true, italic = true }, ["uppercasedoublestruck"] = { first = 0x1D538, last = 0x1D551, math = true }, -- gaps are filled in elsewhere ["uppercasefraktur"] = { first = 0x1D504, last = 0x1D51D, math = true }, ["uppercasegreekbold"] = { first = 0x1D6A8, last = 0x1D6C1, math = true }, - ["uppercasegreekbolditalic"] = { first = 0x1D71C, last = 0x1D735, math = true }, - ["uppercasegreekitalic"] = { first = 0x1D6E2, last = 0x1D6FB, math = true }, + ["uppercasegreekbolditalic"] = { first = 0x1D71C, last = 0x1D735, math = true, italic = true }, + ["uppercasegreekitalic"] = { first = 0x1D6E2, last = 0x1D6FB, math = true, italic = true }, ["uppercasegreeknormal"] = { first = 0x00391, last = 0x003AA, math = true }, ["uppercasegreeksansserifbold"] = { first = 0x1D756, last = 0x1D76F, math = true }, - ["uppercasegreeksansserifbolditalic"] = { first = 0x1D790, last = 0x1D7A9, math = true }, - ["uppercaseitalic"] = { first = 0x1D434, last = 0x1D44D, math = true }, + ["uppercasegreeksansserifbolditalic"] = { first = 0x1D790, last = 0x1D7A9, math = true, italic = true }, + ["uppercaseitalic"] = { first = 0x1D434, last = 0x1D44D, math = true, italic = true }, ["uppercasemonospace"] = { first = 0x1D670, last = 0x1D689, math = true }, ["uppercasenormal"] = { first = 0x00041, last = 0x0005A, math = true }, ["uppercasesansserifbold"] = { first = 0x1D5D4, last = 0x1D5ED, math = true }, - ["uppercasesansserifbolditalic"] = { first = 0x1D63C, last = 0x1D655, math = true }, - ["uppercasesansserifitalic"] = { first = 0x1D608, last = 0x1D621, math = true }, + ["uppercasesansserifbolditalic"] = { first = 0x1D63C, last = 0x1D655, math = true, italic = true }, + ["uppercasesansserifitalic"] = { first = 0x1D608, last = 0x1D621, math = true, italic = true }, ["uppercasesansserifnormal"] = { first = 0x1D5A0, last = 0x1D5B9, math = true }, - ["uppercasescript"] = { first = 0x1D49C, last = 0x1D4B5, math = true }, + ["uppercasescript"] = { first = 0x1D49C, last = 0x1D4B5, math = true, italic = true }, ["vai"] = { first = 0x0A500, last = 0x0A63F, description = "Vai" }, ["variationselectors"] = { first = 0x0FE00, last = 0x0FE0F, description = "Variation Selectors" }, ["variationselectorssupplement"] = { first = 0xE0100, last = 0xE01EF, description = "Variation Selectors Supplement" }, diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 400fc6983..191926e8f 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.10.15 10:32} +\newcontextversion{2022.10.21 21:11} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index e0608818f..5dfadb660 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2022.10.15 10:32} +\edef\contextversion{2022.10.21 21:11} %D Kind of special: diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index f650e5b03..5c156c2ba 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -534,7 +534,6 @@ function constructors.scale(tfmdata,specification) local realdimensions = properties.realdimensions local writingmode = properties.writingmode or "horizontal" local identity = properties.identity or "horizontal" - -- local vfonts = target.fonts if vfonts and #vfonts > 0 then target.fonts = fastcopy(vfonts) -- maybe we virtualize more afterwards diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index eead8abff..2c56b5613 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -1411,7 +1411,7 @@ do -- else too many locals context(function() busy = false mathematics.finishfallbacks(tfmdata,specification,fallbacks) -tfmdata.original = specification.specification + tfmdata.original = specification.specification local id = definefont(tfmdata) csnames[id] = specification.cs properties.id = id @@ -1449,7 +1449,7 @@ tfmdata.original = specification.specification end) return else -tfmdata.original = specification.specification + tfmdata.original = specification.specification local id = definefont(tfmdata) csnames[id] = specification.cs properties.id = id diff --git a/tex/context/base/mkiv/font-imp-italics.lua b/tex/context/base/mkiv/font-imp-italics.lua index 10a419daf..8b38c5893 100644 --- a/tex/context/base/mkiv/font-imp-italics.lua +++ b/tex/context/base/mkiv/font-imp-italics.lua @@ -13,29 +13,32 @@ local handlers = fonts.handlers local registerotffeature = handlers.otf.features.register local registerafmfeature = handlers.afm.features.register -local function initialize(tfmdata,key,value) - local factor = tonumber(value) or 1 - for unicode, character in next, tfmdata.characters do - local olditalic = character.italic - if olditalic and olditalic ~= 0 then - character.width = character.width + olditalic - character.italic = 0 - character.bottomright = -factor * olditalic - end - end -end - -local specification = { - name = "italicwidths", - description = "add italic to width", - manipulators = { - base = initialize, - node = initialize, -- only makes sense for math - } -} - -registerotffeature(specification) -registerafmfeature(specification) +-- This is a precursor to what we do in lmtx now via tweaks but at some point I +-- might make this a mkiv features too using staircase kerns. + +-- local function initialize(tfmdata,key,value) +-- local factor = tonumber(value) or 1 +-- for unicode, character in next, tfmdata.characters do +-- local olditalic = character.italic +-- if olditalic and olditalic ~= 0 then +-- character.width = character.width + olditalic +-- character.italic = 0 +-- character.bottomright = -factor * olditalic -- lmtx only +-- end +-- end +-- end +-- +-- local specification = { +-- name = "italicwidths", +-- description = "add italic to width", +-- manipulators = { +-- base = initialize, +-- node = initialize, -- only makes sense for math +-- } +-- } +-- +-- registerotffeature(specification) +-- registerafmfeature(specification) local function initialize(tfmdata,value) -- hm, always value if value then diff --git a/tex/context/base/mkiv/font-imp-math.lua b/tex/context/base/mkiv/font-imp-math.lua index c0185ca34..624f39f02 100644 --- a/tex/context/base/mkiv/font-imp-math.lua +++ b/tex/context/base/mkiv/font-imp-math.lua @@ -16,57 +16,41 @@ local registerotffeature = fonts.handlers.otf.features.register local setmetatableindex = table.setmetatableindex --- requested for latex but not supported unless really needed in context: +-- local splitter = lpeg.splitat(",",tonumber) +-- local lpegmatch = lpeg.match -- --- registerotffeature { --- name = "ignoremathconstants", --- description = "ignore math constants table", --- initializers = { --- base = function(tfmdata,value) --- if value then --- tfmdata.mathparameters = nil +-- local function initialize(tfmdata,value) +-- local mathparameters = tfmdata.mathparameters +-- if mathparameters then +-- local sup, sub +-- if type(value) == "string" then +-- sup, sub = lpegmatch(splitter,value) +-- if not sup then +-- sub, sup = 0, 0 +-- elseif not sub then +-- sub, sup = sup, 0 -- end +-- elseif type(value) == "number" then +-- sup, sub = 0, value +-- end +-- if sup then +-- mathparameters.NoLimitSupFactor = sup -- end +-- if sub then +-- mathparameters.NoLimitSubFactor = sub +-- end +-- end +-- end +-- +-- registerotffeature { +-- name = "mathnolimitsmode", +-- description = "influence nolimits placement", +-- initializers = { +-- base = initialize, +-- node = initialize, -- } -- } --- tfmdata.properties.mathnolimitsmode = tonumber(value) or 0 - -local splitter = lpeg.splitat(",",tonumber) -local lpegmatch = lpeg.match - -local function initialize(tfmdata,value) - local mathparameters = tfmdata.mathparameters - if mathparameters then - local sup, sub - if type(value) == "string" then - sup, sub = lpegmatch(splitter,value) - if not sup then - sub, sup = 0, 0 - elseif not sub then - sub, sup = sup, 0 - end - elseif type(value) == "number" then - sup, sub = 0, value - end - if sup then - mathparameters.NoLimitSupFactor = sup - end - if sub then - mathparameters.NoLimitSubFactor = sub - end - end -end - -registerotffeature { - name = "mathnolimitsmode", - description = "influence nolimits placement", - initializers = { - base = initialize, - node = initialize, - } -} - local function initialize(tfmdata,value) tfmdata.properties.nostackmath = value and true end diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index 445dedd25..5cd107c23 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -401,10 +401,11 @@ % liga=yes, % makes no sense % tlig=yes, % makes no sense % trep=yes, % makes no sense - mathnolimitsmode={0,800}, % this looks okay on the average font + % mathnolimitsmode={0,800}, % this looks okay on the average font mathalternates=yes, - mathitalics=yes, % we pass them - mathdimensions=all, + emulatelmtx=yes, + % mathitalics=yes, % we pass them + % mathdimensions=all, % mathkerns=yes, % mathgaps=yes, language=dflt, diff --git a/tex/context/base/mkiv/good-mth.lua b/tex/context/base/mkiv/good-mth.lua index 751ab2438..e25782e9e 100644 --- a/tex/context/base/mkiv/good-mth.lua +++ b/tex/context/base/mkiv/good-mth.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['good-mth'] = { + if not modules then modules = { } end modules ['good-mth'] = { version = 1.000, comment = "companion to font-lib.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -47,151 +47,151 @@ local prependcommands = helpers.prependcommands -- experiment, we have to load the definitions immediately as they precede -- the definition so they need to be initialized in the typescript -local function withscriptcode(tfmdata,unicode,data,action) - if type(unicode) == "string" then - local p, u = match(unicode,"^(.-):(.-)$") - if u then - u = tonumber(u) - if u then - local slots = fonts.helpers.mathscriptslots(tfmdata,u) - if slots then - if p == "*" then - action(u,data) - for i=1,#slots do - action(slots[i],data) - end - else - p = tonumber(p) - if p then - action(slots[p],data) - end - end - end - end - end - else - action(unicode,data) - end -end - -local function finalize(tfmdata,feature,value) --- if tfmdata.mathparameters then -- funny, cambria text has this - local goodies = tfmdata.goodies - if goodies then - local virtualized = mathematics.virtualized - for i=1,#goodies do - local goodie = goodies[i] - local mathematics = goodie.mathematics - local dimensions = mathematics and mathematics.dimensions - if dimensions then - if trace_defining then - report_math("overloading dimensions in %a @ %p",tfmdata.properties.fullname,tfmdata.parameters.size) - end - local characters = tfmdata.characters - local descriptions = tfmdata.descriptions - local parameters = tfmdata.parameters - local factor = parameters.factor - local hfactor = parameters.hfactor - local vfactor = parameters.vfactor - local function overloadone(unicode,data) - local character = characters[unicode] - if not character then - local c = virtualized[unicode] - if c then - character = characters[c] - end - end - if character then - local width = data.width - local height = data.height - local depth = data.depth - if trace_defining and (width or height or depth) then - report_math("overloading dimensions of %C, width %p, height %p, depth %p", - unicode,width or 0,height or 0,depth or 0) - end - if width then character.width = width * hfactor end - if height then character.height = height * vfactor end - if depth then character.depth = depth * vfactor end - -- - local xoffset = data.xoffset - local yoffset = data.yoffset - if xoffset == "llx" then - local d = descriptions[unicode] - if d then - xoffset = - d.boundingbox[1] * hfactor - character.width = character.width + xoffset - xoffset = rightcommand[xoffset] - else - xoffset = nil - end - elseif xoffset and xoffset ~= 0 then - xoffset = rightcommand[xoffset * hfactor] - else - xoffset = nil - end - if yoffset and yoffset ~= 0 then - yoffset = upcommand[yoffset * vfactor] - else - yoffset = nil - end - if xoffset or yoffset then - local commands = character.commands - if commands then - prependcommands(commands,yoffset,xoffset) - else - local slot = charcommand[unicode] - if xoffset and yoffset then - character.commands = { xoffset, yoffset, slot } - elseif xoffset then - character.commands = { xoffset, slot } - else - character.commands = { yoffset, slot } - end - end - end - elseif trace_defining then - report_math("no overloading dimensions of %C, not in font",unicode) - end - end - local function overload(dimensions) - for unicode, data in next, dimensions do - withscriptcode(tfmdata,unicode,data,overloadone) - end - end - if value == nil then - value = { "default" } - end - if value == "all" or value == true then - for name, value in next, dimensions do - overload(value) - end - else - if type(value) == "string" then - value = utilities.parsers.settings_to_array(value) - end - if type(value) == "table" then - for i=1,#value do - local d = dimensions[value[i]] - if d then - overload(d) - end - end - end - end - end - end - end -end +-- local function withscriptcode(tfmdata,unicode,data,action) +-- if type(unicode) == "string" then +-- local p, u = match(unicode,"^(.-):(.-)$") +-- if u then +-- u = tonumber(u) +-- if u then +-- local slots = fonts.helpers.mathscriptslots(tfmdata,u) +-- if slots then +-- if p == "*" then +-- action(u,data) +-- for i=1,#slots do +-- action(slots[i],data) +-- end +-- else +-- p = tonumber(p) +-- if p then +-- action(slots[p],data) +-- end +-- end +-- end +-- end +-- end +-- else +-- action(unicode,data) +-- end +-- end -registerotffeature { - name = "mathdimensions", - description = "manipulate math dimensions", - -- default = true, - manipulators = { - base = finalize, - node = finalize, - } -} +-- local function finalize(tfmdata,feature,value) +-- -- if tfmdata.mathparameters then -- funny, cambria text has this +-- local goodies = tfmdata.goodies +-- if goodies then +-- local virtualized = mathematics.virtualized +-- for i=1,#goodies do +-- local goodie = goodies[i] +-- local mathematics = goodie.mathematics +-- local dimensions = mathematics and mathematics.dimensions +-- if dimensions then +-- if trace_defining then +-- report_math("overloading dimensions in %a @ %p",tfmdata.properties.fullname,tfmdata.parameters.size) +-- end +-- local characters = tfmdata.characters +-- local descriptions = tfmdata.descriptions +-- local parameters = tfmdata.parameters +-- local factor = parameters.factor +-- local hfactor = parameters.hfactor +-- local vfactor = parameters.vfactor +-- local function overloadone(unicode,data) +-- local character = characters[unicode] +-- if not character then +-- local c = virtualized[unicode] +-- if c then +-- character = characters[c] +-- end +-- end +-- if character then +-- local width = data.width +-- local height = data.height +-- local depth = data.depth +-- if trace_defining and (width or height or depth) then +-- report_math("overloading dimensions of %C, width %p, height %p, depth %p", +-- unicode,width or 0,height or 0,depth or 0) +-- end +-- if width then character.width = width * hfactor end +-- if height then character.height = height * vfactor end +-- if depth then character.depth = depth * vfactor end +-- -- +-- local xoffset = data.xoffset +-- local yoffset = data.yoffset +-- if xoffset == "llx" then +-- local d = descriptions[unicode] +-- if d then +-- xoffset = - d.boundingbox[1] * hfactor +-- character.width = character.width + xoffset +-- xoffset = rightcommand[xoffset] +-- else +-- xoffset = nil +-- end +-- elseif xoffset and xoffset ~= 0 then +-- xoffset = rightcommand[xoffset * hfactor] +-- else +-- xoffset = nil +-- end +-- if yoffset and yoffset ~= 0 then +-- yoffset = upcommand[yoffset * vfactor] +-- else +-- yoffset = nil +-- end +-- if xoffset or yoffset then +-- local commands = character.commands +-- if commands then +-- prependcommands(commands,yoffset,xoffset) +-- else +-- local slot = charcommand[unicode] +-- if xoffset and yoffset then +-- character.commands = { xoffset, yoffset, slot } +-- elseif xoffset then +-- character.commands = { xoffset, slot } +-- else +-- character.commands = { yoffset, slot } +-- end +-- end +-- end +-- elseif trace_defining then +-- report_math("no overloading dimensions of %C, not in font",unicode) +-- end +-- end +-- local function overload(dimensions) +-- for unicode, data in next, dimensions do +-- withscriptcode(tfmdata,unicode,data,overloadone) +-- end +-- end +-- if value == nil then +-- value = { "default" } +-- end +-- if value == "all" or value == true then +-- for name, value in next, dimensions do +-- overload(value) +-- end +-- else +-- if type(value) == "string" then +-- value = utilities.parsers.settings_to_array(value) +-- end +-- if type(value) == "table" then +-- for i=1,#value do +-- local d = dimensions[value[i]] +-- if d then +-- overload(d) +-- end +-- end +-- end +-- end +-- end +-- end +-- end +-- end +-- +-- registerotffeature { +-- name = "mathdimensions", +-- description = "manipulate math dimensions", +-- -- default = true, +-- manipulators = { +-- base = finalize, +-- node = finalize, +-- } +-- } local function initialize(goodies) local mathgoodies = goodies.mathematics @@ -222,119 +222,117 @@ fontgoodies.register("mathematics", initialize) -- local enabled = false directives.register("fontgoodies.mathkerning",function(v) enabled = v end) -local function initialize(tfmdata) --- if enabled and tfmdata.mathparameters then -- funny, cambria text has this - if tfmdata.mathparameters then -- funny, cambria text has this - local goodies = tfmdata.goodies - if goodies then - local characters = tfmdata.characters - if characters[0x1D44E] then -- 119886 - -- we have at least an italic a - for i=1,#goodies do - local mathgoodies = goodies[i].mathematics - if mathgoodies then - local kerns = mathgoodies.kerns - if kerns then - local function kernone(unicode,data) - local chardata = characters[unicode] - if chardata and (not chardata.mathkerns or data.force) then - chardata.mathkerns = data - end - end - for unicode, data in next, kerns do - withscriptcode(tfmdata,unicode,data,kernone) - end - return - end - end - end - else - return -- no proper math font anyway - end - end - end -end - -registerotffeature { - name = "mathkerns", - description = "math kerns", - -- default = true, - initializers = { - base = initialize, - node = initialize, - } -} - --- math italics (not really needed) +-- local function initialize(tfmdata) +-- -- if enabled and tfmdata.mathparameters then -- funny, cambria text has this +-- if tfmdata.mathparameters then -- funny, cambria text has this +-- local goodies = tfmdata.goodies +-- if goodies then +-- local characters = tfmdata.characters +-- if characters[0x1D44E] then -- 119886 +-- -- we have at least an italic a +-- for i=1,#goodies do +-- local mathgoodies = goodies[i].mathematics +-- if mathgoodies then +-- local kerns = mathgoodies.kerns +-- if kerns then +-- local function kernone(unicode,data) +-- local chardata = characters[unicode] +-- if chardata and (not chardata.mathkerns or data.force) then +-- chardata.mathkerns = data +-- end +-- end +-- for unicode, data in next, kerns do +-- withscriptcode(tfmdata,unicode,data,kernone) +-- end +-- return +-- end +-- end +-- end +-- else +-- return -- no proper math font anyway +-- end +-- end +-- end +-- end -- --- it would be nice to have a \noitalics\font option +-- registerotffeature { +-- name = "mathkerns", +-- description = "math kerns", +-- -- default = true, +-- initializers = { +-- base = initialize, +-- node = initialize, +-- } +-- } -local function initialize(tfmdata) - local goodies = tfmdata.goodies - if goodies then - local shared = tfmdata.shared - for i=1,#goodies do - local mathgoodies = goodies[i].mathematics - if mathgoodies then - local mathitalics = mathgoodies.italics - if mathitalics then - local properties = tfmdata.properties - if properties.setitalics then - mathitalics = mathitalics[file.nameonly(properties.name)] or mathitalics - if mathitalics then - if trace_goodies then - report_goodies("loading mathitalics for font %a",properties.name) - end - local corrections = mathitalics.corrections - local defaultfactor = mathitalics.defaultfactor - -- properties.mathitalic_defaultfactor = defaultfactor -- we inherit outer one anyway (name will change) - if corrections then - fontgoodies.registerpostprocessor(tfmdata, function(tfmdata) -- this is another tfmdata (a copy) - -- better make a helper so that we have less code being defined - local properties = tfmdata.properties - local parameters = tfmdata.parameters - local characters = tfmdata.characters - properties.mathitalic_defaultfactor = defaultfactor - properties.mathitalic_defaultvalue = defaultfactor * parameters.quad - if trace_goodies then - report_goodies("assigning mathitalics for font %a",properties.name) - end - local quad = parameters.quad - local hfactor = parameters.hfactor - for k, v in next, corrections do - local c = characters[k] - if c then - if v > -1 and v < 1 then - c.italic = v * quad - else - c.italic = v * hfactor - end - else - report_goodies("invalid mathitalics entry %U for font %a",k,properties.name) - end - end - end) - end - return -- maybe not as these can accumulate - end - end - end - end - end - end -end - -registerotffeature { - name = "mathitalics", - description = "additional math italic corrections", - -- default = true, - initializers = { - base = initialize, - node = initialize, - } -} - --- fontgoodies.register("mathitalics", initialize) +-- -- math italics (not really needed) +-- -- +-- -- it would be nice to have a \noitalics\font option +-- +-- local function initialize(tfmdata) +-- local goodies = tfmdata.goodies +-- if goodies then +-- local shared = tfmdata.shared +-- for i=1,#goodies do +-- local mathgoodies = goodies[i].mathematics +-- if mathgoodies then +-- local mathitalics = mathgoodies.italics +-- if mathitalics then +-- local properties = tfmdata.properties +-- if properties.setitalics then +-- mathitalics = mathitalics[file.nameonly(properties.name)] or mathitalics +-- if mathitalics then +-- if trace_goodies then +-- report_goodies("loading mathitalics for font %a",properties.name) +-- end +-- local corrections = mathitalics.corrections +-- local defaultfactor = mathitalics.defaultfactor +-- -- properties.mathitalic_defaultfactor = defaultfactor -- we inherit outer one anyway (name will change) +-- if corrections then +-- fontgoodies.registerpostprocessor(tfmdata, function(tfmdata) -- this is another tfmdata (a copy) +-- -- better make a helper so that we have less code being defined +-- local properties = tfmdata.properties +-- local parameters = tfmdata.parameters +-- local characters = tfmdata.characters +-- properties.mathitalic_defaultfactor = defaultfactor +-- properties.mathitalic_defaultvalue = defaultfactor * parameters.quad +-- if trace_goodies then +-- report_goodies("assigning mathitalics for font %a",properties.name) +-- end +-- local quad = parameters.quad +-- local hfactor = parameters.hfactor +-- for k, v in next, corrections do +-- local c = characters[k] +-- if c then +-- if v > -1 and v < 1 then +-- c.italic = v * quad +-- else +-- c.italic = v * hfactor +-- end +-- else +-- report_goodies("invalid mathitalics entry %U for font %a",k,properties.name) +-- end +-- end +-- end) +-- end +-- return -- maybe not as these can accumulate +-- end +-- end +-- end +-- end +-- end +-- end +-- end +-- +-- registerotffeature { +-- name = "mathitalics", +-- description = "additional math italic corrections", +-- -- default = true, +-- initializers = { +-- base = initialize, +-- node = initialize, +-- } +-- } local function mathradicalaction(n,h,v,font,mchar,echar) local characters = fontcharacters[font] diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua index ebed9aec6..2bc485ff1 100644 --- a/tex/context/base/mkiv/lpdf-ano.lua +++ b/tex/context/base/mkiv/lpdf-ano.lua @@ -108,6 +108,10 @@ local pdf_named = pdfconstant("Named") local autoprefix = "#" local usedautoprefixes = { } +function codeinjections.setautoprefix(prefix) + autoprefix = prefix ~= "" and prefix or autoprefix +end + local function registerautoprefix(name) local internal = autoprefix .. name if usedautoprefixes[internal] == nil then diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua index 5aa3f0ff0..a77fdc020 100644 --- a/tex/context/base/mkiv/math-act.lua +++ b/tex/context/base/mkiv/math-act.lua @@ -6,10 +6,13 @@ if not modules then modules = { } end modules ['math-act'] = { license = "see context related readme files" } --- Here we tweak some font properties (if needed). +-- Here we tweak some font properties (if needed). Per mid octover 2022 we also provide +-- an lmtx emulation mode which means that we removed some other code. Some of that was +-- experimental, some transitional, some is now obsolete). Using emulation mode also +-- means that we are unlikely to test some aspects of the math engines extensively. local type, next = type, next -local fastcopy, insert, remove = table.fastcopy, table.insert, table.remove +local fastcopy, insert, remove, copytable = table.fastcopy, table.insert, table.remove, table.copy local formatters = string.formatters local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) @@ -75,41 +78,43 @@ local how = { NoLimitSubFactor = "unscaled", } -function mathematics.scaleparameters(target,original) - if not target.properties.math_is_scaled then - local mathparameters = target.mathparameters - if mathparameters and next(mathparameters) then - local parameters = target.parameters - local factor = parameters.factor - local hfactor = parameters.hfactor - local vfactor = parameters.vfactor - for name, value in next, mathparameters do - local h = how[name] - if h == "unscaled" then - -- kept - elseif h == "horizontal" then - value = value * hfactor - elseif h == "vertical"then - value = value * vfactor - else - value = value * factor - end - mathparameters[name] = value +local function scaleparameters(mathparameters,parameters) + if mathparameters and next(mathparameters) and parameters then + local factor = parameters.factor + local hfactor = parameters.hfactor + local vfactor = parameters.vfactor + for name, value in next, mathparameters do + local h = how[name] + if h == "unscaled" then + -- kept + elseif h == "horizontal" then + value = value * hfactor + elseif h == "vertical"then + value = value * vfactor + else + value = value * factor end + mathparameters[name] = value end - target.properties.math_is_scaled = true end end --- AccentBaseHeight vs FlattenedAccentBaseHeight - -function mathematics.checkaccentbaseheight(target,original) - local mathparameters = target.mathparameters - if mathparameters and mathparameters.AccentBaseHeight == 0 then - mathparameters.AccentBaseHeight = target.parameters.x_height -- needs checking +function mathematics.scaleparameters(target,original) + if not target.properties.math_is_scaled then + scaleparameters(target.mathparameters,target.parameters) + target.properties.math_is_scaled = true end end +-- -- AccentBaseHeight vs FlattenedAccentBaseHeight +-- +-- function mathematics.checkaccentbaseheight(target,original) +-- local mathparameters = target.mathparameters +-- if mathparameters and mathparameters.AccentBaseHeight == 0 then +-- mathparameters.AccentBaseHeight = target.parameters.x_height -- needs checking +-- end +-- end + function mathematics.checkprivateparameters(target,original) local mathparameters = target.mathparameters if mathparameters then @@ -180,29 +185,65 @@ function mathematics.overloadparameters(target,original) end end +local mathtweaks = { subsets = table.setmetatableindex("table") } +mathematics.tweaks = mathtweaks + +local apply_tweaks = true + +directives.register("math.applytweaks", function(v) + apply_tweaks = v; +end) + local function applytweaks(when,target,original) - local goodies = original.goodies - if goodies then - for i=1,#goodies do - local goodie = goodies[i] - local mathematics = goodie.mathematics - local tweaks = mathematics and mathematics.tweaks - if type(tweaks) == "table" then - tweaks = tweaks[when] - if type(tweaks) == "table" then - if trace_defining then - report_math("tweaking math of %a @ %p (%s)",target.properties.fullname,target.parameters.size,when) - end - for i=1,#tweaks do - local tweak= tweaks[i] - local tvalue = type(tweak) - if tvalue == "function" then - tweak(target,original) + if apply_tweaks then + local goodies = original.goodies + if goodies then + local tweaked = target.tweaked or { } + if tweaked[when] then + if trace_defining then + report_math("tweaking math of %a @ %p (%s: %s)",target.properties.fullname,target.parameters.size,when,"done") + end + else + for i=1,#goodies do + local goodie = goodies[i] + local mathematics = goodie.mathematics + local tweaks = mathematics and mathematics.tweaks + if type(tweaks) == "table" then + tweaks = tweaks[when] + if type(tweaks) == "table" then + if trace_defining then + report_math("tweaking math of %a @ %p (%s: %s)",target.properties.fullname,target.parameters.size,when,"okay") + end + for i=1,#tweaks do + local tweak = tweaks[i] + local tvalue = type(tweak) + if type(tweak) == "table" then + local action = mathtweaks[tweak.tweak or ""] + if action then + local feature = tweak.feature + local features = target.specification.features.normal + if not feature or features[feature] == true then + local version = tweak.version + if version and version ~= target.tweakversion then + report_math("skipping tweak %a version %a",tweak.tweak,version) + elseif original then + action(target,original,tweak) + else + action(target,tweak) + end + end + end + end + end end end end + tweaked[when] = true + target.tweaked = tweaked end end + else + report_math("not tweaking math of %a @ %p (%s)",target.properties.fullname,target.parameters.size,when) end end @@ -222,118 +263,130 @@ end sequencers.appendaction("mathparameters","system","mathematics.overloadparameters") sequencers.appendaction("mathparameters","system","mathematics.scaleparameters") -sequencers.appendaction("mathparameters","system","mathematics.checkaccentbaseheight") -- should go in lfg instead +----------.appendaction("mathparameters","system","mathematics.checkaccentbaseheight") -- should go in lfg instead sequencers.appendaction("mathparameters","system","mathematics.checkprivateparameters") -- after scaling ! sequencers.appendaction("beforecopyingcharacters","system","mathematics.tweakbeforecopyingfont") sequencers.appendaction("aftercopyingcharacters", "system","mathematics.tweakaftercopyingfont") --- no, it's a feature now (see good-mth): --- --- sequencers.appendaction("aftercopyingcharacters", "system","mathematics.overloaddimensions") - --- a couple of predefined tweaks: - -local tweaks = { subsets = { } } -mathematics.tweaks = tweaks - --- function tweaks.fixbadprime(target,original) --- target.characters[0xFE325] = target.characters[0x2032] --- end - --- these could go to math-fbk - --- local virtualized = mathematics.virtualized --- --- local function accent_to_extensible(target,newchr,original,oldchr,height,depth,swap) --- local characters = target.characters --- -- if not characters[newchr] then -- xits needs an enforce --- local addprivate = fonts.helpers.addprivate --- local olddata = characters[oldchr] --- if olddata then --- if swap then --- swap = characters[swap] --- height = swap.depth --- depth = 0 --- else --- height = height or 0 --- depth = depth or 0 --- end --- local correction = swap and { "down", (olddata.height or 0) - height } or { "down", olddata.height } --- local newdata = { --- commands = { correction, { "slot", 1, oldchr } }, --- width = olddata.width, --- height = height, --- depth = depth, --- } --- characters[newchr] = newdata --- local nextglyph = olddata.next --- while nextglyph do --- local oldnextdata = characters[nextglyph] --- local newnextdata = { --- commands = { correction, { "slot", 1, nextglyph } }, --- width = oldnextdata.width, --- height = height, --- depth = depth, --- } --- local newnextglyph = addprivate(target,formatters["original-%H"](nextglyph),newnextdata) --- newdata.next = newnextglyph --- local nextnextglyph = oldnextdata.next --- if nextnextglyph == nextglyph then --- break --- else --- olddata = oldnextdata --- newdata = newnextdata --- nextglyph = nextnextglyph --- end --- end --- local hv = olddata.horiz_variants --- if hv then --- hv = fastcopy(hv) --- newdata.horiz_variants = hv --- for i=1,#hv do --- local hvi = hv[i] --- local oldglyph = hvi.glyph --- local olddata = characters[oldglyph] --- local newdata = { --- commands = { correction, { "slot", 1, oldglyph } }, --- width = olddata.width, --- height = height, --- depth = depth, --- } --- hvi.glyph = addprivate(target,formatters["original-%H"](oldglyph),newdata) --- end --- end --- end --- -- end --- end - --- function tweaks.fixoverline(target,original) --- local height, depth = 0, 0 --- local mathparameters = target.mathparameters --- if mathparameters then --- height = mathparameters.OverbarVerticalGap --- depth = mathparameters.UnderbarVerticalGap --- else --- height = target.parameters.xheight/4 --- depth = height --- end --- accent_to_extensible(target,0x203E,original,0x0305,height,depth) --- -- also crappy spacing for our purpose: push to top of baseline --- accent_to_extensible(target,0xFE3DE,original,0x23DE,height,depth,0x23DF) --- accent_to_extensible(target,0xFE3DC,original,0x23DC,height,depth,0x23DD) --- accent_to_extensible(target,0xFE3B4,original,0x23B4,height,depth,0x23B5) --- -- for symmetry --- target.characters[0xFE3DF] = original.characters[0x23DF] --- target.characters[0xFE3DD] = original.characters[0x23DD] --- target.characters[0xFE3B5] = original.characters[0x23B5] --- -- inspect(fonts.helpers.expandglyph(target.characters,0x203E)) --- -- inspect(fonts.helpers.expandglyph(target.characters,0x23DE)) --- end +do + + -- More than a year of testing, development, tweaking (and improving) fonts has resulted + -- in a math engine in \LUAMETATEX\ that is quite flexible. Basically we can drop italic + -- correction there. In \MKIV\ we can emulate this to some extend but we still need a bit + -- of mix because \LUAMETATEX\ lacks some features. A variant of the tweak below is now + -- also used in the plain code we ship. In \MKIV\ we dropped a few features that were a + -- prelude to this and, because most users switched to \LMTX, it is unlikely that other + -- tweaks wil be backported. There is also no need to adapt \LUATEX\ and eventually all + -- italic code might be removed from \LUAMETATEX\ (unless we want to be able to test the + -- alternative; I can live with a little ballast, especially because it took time to load + -- it). + + local italics = nil + local integrals = table.tohash { + 0x0222B, 0x0222C, 0x0222D, 0x0222E, 0x0222F, 0x02230, 0x02231, 0x02232, 0x02233, + 0x02A0B, 0x02A0C, 0x02A0D, 0x02A0E, 0x02A0F, 0x02A10, 0x02A11, 0x02A12, 0x02A13, + 0x02A14, 0x02A15, 0x02A16, 0x02A17, 0x02A18, 0x02A19, 0x02A1A, 0x02A1B, 0x02A1C, + 0x02320, 0x02321 + } + + function mathtweaks.emulatelmtx(target,original,parameters) + -- gaps are not known yet + if not italic then + italics = { } + local gaps = mathematics.gaps + for name, data in next, characters.blocks do + if data.math and data.italic then + for i=data.first,data.last do + italics[i] = true + local g = gaps[i] + if g then + italics[g] = true + end + end + end + end +-- table.save("temp.log", table.sortedkeys(italics)) + end + -- + local targetcharacters = target.characters + local targetdescriptions = target.descriptions + local factor = target.parameters.factor + local function getllx(u) + local d = targetdescriptions[u] + if d then + local b = d.boundingbox + if b then + local llx = b[1] + if llx < 0 then + return - llx + end + end + end + return false + end + -- beware: here we also do the weird ones + for u, c in next, targetcharacters do + local uc = c.unicode or u + if integrals[uc] then + -- skip this one + else + local accent = c.top_accent + local italic = c.italic + local width = c.width or 0 + local llx = getllx(u) + local bl, br, tl, tr + if llx then + llx = llx * factor + width = width + llx + bl = - llx + tl = bl + c.commands = { rightcommand[llx], charcommand[u] } + if accent then + accent = accent + llx + end + end + if accent then + if italics[uc] then + c.top_accent = accent + else + c.top_accent = nil + end + end + if italic and italic ~= 0 then + width = width + italic + br = - italic + end + c.width = width + if italic then + c.italic = nil + end + if bl or br or tl or tr then + -- watch out: singular and _ because we are post copying / scaling + c.mathkern = { + bottom_left = bl and { { height = 0, kern = bl } } or nil, + bottom_right = br and { { height = 0, kern = br } } or nil, + top_left = tl and { { height = c.height or 0, kern = tl } } or nil, + top_right = tr and { { height = c.height or 0, kern = tr } } or nil, + } + end + end + end + end --- sequencers.appendaction("aftercopyingcharacters", "system","mathematics.tweaks.fixoverline") -- for the moment always + function mathtweaks.parameters(target,original,parameters) + local newparameters = parameters.list + local oldparameters = target.mathparameters + if newparameters and oldparameters then + newparameters = copytable(newparameters) + scaleparameters(newparameters,target.parameters) + for name, newvalue in next, newparameters do + oldparameters[name] = newvalue + end + end + end --- helpers +end local setmetatableindex = table.setmetatableindex @@ -467,87 +520,6 @@ interfaces.implement { end } --- experiment - --- check: when true, only set when present in font --- force: when false, then not set when already set - --- todo: tounicode - --- function mathematics.injectfallbacks(target,original) --- local properties = original.properties --- if properties and properties.hasmath then --- local specification = target.specification --- if specification then --- local fallbacks = specification.fallbacks --- if fallbacks then --- local definitions = fonts.collections.definitions[fallbacks] --- if definitions then --- if trace_collecting then --- report_math("adding fallback characters to font %a",specification.hash) --- end --- local definedfont = fonts.definers.internal --- local copiedglyph = fonts.handlers.vf.math.copy_glyph --- local fonts = target.fonts --- local size = specification.size -- target.size --- local characters = target.characters --- if not fonts then --- fonts = { } --- target.fonts = fonts --- if not CONTEXTLMTXMODE or CONTEXTLMTXMODE == 0 then --- target.type = "virtual" --- target.properties.virtualized = true --- end --- end --- if #fonts == 0 then --- fonts[1] = { id = 0, size = size } -- sel, will be resolved later --- end --- local done = { } --- for i=1,#definitions do --- local definition = definitions[i] --- local name = definition.font --- local start = definition.start --- local stop = definition.stop --- local gaps = definition.gaps --- local check = definition.check --- local force = definition.force --- local rscale = definition.rscale or 1 --- local offset = definition.offset or start --- local id = definedfont { name = name, size = size * rscale } --- local index = #fonts + 1 --- fonts[index] = { id = id, size = size } --- local chars = fontchars[id] --- local function remap(unic,unicode,gap) --- -- local unic = unicode + offset - start --- if check and not chars[unicode] then --- -- not in font --- elseif force or (not done[unic] and not characters[unic]) then --- if trace_collecting then --- report_math("remapping math character, vector %a, font %a, character %C%s%s", --- fallbacks,name,unic,check and ", checked",gap and ", gap plugged") --- end --- characters[unic] = copiedglyph(target,characters,chars,unicode,index) --- done[unic] = true --- end --- end --- for unicode = start, stop do --- local unic = unicode + offset - start --- remap(unic,unicode,false) --- end --- if gaps then --- for unic, unicode in next, gaps do --- remap(unic,unicode,true) --- end --- end --- end --- end --- end --- end --- end --- end --- --- sequencers.appendaction("aftercopyingcharacters", "system","mathematics.finishfallbacks") - local stack = { } function mathematics.registerfallbackid(n,id,name) diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua index 221bbff89..f282005fc 100644 --- a/tex/context/base/mkiv/math-vfu.lua +++ b/tex/context/base/mkiv/math-vfu.lua @@ -699,7 +699,7 @@ local function copy_glyph(main,target,original,unicode,slot) vvi.glyph = addprivate(main,formatters["M-V-%H"](oldglyph),newdata) end end - return newdata + return glyphdata end end diff --git a/tex/context/base/mkiv/scrn-ini.lua b/tex/context/base/mkiv/scrn-ini.lua index bf7afccb6..9c9a9f1b4 100644 --- a/tex/context/base/mkiv/scrn-ini.lua +++ b/tex/context/base/mkiv/scrn-ini.lua @@ -41,3 +41,11 @@ interfaces.implement { } } } + +interfaces.implement { + name = "setautoprefix", + actions = function(prefix) + backends.codeinjections.setautoprefix(prefix) + end, + arguments = "string", +} diff --git a/tex/context/base/mkiv/scrn-ini.mkvi b/tex/context/base/mkiv/scrn-ini.mkvi index 39fef740c..4651956a5 100644 --- a/tex/context/base/mkiv/scrn-ini.mkvi +++ b/tex/context/base/mkiv/scrn-ini.mkvi @@ -251,4 +251,8 @@ \c!keyword=, \c!date=] +\appendtoks + \clf_setautoprefix{\interactionparameter\c!prefix}% +\to \everysetupinteraction + \protect \endinput diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex a51e3ea39..66cc6048a 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 8c4219a01..e798b7a58 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua index 4a190132b..41d09f073 100644 --- a/tex/context/base/mkiv/strc-lst.lua +++ b/tex/context/base/mkiv/strc-lst.lua @@ -98,7 +98,10 @@ local v_reference = variables.reference local v_local = variables["local"] local v_default = variables.default --- for the moment not public -- +local cheats = { + [variables.fit] = true, + [variables.tight] = true, +} local function zerostrippedconcat(t,separator) local f = 1 @@ -196,7 +199,7 @@ local function finalizer() local i = r.internal local f = flaginternals[i] local v = usedviews[i] - if cheat and v then + if cheat and v and cheats[v] then -- cheats check added, to be tested by RKB -- this permits runs=2 with interactivity r.view = v end diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index bb6268f4a..2950090ea 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.10.15 10:32} +\newcontextversion{2022.10.21 21:11} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index c322164c3..c5baad13d 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2022.10.15 10:32} +\immutable\edef\contextversion{2022.10.21 21:11} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-ini.lmt b/tex/context/base/mkxl/driv-ini.lmt index 8b6c2e5ff..c43bf2a83 100644 --- a/tex/context/base/mkxl/driv-ini.lmt +++ b/tex/context/base/mkxl/driv-ini.lmt @@ -30,6 +30,8 @@ local shipout = tex.shipout local texgetbox = tex.getbox local texgetcount = tex.getcount +local c_realpageno = tex.iscount("realpageno") + function converters.engine(driver,boxnumber,mode,number,specification) return shipout(boxnumber) end @@ -204,7 +206,7 @@ function drivers.convert(boxnumber) if currentinstance then callbacks.functions.start_page_number() starttiming(drivers) - convert(currentinstance,boxnumber,texgetcount("realpageno")) + convert(currentinstance,boxnumber,texgetcount(c_realpageno)) stoptiming(drivers) callbacks.functions.stop_page_number() end diff --git a/tex/context/base/mkxl/font-col.mklx b/tex/context/base/mkxl/font-col.mklx index 0e2f302b2..bd099bbe9 100644 --- a/tex/context/base/mkxl/font-col.mklx +++ b/tex/context/base/mkxl/font-col.mklx @@ -95,18 +95,18 @@ % math (experiment, todo clf_) -\def\font_fallbacks_register_math#1#2#3#4% - {\doifelsenothing{#3}% - {\definedfont[#2 at #4\scaledpoint]}% - {\definedfont[#2*#3\space at #4\scaledpoint]}% - \clf_registerfontfallbackid#1\space\fontid\font\space{#2}} - % \def\font_fallbacks_register_math#1#2#3#4% -% {\definedfont[#2\iftok{#3}\emptytoks\else*#3 \fi at #4\scaledpoint]% +% {\doifelsenothing{#3}% +% {\definedfont[#2 at #4\scaledpoint]}% +% {\definedfont[#2*#3\space at #4\scaledpoint]}% % \clf_registerfontfallbackid#1\space\fontid\font\space{#2}} -% \def\font_fallbacks_finish_math -% {\ctxlua{mathematics.finishfallbacks()}} +% % % \def\font_fallbacks_register_math#1#2#3#4% +% % % {\definedfont[#2\iftok{#3}\emptytoks\else*#3 \fi at #4\scaledpoint]% +% % % \clf_registerfontfallbackid#1\space\fontid\font\space{#2}} +% % % +% % % \def\font_fallbacks_finish_math +% % % {\ctxlua{mathematics.finishfallbacks()}} % check : only replace when present in replacement font (default: no) % force : force replacent even when basefont has glyph (default: yes) diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt index 319d5fe48..2e32193e9 100644 --- a/tex/context/base/mkxl/font-con.lmt +++ b/tex/context/base/mkxl/font-con.lmt @@ -445,7 +445,7 @@ function constructors.scale(tfmdata,specification) local hasquality = parameters.expansion or parameters.protrusion local hasitalics = properties.hasitalics local autoitalicamount = properties.autoitalicamount - local stackmath = not properties.nostackmath + -- local stackmath = not properties.nostackmath local haskerns = properties.haskerns or properties.mode == "base" -- we can have afm in node mode local hasligatures = properties.hasligatures or properties.mode == "base" -- we can have afm in node mode local realdimensions = properties.realdimensions @@ -720,7 +720,8 @@ function constructors.scale(tfmdata,specification) -- if vo then -- chr.bottomovershoot = vo*hdelta -- end - if stackmath then -- not ok yet + -- + -- if stackmath then -- not ok yet local mk = character.mathkerns if mk then local tr = mk.topright @@ -734,7 +735,8 @@ function constructors.scale(tfmdata,specification) bottomleft = bl and mathkerns(bl,vdelta) or nil, } end - end + -- end + -- if hasitalics then local vi = character.italic if vi and vi ~= 0 then diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt index 75572e089..83c0a912b 100644 --- a/tex/context/base/mkxl/font-ctx.lmt +++ b/tex/context/base/mkxl/font-ctx.lmt @@ -90,6 +90,7 @@ local setsubtype = nuts.setsubtype local texgetdimen = tex.getdimen local texsetcount = tex.setcount +local texiscount = tex.iscount local texget = tex.get local texdefinefont = tex.definefont @@ -1119,12 +1120,16 @@ local specifiers = { } do -- else too many locals - local starttiming = statistics.starttiming - local stoptiming = statistics.stoptiming + local starttiming = statistics.starttiming + local stoptiming = statistics.stoptiming - local setmacro = tokens.setters.macro - local ctxcatcodes = tex.ctxcatcodes - local texconditionals = tex.conditionals + local setmacro = tokens.setters.macro + local ctxcatcodes = tex.ctxcatcodes + local texconditionals = tex.conditionals + + local c_scaledfontmode = texiscount("scaledfontmode") + local c_scaledfontsize = texiscount("scaledfontsize") + local c_lastfontid = texiscount("lastfontid") local reported = setmetatableindex(function(t,k) local v = setmetatableindex(function(t,k) @@ -1166,7 +1171,7 @@ do -- else too many locals local mode, fontsize, sx, sy = lpegmatch(sizepattern,size) -- print(size,mode,fontsize,sx,sy) if mode and fontsize and fontsize ~= "" then - texsetcount("scaledfontmode",mode) + texsetcount(c_scaledfontmode,mode) -- ctx_setsomefontsize(fontsize) -- We use a catcodetable, just in case it's 1.2\exheight (a corner case that showed -- up in the lmtx manual: marking that changed size in the mids of some verbatim). @@ -1178,15 +1183,15 @@ do -- else too many locals setmacro("somefontsizey",sy) end else - texsetcount("scaledfontmode",0) + texsetcount(c_scaledfontmode,0) -- ctx_setemptyfontsize() end elseif true then -- so we don't need to check in tex - texsetcount("scaledfontmode",2) + texsetcount(c_scaledfontmode,2) -- ctx_setemptyfontsize() else - texsetcount("scaledfontmode",0) + texsetcount(c_scaledfontmode,0) -- ctx_setemptyfontsize() end specification = definers.makespecification(str,lookup,name,sub,method,detail,size) @@ -1374,99 +1379,36 @@ do -- else too many locals local properties = tfmdata.properties -- we use char0 as signal; cf the spec pdf can handle this (no char in slot) characters[0] = nil - -- characters[0x00A0] = { width = parameters.space } - -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure - -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period - -- - local fallbacks = specification.fallbacks or "" - local mathsize = (mathsize == 1 or mathsize == 2 or mathsize == 3) and mathsize or nil -- can be unset so we test 1 2 3 - if fallbacks ~= "" and mathsize and not busy then - busy = true - -- We need this ugly hack in order to resolve fontnames (at the \TEX end). Originally - -- math was done in Lua after loading (plugged into aftercopying). - -- - -- After tl 2017 I'll also do text fallbacks this way (although backups there are done - -- in a completely different way.) - if trace_defining then - report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", - name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,1) - end - mathematics.resolvefallbacks(tfmdata,specification,fallbacks) - context(function() - -- We're doing math fallbacks. - busy = false - mathematics.finishfallbacks(tfmdata,specification,fallbacks) - tfmdata.original = specification.specification - constructors.beforepassingfonttotex(tfmdata) - local id = definefont(tfmdata,properties.id) - csnames[id] = specification.cs - properties.id = id -- already set - definers.register(tfmdata,id) -- to be sure, normally already done - texdefinefont(global,cs,id) - -- texdefinefont(cs,id,global and "global") - constructors.finalize(tfmdata) - if trace_defining then - report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", - name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,2) - end - -- resolved (when designsize is used): - local size = round(tfmdata.parameters.size or 655360) - setmacro("somefontsize",size.."sp") - -- ctx_setsomefontsize(size .. "sp") - texsetcount("scaledfontsize",size) - lastfontid = id - -- - if trace_defining then - report_defining("memory usage after: %s",statistics.memused()) - report_defining("stop stage two") - end - -- - texsetcount("global","lastfontid",lastfontid) - specifiers[lastfontid] = { str, size } - if not mathsize then - -- forget about it (can't happen here) - elseif mathsize == 0 then - -- can't happen (here) - else - -- maybe only 1 2 3 (we already test for this) - lastmathids[mathsize] = lastfontid - end - stoptiming(fonts) - end) - return - else - tfmdata.original = specification.specification - local id = definefont(tfmdata,properties.id) - csnames[id] = specification.cs - properties.id = id -- already set - definers.register(tfmdata,id) -- to be sure, normally already done - texdefinefont(global,cs,id) - -- texdefinefont(cs,id,global and "global") - constructors.finalize(tfmdata) - if trace_defining then - report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", - name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-") - end - -- resolved (when designsize is used): - local size = round(tfmdata.parameters.size or 655360) - setmacro("somefontsize",size.."sp") - -- ctx_setsomefontsize(size .. "sp") - texsetcount("scaledfontsize",size) - lastfontid = id + tfmdata.original = specification.specification + local id = definefont(tfmdata,properties.id) + csnames[id] = specification.cs + properties.id = id -- already set + definers.register(tfmdata,id) -- to be sure, normally already done + texdefinefont(global,cs,id) + -- texdefinefont(cs,id,global and "global") + constructors.finalize(tfmdata) + if trace_defining then + report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", + name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,"-") end + -- resolved (when designsize is used): + local size = round(tfmdata.parameters.size or 655360) + setmacro("somefontsize",size.."sp") + texsetcount(c_scaledfontsize,size) + lastfontid = id elseif tfmtype == "number" then if trace_defining then report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a", name,tfmdata,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies,classdesignsize,fontdesignsize) end csnames[tfmdata] = specification.cs +-- \definedfont ends up here texdefinefont(global,cs,tfmdata) -- texdefinefont(cs,tfmdata,global and "global") -- resolved (when designsize is used): local size = round(fontdata[tfmdata].parameters.size or 0) - -- ctx_setsomefontsize(size .. "sp") setmacro("somefontsize",size.."sp") - texsetcount("scaledfontsize",size) + texsetcount(c_scaledfontsize,size) lastfontid = tfmdata else local nice = nice_cs(cs) @@ -1474,7 +1416,7 @@ do -- else too many locals report_defining("unable to define %a as %a",name,nice) end lastfontid = -1 - texsetcount("scaledfontsize",0) + texsetcount(c_scaledfontsize,0) -- ctx_letvaluerelax(cs) -- otherwise the current definition takes the previous one end if trace_defining then @@ -1482,7 +1424,7 @@ do -- else too many locals report_defining("stop stage two") end -- - texsetcount("global","lastfontid",lastfontid) + texsetcount("global",c_lastfontid,lastfontid) specifiers[lastfontid] = { str, size } if not mathsize then -- forget about it @@ -1606,6 +1548,8 @@ do -- else too many locals local n = 0 + local d_bodyfontsize = tex.isdimen("bodyfontsize") + function definers.internal(specification,cs) specification = specification or { } local name = specification.name @@ -1613,7 +1557,7 @@ do -- else too many locals local number = tonumber(specification.number) local id = nil if not size then - size = texgetdimen("bodyfontsize") + size = texgetdimen(d_bodyfontsize) end if number then id = number @@ -1670,6 +1614,8 @@ end -- have delayed definitions and so we never know what style is taken -- as start. +local c_font_scaled_points = texiscount("c_font_scaled_points") + function constructors.calculatescale(tfmdata,scaledpoints,relativeid,specification) local parameters = tfmdata.parameters local units = parameters.units or 1000 @@ -1691,7 +1637,7 @@ function constructors.calculatescale(tfmdata,scaledpoints,relativeid,specificati -- a temp hack till we have upgraded all mechanisms local delta = round(scaledpoints/units) local size = round(scaledpoints) - texsetcount("c_font_scaled_points",size) + texsetcount(c_font_scaled_points,size) -- return size, delta end diff --git a/tex/context/base/mkxl/font-imp-math.lmt b/tex/context/base/mkxl/font-imp-math.lmt index 04fe5c04c..bd445caea 100644 --- a/tex/context/base/mkxl/font-imp-math.lmt +++ b/tex/context/base/mkxl/font-imp-math.lmt @@ -20,56 +20,55 @@ local texconditionals = tex.conditionals -- tfmdata.properties.mathnolimitsmode = tonumber(value) or 0 -local splitter = lpeg.splitat(",",tonumber) -local lpegmatch = lpeg.match - -local function initialize(tfmdata,value) - local mathparameters = tfmdata.mathparameters - if mathparameters then - local sup, sub - if type(value) == "string" then - sup, sub = lpegmatch(splitter,value) -- settings_to_array - if not sup then - sub, sup = 0, 0 - elseif not sub then - sub, sup = sup, 0 - end - elseif type(value) == "number" then - sup, sub = 0, value - end - if sup then - mathparameters.NoLimitSupFactor = sup - end - if sub then - mathparameters.NoLimitSubFactor = sub - end - end -end - -registerotffeature { - name = "mathnolimitsmode", - description = "influence nolimits placement", - initializers = { - base = initialize, - node = initialize, - } -} - - --- this will become a mode in the engine - -local function initialize(tfmdata,value) - tfmdata.properties.nostackmath = value and true -end +-- local splitter = lpeg.splitat(",",tonumber) +-- local lpegmatch = lpeg.match +-- +-- local function initialize(tfmdata,value) +-- local mathparameters = tfmdata.mathparameters +-- if mathparameters then +-- local sup, sub +-- if type(value) == "string" then +-- sup, sub = lpegmatch(splitter,value) -- settings_to_array +-- if not sup then +-- sub, sup = 0, 0 +-- elseif not sub then +-- sub, sup = sup, 0 +-- end +-- elseif type(value) == "number" then +-- sup, sub = 0, value +-- end +-- if sup then +-- mathparameters.NoLimitSupFactor = sup +-- end +-- if sub then +-- mathparameters.NoLimitSubFactor = sub +-- end +-- end +-- end +-- +-- registerotffeature { +-- name = "mathnolimitsmode", +-- description = "influence nolimits placement", +-- initializers = { +-- base = initialize, +-- node = initialize, +-- } +-- } -registerotffeature { - name = "nostackmath", - description = "disable math stacking mechanism", - initializers = { - base = initialize, - node = initialize, - } -} +-- this will become a mode in the engine -- done +-- +-- local function initialize(tfmdata,value) +-- tfmdata.properties.nostackmath = value and true +-- end +-- +-- registerotffeature { +-- name = "nostackmath", +-- description = "disable math stacking mechanism", +-- initializers = { +-- base = initialize, +-- node = initialize, +-- } +-- } -- A quick and dirty and low level implementation but okay for testing: diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 67663b7db..1fab52386 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -667,9 +667,10 @@ \mutable\let\somefontsizex\empty \mutable\let\somefontsizey\empty -\newcount\scaledfontmode % also used at the lua end -\newcount\scaledfontsize % also used at the lua end -\newcount\lastfontid % also used at the lua end / tex end +% \newcount\scaledfontmode % font-lib.mklx +% \newcount\scaledfontsize % font-lib.mklx +% \newcount\lastfontid % font-lib.mklx + \newtoks \everydefinefont \aliased\let\c_font_feature_inheritance_fontnone \zerocount % none @@ -692,13 +693,11 @@ \immutable\dimensiondef\d_font_scaled_default 10pt -\newcount\c_font_future_glyph_scale - % todo: move all to lua: use localcall for resolving filename -\newcount\c_font_future_glyph_scale -\newcount\c_font_scaled_font_mode_saved -\newcount\c_font_scaled_points +% \newcount\c_font_future_glyph_scale % font-lib.mklx +% \newcount\c_font_scaled_font_mode_saved % font-lib.mklx +% \newcount\c_font_scaled_points % font-lib.mklx \mutable\let\somefontspec \empty \mutable\let\lastrawfontcall \relax @@ -1218,7 +1217,7 @@ \ifcsname\??fontenvironments \s!default\s!text \endcsname\lastnamedcs\else \csname\??fontenvironments \s!default \endcsname \fi} -\setvalue{\??fontenvironments\s!default}{1} +\defcsname\??fontenvironments\s!default\endcsname{1} %D In the following macros we use \type {\currentxfontsize} to hold the current %D x||size of the font. This enables us to support for instance \type {\sl} inside a @@ -1313,10 +1312,10 @@ % todo: class:size % todo: make assignments global -\letvalue\??fontenvironments\empty % so we default to empty +\letcsname\??fontenvironments\endcsname\empty % so we default to empty \permanent\def\bodyfontvariable#parameter% - {\csname\??fontenvironments + {\begincsname\??fontenvironments \ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname\fontclass\normalizedbodyfontsize#parameter\orelse \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\orelse \ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname \normalizedbodyfontsize#parameter\orelse @@ -1329,13 +1328,20 @@ \ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname\lastnamedcs\orelse \ifcsname\??fontenvironments\s!default #parameter\endcsname\lastnamedcs\fi} -\permanent\def\bodyfontsizevariable#size#parameter% - {\csname\??fontenvironments - \ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\fontclass#size#parameter\orelse - \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\orelse - \ifcsname\??fontenvironments #size#parameter\endcsname #size#parameter\orelse - \ifcsname\??fontenvironments\s!default #parameter\endcsname\s!default #parameter\fi - \endcsname} +% \permanent\def\bodyfontsizevariable#size#parameter% +% {\begincsname\??fontenvironments +% \ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\fontclass#size#parameter\orelse +% \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\orelse +% \ifcsname\??fontenvironments #size#parameter\endcsname #size#parameter\orelse +% \ifcsname\??fontenvironments\s!default #parameter\endcsname\s!default #parameter\fi +% \endcsname} + +\def\font_bodyfontvariable#parameter% + {\ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname\lastnamedcs\orelse + \ifcsname\??fontenvironments\fontclass #parameter\endcsname\lastnamedcs\orelse + \ifcsname\??fontenvironments\v!all \normalizedbodyfontsize#parameter\endcsname\lastnamedcs\orelse + \ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname\lastnamedcs\orelse + \ifcsname\??fontenvironments\s!default #parameter\endcsname\lastnamedcs\fi} \def\font_bodyfontsizevariable#size#parameter% {\ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\lastnamedcs\orelse @@ -2387,6 +2393,28 @@ }% \gletcsname\??fontbodyfaces\fontbody\endcsname\font_basics_set_faces} +% \permanent\def\currentbodyfontdimension#parameter% there can be factors here +% {\the\dimexpr +% \ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname +% \lastnamedcs +% \orelse\ifcsname\??fontenvironments\fontclass\s!default#parameter\endcsname +% \lastnamedcs +% \dimexpr\normalizedbodyfontsize\relax +% \orelse\ifcsname\??fontenvironments\normalizedbodyfontsize#parameter\endcsname +% \lastnamedcs +% \else +% \csname\??fontenvironments\s!default#parameter\endcsname +% \dimexpr\normalizedbodyfontsize\relax +% \fi +% \relax} + +% \setupbodyfontenvironment [all] [12pt] [x=4pt,small=4pt] +% \setupbodyfontenvironment [pagella] [12pt] [x=4pt,small=4pt] +% +% \setupbodyfont[pagella,12pt] +% +% \starttext normal {\tx tx} {\small small} \stoptext + \permanent\def\currentbodyfontdimension#parameter% there can be factors here {\the\dimexpr \ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname @@ -2394,6 +2422,8 @@ \orelse\ifcsname\??fontenvironments\fontclass\s!default#parameter\endcsname \lastnamedcs \dimexpr\normalizedbodyfontsize\relax + \orelse\ifcsname\??fontenvironments\v!all\normalizedbodyfontsize#parameter\endcsname + \lastnamedcs \orelse\ifcsname\??fontenvironments\normalizedbodyfontsize#parameter\endcsname \lastnamedcs \else diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index f7342c7d4..05367dae8 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -15,6 +15,18 @@ \unprotect +\newcount\scaledfontmode +\newcount\scaledfontsize +\newcount\lastfontid + +\newcount\c_font_future_glyph_scale +\newcount\c_font_scaled_font_mode_saved +\newcount\c_font_scaled_points + +\ifdefined\globalbodyfontsize \else \newdimen\globalbodyfontsize \fi +\ifdefined\localbodyfontsize \else \newdimen\localbodyfontsize \fi +\ifdefined\bodyfontsize \else \newdimen\bodyfontsize \fi + \registerctxluafile{font-ini}{autosuffix} \registerctxluafile{font-log}{} \registerctxluafile{font-con}{autosuffix} % kind of early diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index 8cb0b5b6c..4a7442d10 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -412,13 +412,13 @@ [mode=base, % mode=none, % better, maybe do this last kern=yes, -% flac=yes, % handled differently -% liga=yes, % makes no sense -% mode=node, -% mathnolimitsmode={0,800}, % now in lfg files + % flac=yes, % handled differently + % liga=yes, % makes no sense + % mode=node, + % mathnolimitsmode={0,800}, % now in lfg files mathalternates=yes, - mathitalics=yes, % we pass them - mathdimensions=all, + % mathitalics=yes, % we pass them + % mathdimensions=all, % mathkerns=yes, % staircase=yes, compactmath=yes, @@ -467,10 +467,10 @@ \definefontfeature[math-scriptscript-r2l] [mathematics-r2l] [ssty=2,mathsize=yes] % this will go away: could be a mode in the engine - -\definefontfeature[math-nostack-text] [math-text] [nostackmath=yes] -\definefontfeature[math-nostack-script] [math-script] [nostackmath=yes] -\definefontfeature[math-nostack-scriptscript][math-scriptscript][nostackmath=yes] +% +% \definefontfeature[math-nostack-text] [math-text] [nostackmath=yes] +% \definefontfeature[math-nostack-script] [math-script] [nostackmath=yes] +% \definefontfeature[math-nostack-scriptscript][math-scriptscript][nostackmath=yes] % \definefontfeature[mathtext] [math-text] % \definefontfeature[mathscript] [math-script] @@ -987,11 +987,9 @@ \startsetups experiment:fonts:compact \settrue\c_font_compact - % \definefontfeature[virtualmath] [mathematics] [compactmath=yes] % \definefontfeature[virtualmath-l2r] [mathematics-l2r][compactmath=yes] % \definefontfeature[virtualmath-r2l] [mathematics-r2l][compactmath=yes] - % \definefontfeature[math-text] [mathematics] [compactmath=yes] % \definefontfeature[math-script] [mathematics] [compactmath=yes] % \definefontfeature[math-scriptscript] [mathematics] [compactmath=yes] diff --git a/tex/context/base/mkxl/lpdf-ano.lmt b/tex/context/base/mkxl/lpdf-ano.lmt index e3904f16e..ed26b512e 100644 --- a/tex/context/base/mkxl/lpdf-ano.lmt +++ b/tex/context/base/mkxl/lpdf-ano.lmt @@ -112,6 +112,10 @@ local pdf_named = pdfconstant("Named") local autoprefix = "#" local usedautoprefixes = { } +function codeinjections.setautoprefix(prefix) + autoprefix = prefix ~= "" and prefix or autoprefix +end + local function registerautoprefix(name) local internal = autoprefix .. name if usedautoprefixes[internal] == nil then diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index 7fb4f9b9f..713635583 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -13,7 +13,7 @@ local type, next, tonumber = type, next, tonumber local fastcopy, copytable, insert, remove = table.fastcopy, table.copy, table.insert, table.remove local formatters = string.formatters local byte = string.byte -local setmetatableindex, sortedhash = table.setmetatableindex, table.sortedhash +local setmetatableindex, sortedkeys, sortedhash = table.setmetatableindex, table.sortedkeys, table.sortedhash local lpegmatch = lpeg.match local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) @@ -54,7 +54,8 @@ local fontproperties = fonts.hashes.properties local mathgaps = mathematics.gaps -local use_math_goodies = true directives.register("math.nogoodies", function(v) use_math_goodies = not v end) +local use_math_goodies = true directives.register("math.nogoodies", function(v) use_math_goodies = not v end) +local checkitalics = false trackers .register("math.checkitalics", function(v) checkitalics = v end) local mathfontparameteractions = sequencers.new { name = "mathparameters", @@ -136,40 +137,45 @@ local how = { DelimiterPercent = "unscaled", } -function mathematics.scaleparameters(target,original) - if not target.properties.math_is_scaled then - local mathparameters = target.mathparameters - if mathparameters and next(mathparameters) then - local parameters = target.parameters - local factor = parameters.factor - local hfactor = parameters.hfactor - local vfactor = parameters.vfactor - for name, value in next, mathparameters do - local h = how[name] - if h == "unscaled" then - -- kept - elseif h == "horizontal" then - value = value * hfactor - elseif h == "vertical"then - value = value * vfactor - else - value = value * factor - end - mathparameters[name] = value +local function scaleparameters(mathparameters,parameters) + if mathparameters and next(mathparameters) and parameters then + local factor = parameters.factor + local hfactor = parameters.hfactor + local vfactor = parameters.vfactor + for name, value in next, mathparameters do + local h = how[name] + if h == "unscaled" then + -- kept + elseif h == "horizontal" then + value = value * hfactor + elseif h == "vertical"then + value = value * vfactor + else + value = value * factor end + mathparameters[name] = value end + end +end + +function mathematics.scaleparameters(target,original) + if not target.properties.math_is_scaled then + scaleparameters(target.mathparameters,target.parameters) target.properties.math_is_scaled = true end end -- AccentBaseHeight vs FlattenedAccentBaseHeight -function mathematics.checkaccentbaseheight(target,original) - local mathparameters = target.mathparameters - if mathparameters and mathparameters.AccentBaseHeight == 0 then - mathparameters.AccentBaseHeight = target.parameters.xheight -- needs checking - end -end +-- function mathematics.checkaccentbaseheight(target,original) +-- local mathparameters = target.mathparameters +-- if mathparameters and mathparameters.AccentBaseHeight == 0 then +-- if trace_defining then +-- report_math("zero AccentBaseHeight corrected %a @ %p",target.properties.fullname,target.parameters.size) +-- end +-- mathparameters.AccentBaseHeight = target.parameters.xheight -- needs checking +-- end +-- end function mathematics.overloadparameters(target,original) if use_math_goodies then @@ -183,8 +189,6 @@ function mathematics.overloadparameters(target,original) if mathematics then local parameters = mathematics.parameters local bigslots = mathematics.bigslots or mathematics.bigs --- inspect(parameters) --- print("before",mathparameters.AxisHeight) if parameters then if trace_defining then report_math("overloading math parameters in %a @ %p",target.properties.fullname,target.parameters.size) @@ -207,7 +211,6 @@ function mathematics.overloadparameters(target,original) end mathparameters[name] = newvalue end --- print("after ",mathparameters.AxisHeight) for name, value in next, parameters do local tvalue = type(value) if tvalue == "string" then @@ -250,29 +253,34 @@ local function report_tweak(fmt,target,original,...) local metadata = (original and original.shared.rawdata.metadata) or (target and target .shared.rawdata.metadata) local parameters = target.parameters - report_mathtweak( - "%a, size %P, math size %i, %s", - metadata and metadata.fontname or "unknown", - parameters.size or 655360, - parameters.mathsize or 1, - string.formatters[fmt](...) - ) + if parameters then + report_mathtweak( + "%a, size %P, math size %i, %s", + metadata and metadata.fontname or "unknown", + parameters.size or 655360, + parameters.mathsize or 1, + string.formatters[fmt](...) + ) + else + print("something is wrong") + end else report_mathtweak("") end end mathtweaks.subsets = { - acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, - bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, - d = { 0x1D451 }, - f = { 0x1D453 }, - gjqy = { 0x1D454, 0x1D457, 0x1D45E, 0x1D466 }, - i = { 0x1D456 }, - mw = { 0x1D45A, 0x1D464 }, - p = { 0x1D45D }, - dotless = { 0x00049, 0x0004A, 0x00131, 0x00237, 0x1D6A4, 0x1D6A5 }, - integrals = { 0x0222B, 0x0222C, 0x0222D, 0x0222E, 0x0222F, 0x02230, 0x02231, 0x02232, 0x02233, 0x02A0B, 0x02A0C, 0x02A0D, 0x02A0E, 0x02A0F, 0x02A10, 0x02A11, 0x02A12, 0x02A13, 0x02A14, 0x02A15, 0x02A16, 0x02A17, 0x02A18, 0x02A19, 0x02A1A, 0x02A1B, 0x02A1C }, + acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, + bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, + d = { 0x1D451 }, + f = { 0x1D453 }, + gjqy = { 0x1D454, 0x1D457, 0x1D45E, 0x1D466 }, + i = { 0x1D456 }, + mw = { 0x1D45A, 0x1D464 }, + p = { 0x1D45D }, + dotless = { 0x00049, 0x0004A, 0x00131, 0x00237, 0x1D6A4, 0x1D6A5 }, + integrals = { 0x0222B, 0x0222C, 0x0222D, 0x0222E, 0x0222F, 0x02230, 0x02231, 0x02232, 0x02233, 0x02A0B, 0x02A0C, 0x02A0D, 0x02A0E, 0x02A0F, 0x02A10, 0x02A11, 0x02A12, 0x02A13, 0x02A14, 0x02A15, 0x02A16, 0x02A17, 0x02A18, 0x02A19, 0x02A1A, 0x02A1B, 0x02A1C, 0x02320, 0x02321 }, + horizontalfences = { 0x023B4, 0x023B5, 0x023DC, 0x023DD, 0x023DE, 0x023DF, 0x023E0, 0x023E1 }, -- not really used } local function getalso(target,original) @@ -519,7 +527,7 @@ do else report_mathtweak("invalid dimension entry %U",k) end --- character.tweaked = true +-- character.tweaked = true if v.all then local nxt = character.next if nxt then @@ -594,10 +602,6 @@ do report_mathtweak(parameters.text or "no message") end -end - -do - function mathtweaks.showinfo(target,original,parameters) local mathparameters = target.mathparameters for k, v in sortedhash(mathparameters) do @@ -650,7 +654,7 @@ do end end if trace_tweaking and count > 0 then - report_mathtweak("%i variants wiped",count) + report_tweak("%i variants wiped",target,original,count) end end end @@ -677,7 +681,7 @@ do end end if trace_tweaking and count > 0 then - report_mathtweak("%i permanent replacements",count) + report_tweak("%i permanent replacements",target,original,count) end end end @@ -698,7 +702,7 @@ do end end if trace_tweaking and count > 0 then - report_mathtweak("%i permanent substitutions",count) + report_tweak("%i permanent substitutions",target,original,count) end end end @@ -741,7 +745,6 @@ do end for k, v in next, list do -- no need for sortedhash(list) unless we report --- for k, v in sortedhash(list) do -- no need for sortedhash(list) unless we report stepper(k,function(n) -- todo: also make stepper accept a table add(v,n) end) @@ -766,7 +769,7 @@ do -- end if trace_tweaking and count > 0 then - report_mathtweak("%i kern pairs",count) + report_tweak("%i kern pairs",target,original,count) end end end @@ -775,16 +778,6 @@ end do - function mathtweaks.variants(target,original,parameters) - report_mathtweak("todo: remove 'variants' tweak from goodie file") - end - - mathtweaks.variant = mathtweaks.variants - -end - -do - -- see changed hack in math-fbk local nps = fonts.helpers.newprivateslot @@ -956,35 +949,35 @@ do unicode = 0x002D, -- hyphen minus }, ["unary plus"] = { - original = 0x002B, - extend = .5, - squeeze = .5, - width = .5, - height = .5, - yoffset = .2, - mode = 2, - wline = .5, - unicode = 0x002B, + original = 0x002B, + extend = .5, + squeeze = .5, + width = .5, + height = .5, + yoffset = .2, + mode = 2, + wline = .5, + unicode = 0x002B, }, ["unary plus minus"] = { - original = 0x00B1, - extend = .5, - squeeze = .5, - width = .5, - height = .5, - yoffset = .2, - mode = 2, - wline = .5, + original = 0x00B1, + extend = .5, + squeeze = .5, + width = .5, + height = .5, + yoffset = .2, + mode = 2, + wline = .5, }, ["unary minus plus"] = { - original = 0x2213, - extend = .5, - squeeze = .5, - width = .5, - height = .5, - yoffset = .2, - mode = 2, - wline = .5, + original = 0x2213, + extend = .5, + squeeze = .5, + width = .5, + height = .5, + yoffset = .2, + mode = 2, + wline = .5, }, } @@ -1015,7 +1008,7 @@ do v = table.combine(p,v) p.preset = nil else - goto NEXT + goto next end end local charslot = v.original @@ -1033,7 +1026,7 @@ do end processedprivates[name] = v end - ::NEXT:: + ::next:: end end mathtweaks.dimensions(target,original,{ @@ -1051,12 +1044,17 @@ do local targetcharacters= target.characters local factor = tonumber(parameters.factor) or 0 if factor ~= 0 then + local count = 0 for k, v in next, targetcharacters do local a = v.topanchor if a and a > 0 then v.topanchor = a * factor + count = count + 1 end end + if trace_tweaking and count > 0 then + report_tweak("%i top anchors fixed",target,original,count) + end end end @@ -1069,20 +1067,26 @@ do -- actually this should be a an engine feature driven by category because we don't -- want this in display mode .. only a test for MS and HH - local issymbol = characters.is_symbol +-- local issymbol = characters.is_symbol +-- +-- function mathtweaks.oldstylemath(target,original,parameters) +-- local chardata = characters.data +-- local characters = target.characters +-- local axis = target.mathparameters.AxisHeight +-- local delta = (parameters.factor or .1) * axis +-- target.mathparameters.AxisHeight = (axis - delta) +-- for k, v in sortedhash(characters) do +-- if issymbol[k] then -- quick hack, engine knows +-- print("old style math",k,chardata[k].description) +-- v.yoffset = -delta +-- v.height = (v.height or 0) - delta +-- v.depth = (v.depth or 0) - delta +-- end +-- end +-- end function mathtweaks.oldstylemath(target,original,parameters) - local characters = target.characters - local axis = target.mathparameters.AxisHeight - local delta = (parameters.factor or .1) * axis - target.mathparameters.AxisHeight = (axis - delta) - for k, v in sortedhash(characters) do - if issymbol[k] then -- quick hack, engine knows - v.yoffset = -delta - v.height = (v.height or 0) - delta - v.depth = (v.depth or 0) - delta - end - end + -- not relevant end end @@ -1170,7 +1174,7 @@ do else local done = false local italic = c.italic - if move then + if move and not c.advance then -- advance check prevents double move local width = c.width or 0 c.advance = width if correct then @@ -1183,23 +1187,14 @@ do if topanchor then c.topanchor = topanchor + llx end --- if c.bottomleft or c.topleft then --- print("BEFORE",c.bottomleft,c.topleft,llx) --- c.bottomleft = (c.bottomleft or 0) - llx --- c.topleft = (c.topleft or 0) - llx --- print("AFTER",c.bottomleft,c.topleft,llx) --- else - c.bottomleft = (c.bottomleft or 0) - llx - c.topleft = (c.topleft or 0) - llx --- end + c.bottomleft = (c.bottomleft or 0) - llx + c.topleft = (c.topleft or 0) - llx done = true end end if italic and italic ~= 0 then c.width = width + italic --- print(">>>",bottomright) c.bottomright = - italic --- c.bottomright = c.bottomright - italic done = true else c.width = width @@ -1223,18 +1218,36 @@ do goto smaller ::smaller:: s = c.smaller + ::variants:: + -- no italics here anyway butr we could check them some day else break end end end local list = parameters.list -- todo: ranges - if type(list) == "string" then + if list == "letters" or parameters.letters then + local chardata = characters.data + for k, v in sortedhash(targetcharacters) do + if v.italic then + local d = chardata[v.unicode] + local c = d and d.category + if c == "ll" or c == "lu" then + step(k) + end + end + end + return + elseif not list or list == "all" or list == true or parameters.all then + list = sortedkeys(targetcharacters) + elseif type(list) == "string" then list = { list } end for i=1,#list do local l = list[i] - if type(l) == "table" then + if not l then + -- can be false + elseif type(l) == "table" then for i=1,#l do step(i,l[i]) end @@ -1258,7 +1271,9 @@ do mathtweaks.wipeaccents = mathtweaks.wipeanchors function mathtweaks.wipeitalics(target,original,parameters) - wipe(target,original,parameters,"italic") + if not checkitalics then + wipe(target,original,parameters,"italic") + end end function mathtweaks.moveitalics(target,original,parameters) @@ -1295,7 +1310,7 @@ do mathtweaks.topaccents = mathtweaks.topanchors - function mathtweaks.limits(target,original,parameters) + function mathtweaks.movelimits(target,original,parameters) local characters = target.characters local list = parameters.list if list then @@ -1310,16 +1325,18 @@ do local c = characters[u] if c then local italic = c.italic - if italic and italic ~= 0 then - local width = c.width or 0 - local half = (italic/2) * factor - c.topanchor = width + half - c.bottomanchor = width - half - c.bottomright = - italic - c.italic = nil - if trace_tweaking then - -- todo + if italic then + if italic ~= 0 then + local width = c.width or 0 + local half = (italic/2) * factor + c.topanchor = width + half + c.bottomanchor = width - half + c.bottomright = - italic + if trace_tweaking then + -- todo + end end + c.italic = nil end local s = c.smaller if s then @@ -1348,6 +1365,9 @@ do relocate(k,tonumber(v) or factor) end end + if not next(done) then + report_tweak("no need to move limits",target,original) + end end end @@ -2028,11 +2048,11 @@ do end data.height = depth data.depth = height -if data.rorrim then - -- the original does the magic -else - data.yoffset = depth - height -end + if data.rorrim then + -- the original does the magic + else + data.yoffset = depth - height + end end local smaller = data.smaller if smaller then @@ -2315,10 +2335,8 @@ do local parameters = target.parameters local linewidth = target.MathConstants.RadicalRuleThickness -- make option local basechar = characters[radical] - local baseheight = basechar.height -/2 - local basedepth = basechar.depth -/2 + local baseheight = basechar.height/2 + local basedepth = basechar.depth/2 local basetotal = baseheight + basedepth local used = baseheight -- @@ -2846,19 +2864,41 @@ end do - function mathtweaks.diagnose(target,original,parameters) - local characters = target.characters - for k, v in sortedhash(characters) do - local italic = v.italic - if italic then - report_tweak("italics: %U %p",target,original,k,italic) + function mathtweaks.parameters(target,original,parameters) + local newparameters = parameters.list + local oldparameters = target.mathparameters + if newparameters and oldparameters then + newparameters = copytable(newparameters) + scaleparameters(newparameters,target.parameters) + for name, newvalue in next, newparameters do + oldparameters[name] = newvalue end end --- inspect(characters[0xF0929]) + end + + function mathtweaks.bigslots(target,original,parameters) + local list = parameters.list + if list then + target.bigslots = list + end end end +-- do +-- +-- function mathtweaks.diagnose(target,original,parameters) +-- local characters = target.characters +-- for k, v in sortedhash(characters) do +-- local italic = v.italic +-- if italic then +-- report_tweak("italics: %C %p",target,original,k,italic) +-- end +-- end +-- end +-- +-- end + do function mathtweaks.setoptions(target,original,parameters) @@ -2944,105 +2984,110 @@ do end) function mathtweaks.replacealphabets(target,original,parameters) - local feature = parameters.feature - local features = target.specification.features.normal - if not feature or features[feature] == true then - local list = parameters.list - if list then - local definedfont = fonts.definers.internal - local copiedglyph = fonts.handlers.vf.math.copy_glyph + local list = parameters.list + if list then + local features = target.specification.features.normal + local definedfont = fonts.definers.internal + local copiedglyph = fonts.handlers.vf.math.copy_glyph -- does a deep copy, including parts and so - local getsubstitution = fonts.handlers.otf.getsubstitution - local fontdata = fonts.hashes.identifiers - -- - local fonts = target.fonts - local size = target.size - local characters = target.characters - -- compact: size = 655360 - if not fonts then - fonts = { } - target.fonts = fonts - end - if #fonts == 0 then - fonts[1] = { id = 0, size = size } -- self, will be resolved later - end - for i=1,#list do - local entry = list[i] - local filename = entry.filename - local feature = entry.feature - local thesource = entry.source - local thetarget = entry.target or thesource - if thesource and thetarget then - local sourcerange = type(thesource) == "table" and thesource or blocks[thesource] -- .gaps - local targetrange = type(thetarget) == "table" and thetarget or blocks[thetarget] -- .gaps - if sourcerange and targetrange then - local firsttarget = targetrange.first - local firstsource = sourcerange.first - local lastsource = sourcerange.last or firstsource - if firstsource and firsttarget then - local offset = firsttarget - firstsource - local topovershoot = entry.topovershoot - if filename then - local rscale = entry.rscale or 1 -- todo - size = size * rscale -- maybe use scale in vf command - -- load font, todo: set language and script, the effect hack is ugly - local fullname = filename - local effect = features.effect - if effect then - fullname = fullname .. "*" .. effects["effect={"..effect.."}"] - end - local id = definedfont { - name = fullname, - size = size, - } - local chars = fontchars[id] - local dropin = fontdata[id] - local index = #fonts + 1 - fonts[index] = { id = id, size = size } - -- copy characters - for s=firstsource,lastsource do - local t = s + offset - local sourceunicode = mathgaps[s] or s + local getsubstitution = fonts.handlers.otf.getsubstitution + local fontdata = fonts.hashes.identifiers + -- + local fonts = target.fonts + local size = target.size + local characters = target.characters +-- local descriptions = target.descriptions + -- compact: size = 655360 + if not fonts then + fonts = { } + target.fonts = fonts + end + if #fonts == 0 then + fonts[1] = { id = 0, size = size } -- self, will be resolved later + end + for i=1,#list do + local entry = list[i] + local filename = entry.filename or parameters.filename + local feature = entry.feature + local thesource = entry.source + local thetarget = entry.target or thesource + if thesource and thetarget then + local sourcerange = type(thesource) == "table" and thesource or blocks[thesource] -- .gaps + local targetrange = type(thetarget) == "table" and thetarget or blocks[thetarget] -- .gaps + if sourcerange and targetrange then + local firsttarget = targetrange.first + local firstsource = sourcerange.first + local lastsource = sourcerange.last or firstsource + if firstsource and firsttarget then + local offset = firsttarget - firstsource + local topovershoot = entry.topovershoot + if filename then + local rscale = entry.rscale or 1 -- todo + size = size * rscale -- maybe use scale in vf command + -- load font, todo: set language and script, the effect hack is ugly + local fullname = filename + local effect = features.effect + if effect then + fullname = fullname .. "*" .. effects["effect={"..effect.."}"] + end + local id = definedfont { + name = fullname, + size = size, + } + local chars = fontchars[id] + local dropin = fontdata[id] + local index = #fonts + 1 + fonts[index] = { id = id, size = size } + -- copy characters + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + if chars[sourceunicode] then local targetunicode = mathgaps[t] or t if feature then sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode end if trace_tweaking then - report_mathtweak("copying %s %U from file %a to %s %U",thesource,sourceunicode,filename,thetarget,targetunicode) + report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode) end characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index) +-- description end - elseif feature then - for s=firstsource,lastsource do - local t = s + offset - local sourceunicode = mathgaps[s] or s - local targetunicode = mathgaps[t] or t - local variant = getsubstitution(original,sourceunicode,feature,true,"math","dflt") - local data = characters[variant] - if data then - if trace_tweaking then - report_mathtweak("copying %s %U from feature %a to %s %U",thesource,sourceunicode,feature,thetarget,targetunicode) - end - characters[targetunicode] = copytable(data) + end + elseif feature then + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + local variant = getsubstitution(original,sourceunicode,feature,true,"math","dflt") + local data = characters[variant] + if data then + if trace_tweaking then + report_tweak("copying %s %U from feature %a to %s %U",target,original,thesource,sourceunicode,feature,thetarget,targetunicode) end + characters[targetunicode] = copytable(data) +-- description end - else - for s=firstsource,lastsource do - local t = s + offset - local sourceunicode = mathgaps[s] or s - local targetunicode = mathgaps[t] or t + end + else + for s=firstsource,lastsource do + local t = s + offset + local sourceunicode = mathgaps[s] or s + local targetunicode = mathgaps[t] or t + if sourceunicode ~= targetunicode then local data = characters[sourceunicode] if data then if trace_tweaking then - report_mathtweak("copying %s %U to %s %U",thesource,sourceunicode,thetarget,targetunicode) + report_tweak("copying %s %U to %s %U",target,original,thesource,sourceunicode,thetarget,targetunicode) end characters[targetunicode] = copytable(data) +-- description end end end - else - -- error end + else + -- error end end end @@ -3050,13 +3095,38 @@ do end end -end + function mathtweaks.fallbacks(target,original,parameters) + local fallbacks = target.specification.fallbacks + if fallbacks then + local definitions = fonts.collections.definitions[fallbacks] + if definitions then + local list = { } + for i=1,#definitions do + local definition = definitions[i] + -- local check = definition.check + -- local force = definition.force + local first = definition.start + local last = definition.stop + local offset = definition.offset or first + list[#list+1] = { + filename = definition.font, + rscale = definition.rscale or 1, + source = { first = first, last = last }, + target = { first = offset, last = offset + (last - first) }, + } + end + mathtweaks.replacealphabets(target,original,{ + tweak = "replacealphabets", + list = list, + } ) + end + end + end -local apply_tweaks = true +end -directives.register("math.applytweaks", function(v) - apply_tweaks = v; -end) +local apply_tweaks = true directives.register("math.applytweaks", function(v) apply_tweaks = v end) +local applied_tweaks = 0 local function applytweaks(when,target,original) if apply_tweaks then @@ -3073,6 +3143,8 @@ local function applytweaks(when,target,original) local mathematics = goodie.mathematics local tweaks = mathematics and mathematics.tweaks if type(tweaks) == "table" then + statistics.starttiming(mathtweaks) + applied_tweaks = applied_tweaks + 1 tweaks = tweaks[when] if type(tweaks) == "table" then if trace_defining then @@ -3084,19 +3156,24 @@ local function applytweaks(when,target,original) if type(tweak) == "table" then local action = mathtweaks[tweak.tweak or ""] if action then - local version = tweak.version - if version and version ~= target.tweakversion then - report_math("skipping tweak %a version %a",tweak.tweak,version) - elseif original then - action(target,original,tweak) - else - action(target,tweak) + local feature = tweak.feature + local features = target.specification.features.normal + if not feature or features[feature] == true then + local version = tweak.version + if version and version ~= target.tweakversion then + report_math("skipping tweak %a version %a",tweak.tweak,version) + elseif original then + action(target,original,tweak) + else + action(target,tweak) + end end end end end end end + statistics.stoptiming(mathtweaks) end tweaked[when] = true target.tweaked = tweaked @@ -3125,6 +3202,12 @@ function mathematics.tweakaftercopyingfont(target,original) end end +statistics.register("math tweaking time",function() + if applied_tweaks > 0 then + return string.format("%s seconds, %s math goodie tables", statistics.elapsedtime(mathtweaks),applied_tweaks) + end +end) + do local defaults = { @@ -3146,9 +3229,12 @@ do }, } + local reported = table.setmetatableindex("table") + function mathematics.checkaftercopyingfont(target,original) local mathparameters = target.mathparameters -- why not hasmath if mathparameters then + local chardata = characters.data local characters = target.characters -- for i=1,#defaults do @@ -3179,6 +3265,35 @@ do local ca = mathematics.alphabets.ca.tf register(sr.ucletters,ca.ucletters) register(sr.lcletters,ca.lcletters) + -- + if checkitalics then + local italics = 0 + local metadata = original.shared.rawdata.metadata + local fontname = metadata and metadata.fontname or false + for k, v in sortedhash(characters) do + local italic = v.italic + if italic then + local unicode = v.unicode + if unicode and not reported[fontname][unicode] then -- there can be variants + local data = chardata[unicode] + local description = data.description or "" + local category = data.category or "--" + report_tweak("italics: %C %p %s %s",target,original,k,italic,category,description) + reported[fontname][unicode] = true + end + italics = italics + 1 + end + end + if italics > 0 then + report_tweak("still has %i italics",target,original,italics) + goto NEXTSTEP + end + end + + target.properties.mathitalics = false + target.properties.textitalics = false + ::NEXTSTEP:: + -- more to come end end @@ -3195,7 +3310,7 @@ end sequencers.appendaction("mathparameters","system","mathematics.overloadparameters") sequencers.appendaction("mathparameters","system","mathematics.scaleparameters") -sequencers.appendaction("mathparameters","system","mathematics.checkaccentbaseheight") -- should go in lfg instead +----------.appendaction("mathparameters","system","mathematics.checkaccentbaseheight") -- should go in lfg instead ----------.appendaction("mathparameters","system","mathematics.checkprivateparameters") -- after scaling ! sequencers.appendaction("beforecopyingcharacters","system","mathematics.tweakbeforecopyingfont") @@ -3329,111 +3444,3 @@ interfaces.implement { -- can be public with two times "integerargument" context(kind) end } - -local stack = { } - -function mathematics.registerfallbackid(n,id,name) - if trace_collecting then - report_math("resolved fallback font %i, name %a, id %a, used %a", - n,name,id,fontproperties[id].fontname) - end - stack[#stack][n] = id -end - -interfaces.implement { -- will be shared with text - name = "registerfontfallbackid", - arguments = { "integer", "integer", "string" }, - actions = mathematics.registerfallbackid, -} - --- todo: run this directly .. can be done in luametatex - -function mathematics.resolvefallbacks(target,specification,fallbacks) - local definitions = fonts.collections.definitions[fallbacks] - if definitions then - local size = specification.size -- target.size - local list = { } - insert(stack,list) - context.pushcatcodes("prt") -- context.unprotect() - for i=1,#definitions do - local definition = definitions[i] - local name = definition.font - local features = definition.features or "" - local size = size * (definition.rscale or 1) - -- compact: size = 655360 - context.font_fallbacks_register_math(i,name,features,size) - if trace_collecting then - report_math("registering fallback font %i, name %a, size %a, features %a",i,name,size,features) - end - end - context.popcatcodes() - end -end - -function mathematics.finishfallbacks(target,specification,fallbacks) - local list = remove(stack) - if list and #list > 0 then - local definitions = fonts.collections.definitions[fallbacks] - if definitions and #definitions > 0 then - if trace_collecting then - report_math("adding fallback characters to font %a",specification.hash) - end - ----- definedfont = fonts.definers.internal - local copiedglyph = fonts.handlers.vf.math.copy_glyph - local fonts = target.fonts - local size = specification.size -- target.size - local characters = target.characters - -- compact: size = 655360 - if not fonts then - fonts = { } - target.fonts = fonts - end - if #fonts == 0 then - fonts[1] = { id = 0, size = size } -- self, will be resolved later - end - local done = { } - for i=1,#definitions do - local definition = definitions[i] - local name = definition.font - local start = definition.start - local stop = definition.stop - local gaps = definition.gaps - local check = definition.check - local force = definition.force - local rscale = definition.rscale or 1 - local offset = definition.offset or start - local id = list[i] - if id then - local index = #fonts + 1 - fonts[index] = { id = id, size = size } - local chars = fontchars[id] - local function remap(unic,unicode,gap) - if check and not chars[unicode] then - return - end - if force or (not done[unic] and not characters[unic]) then - if trace_collecting then - report_math("replacing math character %C by %C using vector %a and font id %a for %a%s%s", - unic,unicode,fallbacks,id,fontproperties[id].fontname,check and ", checked",gap and ", gap plugged") - end - characters[unic] = copiedglyph(target,characters,chars,unicode,index) - done[unic] = true - end - end - local step = offset - start - for unicode = start, stop do - remap(unicode + step,unicode,false) - end - if gaps then - for unic, unicode in next, gaps do - remap(unic,unicode,true) - remap(unicode,unicode,true) - end - end - end - end - elseif trace_collecting then - report_math("no fallback characters added to font %a",specification.hash) - end - end -end diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 29af7a659..c1beb071c 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -1958,6 +1958,13 @@ %D For previous variants of the function styling you can check the git repository %D end April 2022. +% \startTEXpage[offset=1dk] +% $\sin(x) = 10$ +% \m[functionstyle=sans]{\sin(x) = 10} +% \startformula \sin(x) = 10 \stopformula +% \startformula[functionstyle=sans] \sin(x) = 10 \stopformula +% \stopTEXpage + \protected\def\math_function_handle#1#2#3% {\begingroup \letdummyparameter\c!mathlimits\empty @@ -1989,6 +1996,17 @@ \egroup \endgroup} +\appendtoks + \edef\p_functionstyle{\formulaparameter\c!functionstyle}% + \ifempty\p_functionstyle\else + \letmathematicsparameter\c!functionstyle\p_functionstyle + \fi + \edef\p_functioncolor{\formulaparameter\c!functioncolor}% + \ifempty\p_functioncolor\else + \letmathematicsparameter\c!functioncolor\p_functioncolor + \fi +\to \everybeforedisplayformula + \permanent\tolerant\protected\def\mfunction [#1]{\math_function_handle{#1}\firstofoneargument} \permanent\tolerant\protected\def\mfunctionlabeltext[#1]{\math_function_handle{#1}\mathlabeltext} @@ -3948,7 +3966,7 @@ \installcorenamespace{mathrules} -\permanent\protected\def\enablemathrules{\letgvalue{\??mathrules\fontclass}\plusone} +\permanent\protected\def\enablemathrules{\gletcsname\??mathrules\fontclass\endcsname\plusone} \appendtoks \mathrulesmode\ifcsname\??mathrules\fontclass\endcsname @@ -4378,13 +4396,13 @@ %D \stoptyping \definesystemattribute[mathaxis][public] - \def\math_axis_inject#1% {\mathatom \s!class \mathghostcode \s!unpack { \showmakeup[strut]% todo: shortcut + \scratchdimen.5\Umathfractionrule\mathstyle \srule - \s!height \dimexpr\Umathaxis\mathstyle+.2\points\relax - \s!depth -\dimexpr\Umathaxis\mathstyle-.2\points\relax + \s!height \dimexpr\Umathaxis\mathstyle+\scratchdimen\relax + \s!depth -\dimexpr\Umathaxis\mathstyle-\scratchdimen\relax \s!attr \mathaxisattribute #1% \relax}} diff --git a/tex/context/base/mkxl/math-vfu.lmt b/tex/context/base/mkxl/math-vfu.lmt index 906c9ccf6..86d1fca0d 100644 --- a/tex/context/base/mkxl/math-vfu.lmt +++ b/tex/context/base/mkxl/math-vfu.lmt @@ -651,6 +651,7 @@ local function copy_glyph(main,target,original,unicode,slot) kerns = olddata.kerns, mathkerns = olddata.mathkerns, tounicode = olddata.tounicode, + smaller = olddata.smaller, commands = { { "slot", slot, nextglyph } }, } local newnextglyph = addprivate(main,formatters["M-N-%H"](nextglyph),newnextdata) @@ -703,7 +704,12 @@ local function copy_glyph(main,target,original,unicode,slot) vvi.glyph = addprivate(main,formatters["M-V-%H"](oldglyph),newdata) end end - return newdata + local smaller = olddata.smaller + if smaller then + local smallerdata = copy_glyph(main,target,original,smaller,slot) + glyphdata.smaller = addprivate(main,formatters["M-S-%H"](smaller),smallerdata) + end + return glyphdata end end diff --git a/tex/context/base/mkxl/mlib-int.lmt b/tex/context/base/mkxl/mlib-int.lmt index 9165d5423..686f1985d 100644 --- a/tex/context/base/mkxl/mlib-int.lmt +++ b/tex/context/base/mkxl/mlib-int.lmt @@ -7,8 +7,6 @@ if not modules then modules = { } end modules ['mlib-int'] = { } local factor = number.dimenfactors.bp -local mpstring = mp.string -local injectnumeric = mp.inject.numeric local isdimen = tex.isdimen local iscount = tex.iscount local getdimen = tex.getdimen @@ -53,49 +51,78 @@ end do - local d_paperheight = isdimen("paperheight") registerdirect("PaperHeight", function() return getdimen(d_paperheight) * factor end) - local d_paperwidth = isdimen("paperwidth") registerdirect("PaperWidth", function() return getdimen(d_paperwidth) * factor end) - local d_printpaperheight = isdimen("printpaperheight") registerdirect("PrintPaperHeight", function() return getdimen(d_printpaperheight) * factor end) - local d_printpaperwidth = isdimen("printpaperwidth") registerdirect("PrintPaperWidth", function() return getdimen(d_printpaperwidth) * factor end) - local d_topspace = isdimen("topspace") registerdirect("TopSpace", function() return getdimen(d_topspace) * factor end) - local d_bottomspace = isdimen("bottomspace") registerdirect("BottomSpace", function() return getdimen(d_bottomspace) * factor end) - local d_backspace = isdimen("backspace") registerdirect("BackSpace", function() return getdimen(d_backspace) * factor end) - local d_cutspace = isdimen("cutspace") registerdirect("CutSpace", function() return getdimen(d_cutspace) * factor end) - local d_makeupheight = isdimen("makeupheight") registerdirect("MakeupHeight", function() return getdimen(d_makeupheight) * factor end) - local d_makeupwidth = isdimen("makeupwidth") registerdirect("MakeupWidth", function() return getdimen(d_makeupwidth) * factor end) - local d_topheight = isdimen("topheight") registerdirect("TopHeight", function() return getdimen(d_topheight) * factor end) - local d_topdistance = isdimen("topdistance") registerdirect("TopDistance", function() return getdimen(d_topdistance) * factor end) - local d_headerheight = isdimen("headerheight") registerdirect("HeaderHeight", function() return getdimen(d_headerheight) * factor end) - local d_headerdistance = isdimen("headerdistance") registerdirect("HeaderDistance", function() return getdimen(d_headerdistance) * factor end) - local d_textheight = isdimen("textheight") registerdirect("TextHeight", function() return getdimen(d_textheight) * factor end) - local d_footerdistance = isdimen("footerdistance") registerdirect("FooterDistance", function() return getdimen(d_footerdistance) * factor end) - local d_footerheight = isdimen("footerheight") registerdirect("FooterHeight", function() return getdimen(d_footerheight) * factor end) - local d_bottomdistance = isdimen("bottomdistance") registerdirect("BottomDistance", function() return getdimen(d_bottomdistance) * factor end) - local d_bottomheight = isdimen("bottomheight") registerdirect("BottomHeight", function() return getdimen(d_bottomheight) * factor end) - local d_leftedgewidth = isdimen("leftedgewidth") registerdirect("LeftEdgeWidth", function() return getdimen(d_leftedgewidth) * factor end) - local d_leftedgedistance = isdimen("leftedgedistance") registerdirect("LeftEdgeDistance", function() return getdimen(d_leftedgedistance) * factor end) - local d_leftmarginwidth = isdimen("leftmarginwidth") registerdirect("LeftMarginWidth", function() return getdimen(d_leftmarginwidth) * factor end) - local d_leftmargindistance = isdimen("leftmargindistance") registerdirect("LeftMarginDistance", function() return getdimen(d_leftmargindistance) * factor end) - local d_textwidth = isdimen("textwidth") registerdirect("TextWidth", function() return getdimen(d_textwidth) * factor end) - local d_rightmargindistance = isdimen("rightmargindistance") registerdirect("RightMarginDistance", function() return getdimen(d_rightmargindistance) * factor end) - local d_rightmarginwidth = isdimen("rightmarginwidth") registerdirect("RightMarginWidth", function() return getdimen(d_rightmarginwidth) * factor end) - local d_rightedgedistance = isdimen("rightedgedistance") registerdirect("RightEdgeDistance", function() return getdimen(d_rightedgedistance) * factor end) - local d_rightedgewidth = isdimen("rightedgewidth") registerdirect("RightEdgeWidth", function() return getdimen(d_rightedgewidth) * factor end) - -end - -do - - local onrightpage = structures.pages.on_right - - registerdirect("InnerMarginDistance", function() return getdimen(onrightpage() and d_leftmargindistance or d_rightmargindistance) * factor end) - registerdirect("InnerMarginWidth", function() return getdimen(onrightpage() and d_leftmarginwidth or d_rightmarginwidth ) * factor end) - registerdirect("OuterMarginDistance", function() return getdimen(onrightpage() and d_rightmargindistance or d_leftmargindistance ) * factor end) - registerdirect("OuterMarginWidth", function() return getdimen(onrightpage() and d_rightmarginwidth or d_leftmarginwidth ) * factor end) - registerdirect("InnerEdgeDistance", function() return getdimen(onrightpage() and d_leftmargindistance or d_rightmargindistance) * factor end) - registerdirect("InnerEdgeWidth", function() return getdimen(onrightpage() and d_leftmarginwidth or d_rightmarginwidth ) * factor end) - registerdirect("OuterEdgeDistance", function() return getdimen(onrightpage() and d_rightedgedistance or d_leftedgedistance ) * factor end) - registerdirect("OuterEdgeWidth", function() return getdimen(onrightpage() and d_rightedgewidth or d_leftedgewidth ) * factor end) + -- These get swapped so the d_ numbers change. + + registerdirect("PaperHeight", function() return getdimen("paperheight") * factor end) + registerdirect("PaperWidth", function() return getdimen("paperwidth") * factor end) + registerdirect("PrintPaperHeight", function() return getdimen("printpaperheight") * factor end) + registerdirect("PrintPaperWidth", function() return getdimen("printpaperwidth") * factor end) + registerdirect("BackSpace", function() return getdimen("backspace") * factor end) + registerdirect("CutSpace", function() return getdimen("cutspace") * factor end) + + registerdirect("LeftEdgeWidth", function() return getdimen("leftedgewidth") * factor end) + registerdirect("LeftEdgeDistance", function() return getdimen("leftedgedistance") * factor end) + registerdirect("LeftMarginWidth", function() return getdimen("leftmarginwidth") * factor end) + registerdirect("LeftMarginDistance", function() return getdimen("leftmargindistance") * factor end) + registerdirect("RightMarginDistance", function() return getdimen("rightmargindistance") * factor end) + registerdirect("RightMarginWidth", function() return getdimen("rightmarginwidth") * factor end) + registerdirect("RightEdgeDistance", function() return getdimen("rightedgedistance") * factor end) + registerdirect("RightEdgeWidth", function() return getdimen("rightedgewidth") * factor end) + + -- leftmargintotal rightmargintotal -- not yet + -- leftedgetotal rightedgetotal + -- leftsidetotal rightsidetotal + -- leftcombitotal rightcombitotal + -- innermargintotal outermargintotal + -- inneredgetotal outeredgetotal + -- innercombitotal outercombitotal + -- innersidetotal outersidetotal + + local d_leftedgewidth = isdimen("leftedgewidth") + local d_leftedgedistance = isdimen("leftedgedistance") + local d_leftmarginwidth = isdimen("leftmarginwidth") + local d_leftmargindistance = isdimen("leftmargindistance") + local d_rightmargindistance = isdimen("rightmargindistance") + local d_rightmarginwidth = isdimen("rightmarginwidth") + local d_rightedgedistance = isdimen("rightedgedistance") + local d_rightedgewidth = isdimen("rightedgewidth") + + registerdirect("InnerMarginDistance", function() return getdimen(d_leftmargindistance ) * factor end) + registerdirect("InnerMarginWidth", function() return getdimen(d_leftmarginwidth ) * factor end) + registerdirect("OuterMarginDistance", function() return getdimen(d_rightmargindistance) * factor end) + registerdirect("OuterMarginWidth", function() return getdimen(d_rightmarginwidth ) * factor end) + registerdirect("InnerEdgeDistance", function() return getdimen(d_leftmargindistance ) * factor end) + registerdirect("InnerEdgeWidth", function() return getdimen(d_leftmarginwidth ) * factor end) + registerdirect("OuterEdgeDistance", function() return getdimen(d_rightedgedistance ) * factor end) + registerdirect("OuterEdgeWidth", function() return getdimen(d_rightedgewidth ) * factor end) + + -- local onrightpage = structures.pages.on_right + + -- registerdirect("InnerMarginDistance", function() return getdimen(onrightpage() and "leftmargindistance" or "rightmargindistance") * factor end) + -- registerdirect("InnerMarginWidth", function() return getdimen(onrightpage() and "leftmarginwidth" or "rightmarginwidth" ) * factor end) + -- registerdirect("OuterMarginDistance", function() return getdimen(onrightpage() and "rightmargindistance" or "leftmargindistance" ) * factor end) + -- registerdirect("OuterMarginWidth", function() return getdimen(onrightpage() and "rightmarginwidth" or "leftmarginwidth" ) * factor end) + -- registerdirect("InnerEdgeDistance", function() return getdimen(onrightpage() and "leftmargindistance" or "rightmargindistance") * factor end) + -- registerdirect("InnerEdgeWidth", function() return getdimen(onrightpage() and "leftmarginwidth" or "rightmarginwidth" ) * factor end) + -- registerdirect("OuterEdgeDistance", function() return getdimen(onrightpage() and "rightedgedistance" or "leftedgedistance" ) * factor end) + -- registerdirect("OuterEdgeWidth", function() return getdimen(onrightpage() and "rightedgewidth" or "leftedgewidth" ) * factor end) + + -- These have stable d_ numbers. + + local d_topspace = isdimen("topspace") registerdirect("TopSpace", function() return getdimen(d_topspace) * factor end) + local d_bottomspace = isdimen("bottomspace") registerdirect("BottomSpace", function() return getdimen(d_bottomspace) * factor end) + local d_makeupheight = isdimen("makeupheight") registerdirect("MakeupHeight", function() return getdimen(d_makeupheight) * factor end) + local d_makeupwidth = isdimen("makeupwidth") registerdirect("MakeupWidth", function() return getdimen(d_makeupwidth) * factor end) + local d_topheight = isdimen("topheight") registerdirect("TopHeight", function() return getdimen(d_topheight) * factor end) + local d_topdistance = isdimen("topdistance") registerdirect("TopDistance", function() return getdimen(d_topdistance) * factor end) + local d_headerheight = isdimen("headerheight") registerdirect("HeaderHeight", function() return getdimen(d_headerheight) * factor end) + local d_headerdistance = isdimen("headerdistance") registerdirect("HeaderDistance", function() return getdimen(d_headerdistance) * factor end) + local d_textheight = isdimen("textheight") registerdirect("TextHeight", function() return getdimen(d_textheight) * factor end) + local d_footerdistance = isdimen("footerdistance") registerdirect("FooterDistance", function() return getdimen(d_footerdistance) * factor end) + local d_footerheight = isdimen("footerheight") registerdirect("FooterHeight", function() return getdimen(d_footerheight) * factor end) + local d_bottomdistance = isdimen("bottomdistance") registerdirect("BottomDistance", function() return getdimen(d_bottomdistance) * factor end) + local d_bottomheight = isdimen("bottomheight") registerdirect("BottomHeight", function() return getdimen(d_bottomheight) * factor end) + local d_textwidth = isdimen("textwidth") registerdirect("TextWidth", function() return getdimen(d_textwidth) * factor end) end diff --git a/tex/context/base/mkxl/node-ali.lmt b/tex/context/base/mkxl/node-ali.lmt index 4b52f2d4b..69b1e7aa0 100644 --- a/tex/context/base/mkxl/node-ali.lmt +++ b/tex/context/base/mkxl/node-ali.lmt @@ -314,7 +314,7 @@ interfaces.implement { end, } --- Let's put it here (for now) (some locals above) .. will be cleaned up! +-- This will go to math-ali.lmt do @@ -538,7 +538,7 @@ deltas = { } for count=1,#records do if count == lindex then if centered and overflow then - lwidth = lwidth - tex.getdimen("d_math_eqalign_number_distance") + lwidth = lwidth - texgetdimen("d_math_eqalign_number_distance") end setwidth(records[count],lwidth) elseif count == rindex then diff --git a/tex/context/base/mkxl/scrn-ini.lmt b/tex/context/base/mkxl/scrn-ini.lmt index 82b9bd02e..2d01a1a28 100644 --- a/tex/context/base/mkxl/scrn-ini.lmt +++ b/tex/context/base/mkxl/scrn-ini.lmt @@ -52,3 +52,11 @@ interfaces.implement { actions = setidentityvariable, arguments = "2 strings", } + +interfaces.implement { + name = "setautoprefix", + actions = function(prefix) + backends.codeinjections.setautoprefix(prefix) + end, + arguments = "string", +} diff --git a/tex/context/base/mkxl/scrn-ini.mklx b/tex/context/base/mkxl/scrn-ini.mklx index 8a7f89c42..1308ff6ec 100644 --- a/tex/context/base/mkxl/scrn-ini.mklx +++ b/tex/context/base/mkxl/scrn-ini.mklx @@ -206,4 +206,8 @@ \scrn_identity_document {date}\c!date \to \everystartdocument % or stop +\appendtoks + \clf_setautoprefix{\interactionparameter\c!prefix}% +\to \everysetupinteraction + \protect \endinput diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index d36d113e1..a0e85e839 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -1219,7 +1219,8 @@ \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row\c_tabl_ntb_current_col\endcsname \scratchcounter\numexpr\c_tabl_ntb_maximum_row-\c_tabl_ntb_current_row+\plusone\relax \ifnum\tabl_ntb_get_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col>\scratchcounter - \tabl_ntb_set_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\scratchcounter}% +% \tabl_ntb_set_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\scratchcounter}% + \tabl_ntb_set_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col\scratchcounter \fi \fi \tabl_ntb_let_ht\c_tabl_ntb_current_row\c_tabl_ntb_current_col\zeropoint diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index e00944413..e2c79022a 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -48,6 +48,7 @@ local getattr = nuts.getattr local getsubtype = nuts.getsubtype local getbox = nuts.getbox local getlist = nuts.getlist +local getprev = nuts.getprev local getnext = nuts.getnext local getboth = nuts.getboth local getwhd = nuts.getwhd @@ -1313,7 +1314,9 @@ local ruledstrut do if getsubtype(current) == strut_code then local w = strut_size local a = getattr(current,a_mathaxis) + setattr(current,a_layer,l_strut) if a then + local p = getprev(current) local b, e for n in traverseid(math_code,current) do e = n @@ -1336,17 +1339,17 @@ local ruledstrut do head, current, rule = nuts.remove(head,current) local kern = new_kern(-w) if a == 2 then - insertnodebefore(head,e,kern) - insertnodebefore(head,e,rule) + head = insertnodebefore(head,e,kern) + head = insertnodebefore(head,e,rule) else insertnodeafter(head,b,kern) insertnodeafter(head,b,rule) end + current = p else setwidth(current,w) - head, current = insertnodeafter(head,current,new_kern(w)) + head, current = insertnodeafter(head,current,new_kern(-w)) end - setattr(current,a_layer,l_strut) end end return head, current diff --git a/tex/context/base/mkxl/type-imp-euler.mkxl b/tex/context/base/mkxl/type-imp-euler.mkxl new file mode 100644 index 000000000..c0a3f73f6 --- /dev/null +++ b/tex/context/base/mkxl/type-imp-euler.mkxl @@ -0,0 +1,67 @@ +%D \module +%D [ file=type-otf, +%D version=2007.07.30, +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=Euler, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\loadtypescriptfile[texgyre] +\loadtypescriptfile[dejavu] + +\definefontfeature[pagellaovereuler][pagellaovereuler=yes] +\definefontfeature[euleroverpagella][euleroverpagella=yes] + +\starttypescriptcollection[pagella-eulernova] + + \starttypescript [\s!serif] [eulernova] [\s!name] + \setups[\s!font:\s!fallback:\s!serif] + \definefontsynonym [\s!Serif] [\s!file:euler.otf] [\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!math] [eulernova] [\s!name] + \definefontsynonym [\s!MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=euler-math] + \stoptypescript + + \starttypescript [pagella-eulernova] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [pagella] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [eulernova] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [eulernova] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [eulernova] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [eulernova] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [\s!math] [euleroverpagella] [\s!name] + \definefontsynonym [\s!MathRoman] [texgyrepagella-math] [\s!features={\s!math\mathsizesuffix,euleroverpagella,mathextra},\s!fallbacks=euleroverpagella,\s!goodies=pagella-math] + \stoptypescript + + \starttypescript [\s!math] [pagellaovereuler] [\s!name] + \definefontsynonym [\s!MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,pagellaovereuler,mathextra},\s!fallbacks=pagellaovereuler,\s!goodies=euler-math] + \stoptypescript + + \starttypescript [pagella-with-euler,euleroverpagella] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [pagella] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [euleroverpagella] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [euler-with-pagella,pagellaovereuler] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [eulernova] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [pagellaovereuler] [\s!default] + \quittypescriptscanning + \stoptypescript + +\stoptypescriptcollection diff --git a/tex/context/base/mkxl/typo-itc.lmt b/tex/context/base/mkxl/typo-itc.lmt index f2f6c428e..f0b6980f4 100644 --- a/tex/context/base/mkxl/typo-itc.lmt +++ b/tex/context/base/mkxl/typo-itc.lmt @@ -82,7 +82,7 @@ function typesetters.italics.forcevariant(variant) forcedvariant = variant end --- We use the same key as the tex font handler. So, if a valua has already be set, we +-- We use the same key as the tex font handler. So, if a value has already be set, we -- use that one. local function setitalicinfont(font,char) @@ -108,6 +108,7 @@ local function setitalicinfont(font,char) end end end + -- we don't want to do this each time so we also set zero here if trace_italics then report_italics("setting italic correction of %C of font %a to %p",char,font,italic) end diff --git a/tex/context/fonts/mkiv/asana-math.lfg b/tex/context/fonts/mkiv/asana-math.lfg index 379dd014f..970d031ea 100644 --- a/tex/context/fonts/mkiv/asana-math.lfg +++ b/tex/context/fonts/mkiv/asana-math.lfg @@ -1,35 +1,3 @@ --- This patch code is moved from font-pat.lua to this goodies --- files as it does not belong in the core code. --- --- local patches = fonts.handlers.otf.enhancers.patches --- --- local function patch(data,filename,threshold) --- local m = data.metadata.math --- if m then --- local d = m.DisplayOperatorMinHeight or 0 --- if d < threshold then --- patches.report("DisplayOperatorMinHeight(%s -> %s)",d,threshold) --- m.DisplayOperatorMinHeight = threshold --- end --- end --- end --- --- patches.register("after","analyze math","asana",function(data,filename) patch(data,filename,1350) end) --- --- local function less(value,target,original) --- -- officially we should check the original --- return 0.25 * value --- end - --- Just don't use this font. It's not good enough for production unless we patch it --- a lot, which we will not do unless we need it. - --- When set this will bypass the italic correction hackery! - --- local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } --- local integral_bottom = { bottomright = -0.25 } - local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -70,32 +38,40 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 1 }, - presets.mathrsfscript { rscale = 1 }, - presets.mathxitsarabic { rscale = 0.95 }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 2 }, + presets.wipeitalics { }, { tweak = "dimensions", list = { -- nothing yet } }, - -- { - -- tweak = "kerns", - -- list = { - -- [0x2F] = { - -- topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - -- bottomright = -0.2, - -- }, - -- }, - -- }, - -- { - -- tweak = "fixprimes", - -- factor = 0.85, - -- scale = 0.65, - -- smaller = true, - -- }, + -- { + -- tweak = "kerns", + -- list = { + -- [0x2F] = { + -- topleft = -0.2, + -- bottomleft = 0, + -- topright = 0, + -- bottomright = -0.2, + -- }, + -- }, + -- }, + -- { + -- tweak = "fixprimes", + -- factor = 0.85, + -- scale = 0.65, + -- smaller = true, + -- }, { tweak = "checkspacing", }, @@ -115,6 +91,12 @@ return { tweak = "setoptions", set = { "ignorekerndimensions" } }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg index 508293f19..e5d764aff 100644 --- a/tex/context/fonts/mkiv/bonum-math.lfg +++ b/tex/context/fonts/mkiv/bonum-math.lfg @@ -1,29 +1,10 @@ -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - local kern_V = { bottomright = { { kern = -200 } } } - local kern_W = { bottomright = { { kern = -100 } } } - local offset_f = { xoffset = "llx" } - - dimensions = { - default = { - [0x1D453] = offset_f, -- 𝑓 - }, - } - - kerns = { - [0x1D449] = kern_V, -- 𝑉 - [0x1D44A] = kern_W, -- 𝑊 - } - -end +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets local integral_variants = { bottomright = -0.20 } local integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.30 } -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets - return { name = "bonum-math", version = "1.00", @@ -79,53 +60,29 @@ return { }, }, }, - presets.matheulercalligraphic { rscale = 0.98 }, - presets.mathrsfscript { rscale = 0.98 }, - presets.mathxitsarabic { rscale = 1 }, - presets.moveitalics { correct = true }, - { - -- For some alphabets we remove italic correction. - -- tweak = "wipeitalics", - list = { - "digitsbold", - "digitsdoublestruck", - "digitsmonospace", - "digitsnormal", - "digitssansserifbold", - "digitssansserifnormal", - "lowercasebold", - "lowercaseboldfraktur", - "lowercasedoublestruck", - "lowercasefraktur", - "lowercasemonospace", - -- "lowercasenormal", - "lowercasesansserifbold", - -- "lowercasesansserifnormal", - "lowercasegreeknormal", - "uppercasebold", - "uppercaseboldfraktur", - "uppercasedoublestruck", - "uppercasefraktur", - "uppercasegreekbold", - "uppercasegreeknormal", - "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasesansserifbold", - "uppercasesanserifnormal", -- some remain - }, - }, - { - -- tweak = "topaccents", - list = { - [0x1D453] = 0.7, -- f - }, - }, - { - tweak = "limits", - list = { - [0x0222B] = 1.5, - }, - }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.98 }, + presets.rsfsuprighttoscript { rscale = 0.98 }, + presets.moderntocalligraphic { rscale = 0.98 }, + presets.eulertocalligraphic { rscale = 0.98 }, + presets.xitsarabic { rscale = 1 }, + presets.fallbacks { }, + presets.moveintegrals { factor = 1.5 }, + presets.moveitalics { correct = true }, + presets.wipeanchors { }, + presets.wipeitalics { }, + -- { + -- tweak = "topaccents", + -- list = { + -- [0x1D453] = 0.7, -- f + -- }, + -- }, + -- { + -- tweak = "limits", + -- list = { + -- [0x0222B] = 1.5, + -- }, + -- }, { -- We need to check these, are the tweaks necessary or not? tweak = "dimensions", @@ -199,9 +156,9 @@ return { { tweak = "dimensions", list = { - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, @@ -233,41 +190,6 @@ return { }, -- So far for the accents. { - -- For upright alphabets, we unset the anchor. This means that accents are placed - -- centered over the character. Should be on top. - tweak = "wipeanchors", - list = { - "digitsbold", - "digitsdoublestruck", - "digitsmonospace", - "digitsnormal", - "digitssansserifbold", - "digitssansserifnormal", - "lowercasebold", - "lowercaseboldfraktur", - "lowercasedoublestruck", - "lowercasefraktur", - "lowercasegreekbold", - "lowercasegreeknormal", - "lowercasegreeksansserifbold", - "lowercasemonospace", --- "lowercasenormal", - "lowercasesansserifbold", - "lowercasesansserifnormal", - "uppercasebold", - "uppercaseboldfraktur", - "uppercasedoublestruck", - "uppercasefraktur", - "uppercasegreekbold", - "uppercasegreeknormal", - "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasenormal", - "uppercasesansserifbold", - "uppercasesansserifnormal", - }, - }, - { -- This one fakes margins to get larger/smaller accents with for example the -- \widetilde. tweak = "margins", @@ -467,9 +389,19 @@ return { tweak = "addequals", }, { - tweak = "addfourier", + tweak = "addfourier", variant = 1, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, + -- + -- { + -- tweak = "diagnose", + -- }, }, }, @@ -479,134 +411,127 @@ return { bigslots = { 1, 3, 5, 7 }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, }, } +-- For now we keep these commented as they show where we came from. + -- \alpha is looking like an italic a. The one from Dejavu could perhaps be an alternative? -- No hvariants in 772 - - - --- From the dimension tweak: --- [0x00393] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Gamma --- [0x00394] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Delta --- [0x00398] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Theta --- [0x0039B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Lambda --- [0x0039E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Xi --- [0x003A0] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Pi --- [0x003A3] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Sigma --- [0x003A5] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Upsilon --- [0x003A6] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Phi --- [0x003A8] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Psi --- [0x003A9] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Omega --- [0x02202] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \partial --- [0x1D43A] = { xoffset = -0.1, width = 1, italic = 0 }, -- G --- [0x1D442] = { xoffset = -0.1, width = 1, italic = 0 }, -- O --- [0x1D444] = { xoffset = -0.05, width = 1.025, italic = 0 }, -- Q --- -- [0x1D44E] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.8 }, -- a --- -- [0x1D44F] = { xoffset = -0.05, width = 1.1, italic = 0 }, -- b --- -- [0x1D450] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- c --- -- [0x1D451] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.75 }, -- d --- -- [0x1D452] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- e --- -- [0x1D453] = { xoffset = 0.45, width = 1.9, italic = 0.45, anchor = 1.1 }, -- f --- -- [0x1D454] = { xoffset = 0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- g --- -- [0x0210E] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 1.15 }, -- h --- -- [0x1D456] = { xoffset = -0.2, width = 1.1, italic = 0 }, -- i --- -- [0x1D457] = { xoffset = 0.6, width = 1.7, italic = 0.45 }, -- j --- -- [0x1D458] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 1.15 }, -- k --- -- [0x1D459] = { xoffset = -0.15, width = 1.1, italic = 0, anchor = 0.8 }, -- l --- -- [0x1D45A] = { xoffset = -0.05, width = 1, italic = 0 }, -- m --- -- [0x1D45B] = { xoffset = -0.1, width = 1, italic = 0, anchor = 0.9 }, -- n --- -- [0x1D45C] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- o --- -- [0x1D45D] = { width = 1.05, italic = 0 }, -- p --- -- [0x1D45E] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.9 }, -- q --- -- [0x1D45F] = { xoffset = -0.1, width = 1.15, italic = 0, anchor = 0.9 }, -- r --- -- [0x1D460] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- s --- -- [0x1D461] = { xoffset = -0.15, width = 1.2, italic = 0, anchor = 0.9 }, -- t --- -- [0x1D462] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- u --- -- [0x1D463] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- v --- -- [0x1D464] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.95 }, -- w --- -- [0x1D465] = { width = 1.175, italic = 0, anchor = 0.9 }, -- x --- -- [0x1D466] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- y --- -- [0x1D467] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- z --- [0x1D6FC] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \alpha --- [0x1D6FD] = { width = 0.9, italic = 0, anchor = 1.05 }, -- \beta --- [0x1D6FE] = { xoffset = -0.075, width = 0.85, italic = 0.05, anchor = 1.05 }, -- \gamma --- [0x1D6FF] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \delta --- [0x1D716] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \epsilon --- [0x1D700] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \varepsilon --- [0x1D701] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \zeta --- [0x1D702] = { xoffset = -0.1, width = 0.85, italic = 0, anchor = 1.05 }, -- \eta --- [0x1D703] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \theta --- [0x1D717] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \vartheta --- [0x1D704] = { xoffset = -0.1, width = 0.9, italic = 0, anchor = 1.05 }, -- \iota --- [0x1D705] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \kappa --- [0x1D706] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.05 }, -- \lambda --- [0x1D707] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \mu --- [0x1D708] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \nu --- [0x1D709] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \xi --- [0x1D70A] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \omicron --- [0x1D70B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \pi --- [0x1D71B] = { xoffset = -0.07, width = 0.85, italic = 0 }, -- \varpi --- [0x1D70C] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \rho --- [0x1D71A] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \varrho --- [0x1D70D] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varsigma --- [0x1D70E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \sigma --- [0x1D70F] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.05 }, -- \tau --- [0x1D710] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.03 }, -- \upsilon --- [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi --- [0x1D711] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varphi --- [0x1D712] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \chi --- [0x1D713] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \psi --- [0x1D714] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \omega --- -- [0x1D718] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \varkappa --- [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi --- [0x1D41B] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright b --- [0x1D41D] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright d --- [0x1D41F] = { width = 1.25, italic = 0, anchor = 0.8 }, -- bold lowercase upright f --- [0x1D420] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright g --- [0x1D421] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright h --- [0x1D424] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright k --- [0x1D425] = { width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase upright l --- [0x1D42A] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright q --- [0x1D42B] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright r --- [0x1D42C] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright s --- -- [0x1D482] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic a --- -- [0x1D483] = { width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic b --- -- [0x1D484] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic c --- -- [0x1D485] = { width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase italic d --- -- [0x1D486] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic e --- -- [0x1D487] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic f --- -- [0x1D488] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic g --- -- [0x1D489] = { width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic h --- -- [0x1D48A] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase italic i --- -- [0x1D48B] = { width = 1, italic = 0, anchor = 0.8 }, -- bold lowercase italic j --- -- [0x1D48C] = { width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic k --- -- [0x1D48D] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic l --- -- [0x1D492] = { width = 1, italic = 0, anchor = 0.85 }, -- bold lowercase italic q --- -- [0x1D493] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic r --- -- [0x1D497] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic v --- -- [0x1D499] = { width = 1.1, italic = 0, anchor = 0.9 }, -- bold lowercase italic x --- -- [0x1D49A] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic y --- -- [0x1D49B] = { width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic z --- [0x1D743] = { width = 1, italic = 0, anchor = 1.7 }, -- bold lowercase italic greek xi --- -- [0x1D435] = { anchor = 1.05 }, -- italic B --- -- [0x1D436] = { xoffset = -0.1, anchor = 0.7 }, -- italic C --- -- [0x1D437] = { anchor = 1.25 }, -- italic D --- -- [0x1D43A] = { anchor = 0.8 }, -- italic G --- -- [0x1D442] = { anchor = 0.85 }, -- italic O --- -- [0x1D443] = { anchor = 1.1 }, -- italic P --- -- [0x1D444] = { anchor = 0.85 }, -- italic Q --- -- [0x1D445] = { xoffset = -0.025, width = 1.05, anchor = 1.05 }, -- italic R --- -- [0x1D446] = { xoffset = -0.05, anchor = 0.85 }, -- italic S --- -- [0x1D447] = { xoffset = -0.05, width = 1.05, italic = 0.7, anchor = 0.9, }, -- italic T --- -- [0x1D448] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic U --- -- [0x1D449] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic V --- -- [0x1D44A] = { xoffset = -0.075, italic = 0.3, anchor = 0.9, }, -- italic W --- -- [0x1D44C] = { xoffset = -0.075, width = 1.1, italic = 0.35, anchor = 0.9, }, -- italic Y +-- [0x00393] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Gamma +-- [0x00394] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \Delta +-- [0x00398] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Theta +-- [0x0039B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Lambda +-- [0x0039E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Xi +-- [0x003A0] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Pi +-- [0x003A3] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Sigma +-- [0x003A5] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \Upsilon +-- [0x003A6] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Phi +-- [0x003A8] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Psi +-- [0x003A9] = { xoffset = -0.05, width = 0.9, italic = 0 }, -- \Omega +-- [0x02202] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \partial +-- [0x1D43A] = { xoffset = -0.1, width = 1, italic = 0 }, -- G +-- [0x1D442] = { xoffset = -0.1, width = 1, italic = 0 }, -- O +-- [0x1D444] = { xoffset = -0.05, width = 1.025, italic = 0 }, -- Q +-- [0x1D44E] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.8 }, -- a +-- [0x1D44F] = { xoffset = -0.05, width = 1.1, italic = 0 }, -- b +-- [0x1D450] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- c +-- [0x1D451] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.75 }, -- d +-- [0x1D452] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- e +-- [0x1D453] = { xoffset = 0.45, width = 1.9, italic = 0.45, anchor = 1.1 }, -- f +-- [0x1D454] = { xoffset = 0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- g +-- [0x0210E] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 1.15 }, -- h +-- [0x1D456] = { xoffset = -0.2, width = 1.1, italic = 0 }, -- i +-- [0x1D457] = { xoffset = 0.6, width = 1.7, italic = 0.45 }, -- j +-- [0x1D458] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 1.15 }, -- k +-- [0x1D459] = { xoffset = -0.15, width = 1.1, italic = 0, anchor = 0.8 }, -- l +-- [0x1D45A] = { xoffset = -0.05, width = 1, italic = 0 }, -- m +-- [0x1D45B] = { xoffset = -0.1, width = 1, italic = 0, anchor = 0.9 }, -- n +-- [0x1D45C] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- o +-- [0x1D45D] = { width = 1.05, italic = 0 }, -- p +-- [0x1D45E] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.9 }, -- q +-- [0x1D45F] = { xoffset = -0.1, width = 1.15, italic = 0, anchor = 0.9 }, -- r +-- [0x1D460] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- s +-- [0x1D461] = { xoffset = -0.15, width = 1.2, italic = 0, anchor = 0.9 }, -- t +-- [0x1D462] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- u +-- [0x1D463] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 0.85 }, -- v +-- [0x1D464] = { xoffset = -0.05, width = 1.05, italic = 0, anchor = 0.95 }, -- w +-- [0x1D465] = { width = 1.175, italic = 0, anchor = 0.9 }, -- x +-- [0x1D466] = { xoffset = -0.05, width = 1.05, italic = 0 }, -- y +-- [0x1D467] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- z +-- [0x1D6FC] = { xoffset = -0.075, width = 0.825, italic = 0 }, -- \alpha +-- [0x1D6FD] = { width = 0.9, italic = 0, anchor = 1.05 }, -- \beta +-- [0x1D6FE] = { xoffset = -0.075, width = 0.85, italic = 0.05, anchor = 1.05 }, -- \gamma +-- [0x1D6FF] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \delta +-- [0x1D716] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \epsilon +-- [0x1D700] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \varepsilon +-- [0x1D701] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \zeta +-- [0x1D702] = { xoffset = -0.1, width = 0.85, italic = 0, anchor = 1.05 }, -- \eta +-- [0x1D703] = { xoffset = -0.1, width = 0.85, italic = 0 }, -- \theta +-- [0x1D717] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \vartheta +-- [0x1D704] = { xoffset = -0.1, width = 0.9, italic = 0, anchor = 1.05 }, -- \iota +-- [0x1D705] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \kappa +-- [0x1D706] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.05 }, -- \lambda +-- [0x1D707] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \mu +-- [0x1D708] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \nu +-- [0x1D709] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \xi +-- [0x1D70A] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \omicron +-- [0x1D70B] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \pi +-- [0x1D71B] = { xoffset = -0.07, width = 0.85, italic = 0 }, -- \varpi +-- [0x1D70C] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \rho +-- [0x1D71A] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \varrho +-- [0x1D70D] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varsigma +-- [0x1D70E] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \sigma +-- [0x1D70F] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.05 }, -- \tau +-- [0x1D710] = { xoffset = -0.08, width = 0.85, italic = 0, anchor = 1.03 }, -- \upsilon +-- [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi +-- [0x1D711] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.02 }, -- \varphi +-- [0x1D712] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \chi +-- [0x1D713] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \psi +-- [0x1D714] = { xoffset = -0.05, width = 0.875, italic = 0 }, -- \omega +-- -- [0x1D718] = { xoffset = -0.075, width = 0.85, italic = 0, anchor = 1.03 }, -- \varkappa +-- [0x1D719] = { xoffset = -0.075, width = 0.85, italic = 0 }, -- \phi +-- [0x1D41B] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright b +-- [0x1D41D] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright d +-- [0x1D41F] = { width = 1.25, italic = 0, anchor = 0.8 }, -- bold lowercase upright f +-- [0x1D420] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase upright g +-- [0x1D421] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright h +-- [0x1D424] = { width = 1, italic = 0, anchor = 1.5 }, -- bold lowercase upright k +-- [0x1D425] = { width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase upright l +-- [0x1D42A] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright q +-- [0x1D42B] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright r +-- [0x1D42C] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase upright s +-- -- [0x1D482] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic a +-- -- [0x1D483] = { width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic b +-- -- [0x1D484] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic c +-- -- [0x1D485] = { width = 1, italic = 0, anchor = 0.75 }, -- bold lowercase italic d +-- -- [0x1D486] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic e +-- -- [0x1D487] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic f +-- -- [0x1D488] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic g +-- -- [0x1D489] = { width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic h +-- -- [0x1D48A] = { width = 1, italic = 0, anchor = 0.6 }, -- bold lowercase italic i +-- -- [0x1D48B] = { width = 1, italic = 0, anchor = 0.8 }, -- bold lowercase italic j +-- -- [0x1D48C] = { width = 1, italic = 0, anchor = 1.2 }, -- bold lowercase italic k +-- -- [0x1D48D] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic l +-- -- [0x1D492] = { width = 1, italic = 0, anchor = 0.85 }, -- bold lowercase italic q +-- -- [0x1D493] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic r +-- -- [0x1D497] = { width = 1, italic = 0, anchor = 0.9 }, -- bold lowercase italic v +-- -- [0x1D499] = { width = 1.1, italic = 0, anchor = 0.9 }, -- bold lowercase italic x +-- -- [0x1D49A] = { width = 1, italic = 0, anchor = 0.95 }, -- bold lowercase italic y +-- -- [0x1D49B] = { width = 1, italic = 0, anchor = 1.1 }, -- bold lowercase italic z +-- [0x1D743] = { width = 1, italic = 0, anchor = 1.7 }, -- bold lowercase italic greek xi +-- -- [0x1D435] = { anchor = 1.05 }, -- italic B +-- -- [0x1D436] = { xoffset = -0.1, anchor = 0.7 }, -- italic C +-- -- [0x1D437] = { anchor = 1.25 }, -- italic D +-- -- [0x1D43A] = { anchor = 0.8 }, -- italic G +-- -- [0x1D442] = { anchor = 0.85 }, -- italic O +-- -- [0x1D443] = { anchor = 1.1 }, -- italic P +-- -- [0x1D444] = { anchor = 0.85 }, -- italic Q +-- -- [0x1D445] = { xoffset = -0.025, width = 1.05, anchor = 1.05 }, -- italic R +-- -- [0x1D446] = { xoffset = -0.05, anchor = 0.85 }, -- italic S +-- -- [0x1D447] = { xoffset = -0.05, width = 1.05, italic = 0.7, anchor = 0.9, }, -- italic T +-- -- [0x1D448] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic U +-- -- [0x1D449] = { xoffset = -0.125, italic = 0.3, anchor = 0.9, }, -- italic V +-- -- [0x1D44A] = { xoffset = -0.075, italic = 0.3, anchor = 0.9, }, -- italic W +-- -- [0x1D44C] = { xoffset = -0.075, width = 1.1, italic = 0.35, anchor = 0.9, }, -- italic Y diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg index 8f9cf73b9..9cece8369 100644 --- a/tex/context/fonts/mkiv/cambria-math.lfg +++ b/tex/context/fonts/mkiv/cambria-math.lfg @@ -1,51 +1,3 @@ -local dimensions, kerns, kernpairs if CONTEXTLMTXMODE == 0 then - - kernpairs = { -- \setupmathematics[kernpairs=yes] - [0x1D44E] = { - [0x1D44F] = 1000, -- 𝑎𝑏 demo - } - } - - kerns = { - [0x1D453] = { - force = true, - topright = { - { - kern = 1000, - }, - }, - bottomright = { - { - kern = 1000, - }, - }, - }, - } - -end - --- local patches = fonts.handlers.otf.enhancers.patches --- --- local function patch(data,filename,threshold) --- local m = data.metadata.math --- if m then --- local d = m.DisplayOperatorMinHeight or 0 --- if d < threshold then --- patches.report("DisplayOperatorMinHeight(%s -> %s)",d,threshold) --- m.DisplayOperatorMinHeight = threshold --- end --- end --- end --- --- patches.register("after","analyze math","cambria", function(data,filename) patch(data,filename,2800) end) --- patches.register("after","analyze math","cambmath",function(data,filename) patch(data,filename,2800) end) - --- -- We could stick to the italic correction here --- --- local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } --- local integral_bottom = { bottomright = -0.30 } - local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -59,9 +11,9 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 1000, - -- AccentTopShiftUp = 0, - -- FlattenedAccentTopShiftUp = 0, - -- AccentExtendMargin = 50, + -- AccentTopShiftUp = 0, + -- FlattenedAccentTopShiftUp = 0, + -- AccentExtendMargin = 50, AccentBaseDepth = 300, RadicalDegreeBottomRaisePercent = 65, RadicalKernAfterDegree = -900, @@ -77,15 +29,20 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.97 }, - presets.mathrsfscript { rscale = 0.97 }, - presets.mathxitsarabic { rscale = 0.95 }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.97 }, + presets.rsfsuprighttoscript { rscale = 0.97 }, + presets.moderntocalligraphic { rscale = 0.97 }, + presets.eulertocalligraphic { rscale = 0.97 }, + presets.xitsarabic { rscale = 0.95 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5}, -- needs checking + presets.wipeitalics { }, { tweak = "simplifykerns", }, - presets.moveitalics { - correct = true - }, { tweak = "kerns", list = { @@ -237,48 +194,38 @@ return { bigslots = { 1, 2, 3, 4 }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, - kernpairs = kernpairs, }, } - --- Old - -- { - -- tweak = "dimensions", - -- list = { - - -- -- [0x00060] = { yoffset = -0.1 }, -- grave - -- -- [0x000B4] = { yoffset = -0.1 }, -- acute - -- -- [0x002C6] = { yoffset = -0.1 }, -- hat - -- -- [0x002DC] = { yoffset = -0.1 }, -- tilde - -- -- [0x000AF] = { yoffset = -0.1 }, -- bar - -- -- [0x002D8] = { yoffset = -0.15 }, -- breve - -- -- [0x002D9] = { yoffset = -0.15 }, -- dot - -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot - -- -- [0x020DB] = { yoffset = -0.05 }, -- dddot - -- -- [0x002C7] = { yoffset = -0.1 }, -- check - -- -- [0x020D7] = { yoffset = -0.05 }, -- vec - - -- -- [0x00300] = { yoffset = -0.12, all=true }, -- widegrave - -- -- [0x00301] = { yoffset = -0.12, all=true }, -- wideacute - -- -- [0x00302] = { yoffset = -0.12, all=true }, -- widehat - -- -- [0x00303] = { yoffset = -0.12, all=true }, -- widetilde - -- -- [0x00304] = { yoffset = -0.12, all=true }, -- widebar - -- -- [0x00306] = { yoffset = -0.12, all=true }, -- widebreve - -- -- [0x00307] = { yoffset = -0.025, all=true }, -- widedot - -- -- [0x00308] = { yoffset = -0.025, all=true }, -- wideddot - -- -- [0x020DB] = { yoffset = -0.1, all=true }, -- widedddot - -- -- [0x0030A] = { yoffset = -0.12, all=true }, -- widering - -- -- [0x0030C] = { yoffset = -0.12, all=true }, -- widecheck - - -- [0x1D43D] = { xoffset = 0.25, width = 1.15, italic = 0.2 }, -- J - -- [0x1D487] = { anchor = 0.8 }, -- bold lower case italic f - -- -- [0x1D487] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- bold lower case italic f - - -- }, - -- }, +-- For now we keep these commented as they show where we came from. + +-- { +-- tweak = "dimensions", +-- list = { +-- -- [0x00060] = { yoffset = -0.1 }, -- grave +-- -- [0x000B4] = { yoffset = -0.1 }, -- acute +-- -- [0x002C6] = { yoffset = -0.1 }, -- hat +-- -- [0x002DC] = { yoffset = -0.1 }, -- tilde +-- -- [0x000AF] = { yoffset = -0.1 }, -- bar +-- -- [0x002D8] = { yoffset = -0.15 }, -- breve +-- -- [0x002D9] = { yoffset = -0.15 }, -- dot +-- -- [0x000A8] = { yoffset = -0.1 }, -- ddot +-- -- [0x020DB] = { yoffset = -0.05 }, -- dddot +-- -- [0x002C7] = { yoffset = -0.1 }, -- check +-- -- [0x020D7] = { yoffset = -0.05 }, -- vec +-- -- [0x00300] = { yoffset = -0.12, all=true }, -- widegrave +-- -- [0x00301] = { yoffset = -0.12, all=true }, -- wideacute +-- -- [0x00302] = { yoffset = -0.12, all=true }, -- widehat +-- -- [0x00303] = { yoffset = -0.12, all=true }, -- widetilde +-- -- [0x00304] = { yoffset = -0.12, all=true }, -- widebar +-- -- [0x00306] = { yoffset = -0.12, all=true }, -- widebreve +-- -- [0x00307] = { yoffset = -0.025, all=true }, -- widedot +-- -- [0x00308] = { yoffset = -0.025, all=true }, -- wideddot +-- -- [0x020DB] = { yoffset = -0.1, all=true }, -- widedddot +-- -- [0x0030A] = { yoffset = -0.12, all=true }, -- widering +-- -- [0x0030C] = { yoffset = -0.12, all=true }, -- widecheck +-- [0x1D43D] = { xoffset = 0.25, width = 1.15, italic = 0.2 }, -- J +-- [0x1D487] = { anchor = 0.8 }, -- bold lower case italic f +-- -- [0x1D487] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- bold lower case italic f +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/common-math.lfg b/tex/context/fonts/mkiv/common-math.lfg index d97511e76..c2c690bf1 100644 --- a/tex/context/fonts/mkiv/common-math.lfg +++ b/tex/context/fonts/mkiv/common-math.lfg @@ -7,10 +7,51 @@ return { mathematics = { tweaks = { presets = { - matheulercalligraphic = function(parameters) + fallbacks = function(parameters) + return { + tweak = "fallbacks", + } + end, + scripttocalligraphic = function(parameters) + return { + tweak = "replacealphabets", + feature = "scripttocalligraphic", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + }, + }, + } + end, + moderntocalligraphic = function(parameters) + return { + tweak = "replacealphabets", + feature = "moderntocalligraphic", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + filename = "latinmodern-math.otf", + rscale = parameters.rscale, + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + filename = "latinmodern-math.otf", + rscale = parameters.rscale, + }, + }, + } + end, + eulertocalligraphic = function(parameters) return { tweak = "replacealphabets", - feature = "matheulercalligraphic", + feature = "eulertocalligraphic", list = { { source = "uppercasescript", @@ -27,10 +68,30 @@ return { }, } end, - mathrsfscript = function(parameters) + rsfstoscript = function(parameters) return { tweak = "replacealphabets", - feature = "mathrsfscript", + feature = "rsfstoscript", + list = { + { + source = "uppercasescript", + target = "uppercasescript", + filename = "ralphsmithsformalscript-companion.otf", + rscale = parameters.rscale, + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldscript", + filename = "ralphsmithsformalscript-companion.otf", + rscale = parameters.rscale, + }, + }, + } + end, + rsfsuprighttoscript = function(parameters) + return { + tweak = "replacealphabets", + feature = "rsfsuprighttoscript", list = { { source = "uppercasescript", @@ -49,10 +110,10 @@ return { }, } end, - mathxitsarabic = function(parameters) + xitsarabic = function(parameters) return { tweak = "replacealphabets", - feature = "mathxitsarabic", + feature = "xitsarabic", list = { { source = "arabicmathematicalalphabeticsymbols", @@ -79,7 +140,8 @@ return { return { tweak = "moveitalics", correct = parameters.correct, - list = { + list = (parameters.all and "all") or (parameters.letters and "letters") or { + -- "lowercasenormal", "lowercaseitalic", "lowercasebold", @@ -88,6 +150,19 @@ return { "lowercasegreekitalic", "lowercasegreekbold", "lowercasegreekbolditalic", + "lowercaseboldfraktur", + "lowercaseboldscript", + "lowercasedoublestruck", + "lowercasefraktur", + "lowercasegreeksansserifbold", + "lowercasegreeksansserifbolditalic", + "lowercasemonospace", + "lowercasesansserifbold", + "lowercasesansserifbolditalic", + "lowercasesansserifitalic", + "lowercasesansserifnormal", + "lowercasescript", + -- "uppercasenormal", "uppercaseitalic", "uppercasebold", @@ -96,10 +171,95 @@ return { "uppercasegreekitalic", "uppercasegreekbold", "uppercasegreekbolditalic", + "uppercaseboldfraktur", + "uppercasebolditalic", + "uppercaseboldscript", + "uppercasedoublestruck", + "uppercasefraktur", + "uppercasegreeksansserifbold", + "uppercasegreeksansserifbolditalic", + "uppercasemonospace", + "uppercasesansserifbold", + "uppercasesansserifbolditalic", + "uppercasesansserifitalic", + "uppercasesansserifnormal", + "uppercasescript", + -- + "digitsbold", + "digitsdoublestruck", + "digitslatin", + "digitsmonospace", + "digitsnormal", + "digitssansserifbold", + "digitssansserifnormal", + -- + -- We don't do these (one can use all=true) because now we can get + -- more details about what gets italics. + -- + -- "latinextendeda", + -- "latinextendedadditional", + -- "latinextendedb", + -- "latinextendedc", + -- "latinextendedd", + -- "latinextendede", + -- "latinextendedf", + -- "latinextendedg", + -- "latinsupplement", + -- mathematics.tweaks.subsets.dotless, } } end, + moveintegrals = function(parameters) + return { + tweak = "movelimits", + factor = parameters.factor or 1, + list = mathematics.tweaks.subsets.integrals, + } + end, + wipeitalics = function(parameters) + return { + tweak = "wipeitalics", + all = true, + } + end, + wipeanchors = function(parameters) + return { + -- For upright alphabets, we unset the anchor. This means that accents are placed + -- centered over the character. Should be on top. + tweak = "wipeanchors", + list = { + "digitsbold", + "digitsdoublestruck", + "digitsmonospace", + "digitsnormal", + "digitssansserifbold", + "digitssansserifnormal", + "lowercasebold", + "lowercaseboldfraktur", + "lowercasedoublestruck", + "lowercasefraktur", + "lowercasegreekbold", + "lowercasegreeknormal", + "lowercasegreeksansserifbold", + "lowercasemonospace", + "lowercasenormal", + "lowercasesansserifbold", + "lowercasesansserifnormal", + "uppercasebold", + "uppercaseboldfraktur", + "uppercasedoublestruck", + "uppercasefraktur", + "uppercasegreekbold", + "uppercasegreeknormal", + "uppercasegreeksansserifbold", + "uppercasemonospace", + "uppercasenormal", + "uppercasesansserifbold", + "uppercasesansserifnormal", + }, + } + end, }, }, }, diff --git a/tex/context/fonts/mkiv/concrete-math.lfg b/tex/context/fonts/mkiv/concrete-math.lfg index fd2d5caad..68d686593 100644 --- a/tex/context/fonts/mkiv/concrete-math.lfg +++ b/tex/context/fonts/mkiv/concrete-math.lfg @@ -1,5 +1,3 @@ --- this file might go away and is for experiments only - local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -27,8 +25,16 @@ return { -- { -- tweak = "addmirrors", -- }, --- presets.matheulercalligraphic { rscale = 0.97 }, --- presets.mathrsfscript { rscale = 0.95 }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, { tweak = "kerns", list = { @@ -52,13 +58,17 @@ return { tweak = "setoptions", set = { "ignorekerndimensions" } }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { 1, 2, 3, 4 }, }, - } - diff --git a/tex/context/fonts/mkiv/dejavu-math.lfg b/tex/context/fonts/mkiv/dejavu-math.lfg index d18082b85..70eecb27e 100644 --- a/tex/context/fonts/mkiv/dejavu-math.lfg +++ b/tex/context/fonts/mkiv/dejavu-math.lfg @@ -1,21 +1,9 @@ -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - local kern_V = { bottomright = { { kern = -250 } } } - local kern_W = kern_W - - kerns = { - [0x1D449] = kern_V, -- 𝑉 - [0x1D44A] = kern_W, -- 𝑊 - } - -end +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets local integral_variants = { bottomright = -0.20 } local integral_bottom = { bottomright = -0.25 } -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets - return { name = "dejavu-math", version = "1.00", @@ -54,10 +42,17 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 1.02 }, - presets.mathrsfscript { rscale = 1.02 }, - presets.mathxitsarabic { rscale = 1.05 }, - presets.moveitalics { correct = true }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 1.02 }, + presets.rsfsuprighttoscript { rscale = 1.02 }, + presets.moderntocalligraphic { rscale = 1.02 }, + presets.eulertocalligraphic { rscale = 1.02 }, + presets.xitsarabic { rscale = 1.05 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, -- we need to check this + presets.wipeitalics { }, { tweak = "kerns", list = { @@ -71,7 +66,7 @@ return { ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants - [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, @@ -167,6 +162,12 @@ return { tweak = "addfourier", variant = 1, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, alternates = { @@ -183,15 +184,14 @@ return { }, } +-- For now we keep these commented as they show where we came from. - --- Old - -- { - -- tweak = "dimensions", - -- list = { - -- [0x1D44E] = { width = 1, italic = 0, anchor = 0.9 }, -- a - -- -- [0x1D449] = { width = .8, italic = .2 }, - -- -- [0x1D44A] = { width = .8, italic = .2 }, - -- ["0x1D449:0x1D44A"] = { width = .8, italic = .2 }, - -- } - -- }, +-- { +-- tweak = "dimensions", +-- list = { +-- [0x1D44E] = { width = 1, italic = 0, anchor = 0.9 }, -- a +-- -- [0x1D449] = { width = .8, italic = .2 }, +-- -- [0x1D44A] = { width = .8, italic = .2 }, +-- ["0x1D449:0x1D44A"] = { width = .8, italic = .2 }, +-- } +-- }, diff --git a/tex/context/fonts/mkiv/erewhon-math.lfg b/tex/context/fonts/mkiv/erewhon-math.lfg index fe8bb7108..e366ee12e 100644 --- a/tex/context/fonts/mkiv/erewhon-math.lfg +++ b/tex/context/fonts/mkiv/erewhon-math.lfg @@ -1,4 +1,5 @@ --- This file might go away and is for experiments only. +-- This font is under active development so we don't want to tweek it too much +-- before all issues are sorted out. local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -32,9 +33,17 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.93 }, - presets.mathrsfscript { rscale = 0.93 }, - presets.mathxitsarabic { rscale = 0.90 }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.90 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, { tweak = "kerns", list = { @@ -76,6 +85,12 @@ return { tweak = "setoptions", set = { "ignorekerndimensions" } }, + -- this is the mkiv section +-- { +-- tweak = "emulatelmtx", +-- feature = "emulatelmtx", +-- comment = "this is for mkiv", +-- }, }, }, bigslots = { @@ -84,5 +99,3 @@ return { }, } - - diff --git a/tex/context/fonts/mkiv/euler-math.lfg b/tex/context/fonts/mkiv/euler-math.lfg index 9e5efa680..1c4659786 100644 --- a/tex/context/fonts/mkiv/euler-math.lfg +++ b/tex/context/fonts/mkiv/euler-math.lfg @@ -1,4 +1,5 @@ --- this file might go away and is for experiments only +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets return { name = "euler-math", @@ -8,26 +9,119 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - DelimiterPercent = 901, - DelimiterShortfall = 500, + -- DelimiterPercent = 90, + -- DelimiterShortfall = 500, + -- taken from pagella: + NoLimitSupFactor = 0, + NoLimitSubFactor = 900, + AccentTopShiftUp = 10, + FlattenedAccentTopShiftUp = 10, + -- AccentExtendMargin = 50, + -- AccentBaseHeight = 0, + AccentBaseDepth = 80, + -- SpaceAfterScript = 0, + -- SpaceAfterScript = 30, + RadicalDegreeBottomRaisePercent = 60, + RadicalKernAfterDegree = -500, + RadicalRuleThickness = 60, -- 60 in font + DelimiterPercent = 90, + DelimiterShortfall = 400, + DisplayOperatorMinHeight = 1800, -- 1500 in font + PrimeRaisePercent = 75, -- 50 default + PrimeRaiseComposedPercent = 10, -- 25 default + -- RadicalKernAfterExtensible = 0, -- 0 default + -- RadicalKernBeforeExtensible = 0, -- 0 default + }, tweaks = { aftercopying = { { + tweak = "version", + expected = "Version 000.002 ", + }, + { tweak = "fixprimes", - factor = 0.9, + factor = 1.2, smaller = true, - scale = 0.60, - fake = 0.75, + scale = 0.80, + fake = 0.80, + }, + { + tweak = "replacealphabets", + feature = "pagellaovereuler", + filename = "texgyrepagella-math.otf", + list = { + -- { source = { first = 0x02100, last = 0x0210D } }, -- no 0x2210E + -- { source = { first = 0x0210F, last = 0x02BFF } }, + { source = { first = 0x02100, last = 0x02BFF } }, + { source = { first = 0x1D400, last = 0x1D7FF } }, + { source = { first = 0x1D538, last = 0x1D550 } }, + }, + }, + { + tweak = "addmirrors", + }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 1 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { }, + presets.wipeitalics { }, + { + tweak = "fixoldschool", + }, + -- add the accent fixes + -- fixslashes? + { + tweak = "checkspacing", + }, + { + tweak = "addscripts", + }, + { + tweak = "addprivates", + }, + { + tweak = "accentdimensions", + }, + { + tweak = "addrules", + }, + { + tweak = "addarrows", + }, + { + tweak = "addbars", + advance = 0.2, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", }, }, }, bigslots = { 1, 3, 5, 7 }, + alternates = { + dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" }, + }, }, - - } - - diff --git a/tex/context/fonts/mkiv/garamond-math.lfg b/tex/context/fonts/mkiv/garamond-math.lfg index a0a0700f5..9537f52b9 100644 --- a/tex/context/fonts/mkiv/garamond-math.lfg +++ b/tex/context/fonts/mkiv/garamond-math.lfg @@ -42,19 +42,20 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.95 }, - presets.mathrsfscript { rscale = 0.95 }, - presets.mathxitsarabic { rscale = 0.80 }, - { - tweak = "oldstylemath", - factor = 0, - }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.95 }, + presets.rsfsuprighttoscript { rscale = 0.95 }, + presets.moderntocalligraphic { rscale = 0.95 }, + presets.eulertocalligraphic { rscale = 0.95 }, + presets.xitsarabic { rscale = 0.80 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, { tweak = "simplifykerns", }, - presets.moveitalics { - correct = true - }, { tweak = "topanchors", list = { @@ -62,15 +63,10 @@ return { }, }, { - tweak = "limits", - factor = 1.5, - list = mathematics.tweaks.subsets.integrals, - }, - { tweak = "dimensions", list = { -- for older entries, see bottom of file - [0x1D453] = { width = 1.1, }, -- italic f + [0x1D453] = { width = 1.1 }, -- italic f }, }, { @@ -140,10 +136,10 @@ return { [mathematics.tweaks.subsets.f] = -.25, [0x1D70C] = -.25, -- italic \rho }, - -- "uppercaseitalic" = { - -- [mathematics.tweaks.subsets.f] = -.25, - -- [0x1D70C] = -.25, -- italic \rho - -- }, + -- ["uppercaseitalic"] = { + -- [mathematics.tweaks.subsets.f] = -.25, + -- [0x1D70C] = -.25, -- italic \rho + -- }, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -160,10 +156,10 @@ return { { tweak = "dimensions", list = { - -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent @@ -192,39 +188,6 @@ return { { tweak = "copyaccents", }, - -- So far for the accents. - { - -- For non-italic alphabets we remove italic correction. - -- This one is/will become obsolete - -- tweak = "wipeitalics", - list = { - "digitsbold", - "digitsdoublestruck", - "digitsmonospace", - "digitsnormal", - "digitssansserifbold", - "digitssansserifnormal", - -- "lowercasebold", - "lowercaseboldfraktur", - "lowercasedoublestruck", - "lowercasefraktur", - "lowercasemonospace", - -- "lowercasenormal", - "lowercasesansserifbold", - -- "lowercasesansserifnormal", - -- "lowercasegreeknormal", - -- "uppercasebold", - "uppercaseboldfraktur", - "uppercasedoublestruck", - "uppercasefraktur", - "uppercasegreekbold", - "uppercasegreeknormal", - "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasesansserifbold", - "uppercasesanserifnormal", -- some remain - }, - }, { tweak = "checkspacing", }, @@ -251,6 +214,12 @@ return { tweak = "addfourier", variant = 1, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, { tweak = "diagnose", }, @@ -272,82 +241,78 @@ return { }, } +-- For now we keep these commented as they show where we came from. +-- { +-- tweak = "dimensions", +-- list = { +-- -- offset width italic +-- -- -- [0x00060] = { yoffset = -0.1 }, -- grave +-- -- -- [0x000B4] = { yoffset = -0.1 }, -- acute +-- -- [0x002C6] = { yoffset = -0.1 }, -- hat +-- -- [0x002DC] = { yoffset = -0.1 }, -- tilde +-- -- -- [0x000AF] = { yoffset = -0.1 }, -- bar +-- -- [0x002D8] = { yoffset = -0.15 }, -- breve +-- -- [0x002D9] = { yoffset = -0.15 }, -- dot +-- -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot +-- -- [0x020DB] = { yoffset = -0.115 }, -- dddot +-- -- [0x002C7] = { yoffset = -0.1 }, -- check +-- -- [0x020D7] = { yoffset = -0.1 }, -- vec +-- -- [0x00300] = { yoffset = -0.12 , all = true }, -- widegrave +-- -- [0x00301] = { yoffset = -0.12 , all = true }, -- wideacute +-- -- [0x00302] = { yoffset = -0.12 , all = true }, -- widehat +-- -- [0x00303] = { yoffset = -0.12 , all = true }, -- widetilde +-- -- [0x00304] = { yoffset = -0.12 , all = true }, -- widebar +-- -- [0x00306] = { yoffset = -0.12 , all = true }, -- widebreve +-- -- [0x00307] = { yoffset = -0.12 , all = true }, -- widedot +-- -- [0x00308] = { yoffset = -0.12 , all = true }, -- wideddot +-- -- -- [0x020DB] = { yoffset = -0.1 , all = true }, -- widedddot +-- -- [0x0030A] = { yoffset = -0.12 , all = true }, -- widering +-- -- [0x0030C] = { yoffset = -0.12 , all = true }, -- widecheck --- Some old entries: - - -- { - -- tweak = "dimensions", - -- list = { - -- -- offset width italic - -- -- -- [0x00060] = { yoffset = -0.1 }, -- grave - -- -- -- [0x000B4] = { yoffset = -0.1 }, -- acute - -- -- [0x002C6] = { yoffset = -0.1 }, -- hat - -- -- [0x002DC] = { yoffset = -0.1 }, -- tilde - -- -- -- [0x000AF] = { yoffset = -0.1 }, -- bar - -- -- [0x002D8] = { yoffset = -0.15 }, -- breve - -- -- [0x002D9] = { yoffset = -0.15 }, -- dot - -- -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot - -- -- [0x020DB] = { yoffset = -0.115 }, -- dddot - -- -- [0x002C7] = { yoffset = -0.1 }, -- check - -- -- [0x020D7] = { yoffset = -0.1 }, -- vec - - -- -- [0x00300] = { yoffset = -0.12 , all = true }, -- widegrave - -- -- [0x00301] = { yoffset = -0.12 , all = true }, -- wideacute - -- -- [0x00302] = { yoffset = -0.12 , all = true }, -- widehat - -- -- [0x00303] = { yoffset = -0.12 , all = true }, -- widetilde - -- -- [0x00304] = { yoffset = -0.12 , all = true }, -- widebar - -- -- [0x00306] = { yoffset = -0.12 , all = true }, -- widebreve - -- -- [0x00307] = { yoffset = -0.12 , all = true }, -- widedot - -- -- [0x00308] = { yoffset = -0.12 , all = true }, -- wideddot - -- -- -- [0x020DB] = { yoffset = -0.1 , all = true }, -- widedddot - -- -- [0x0030A] = { yoffset = -0.12 , all = true }, -- widering - -- -- [0x0030C] = { yoffset = -0.12 , all = true }, -- widecheck - - -- -- [0x002C6] = { scale =.85, yoffset = .1, width = .85, height = .935 }, -- hat - - -- [0x00393] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Gamma - -- -- [0x003A6] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \Phi difficult! - -- [0x003A8] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Psi - -- [0x02113] = { width = 1, italic = 0.075 }, -- \ell - -- [0x1D436] = { width = 1, italic = 0.05 }, -- C - -- [0x1D43D] = { xoffset = 0.3, width = 1.4, italic = 0.1 }, -- J - -- [0x1D44B] = { width = 1, italic = 0.05 }, -- X - -- [0x1D44F] = { width = 1, italic = 0, }, -- b - -- [0x1D450] = { width = 1.1, italic = 0 }, -- c - -- [0x1D451] = { width = 1, italic = 0.05, }, -- d - -- [0x1D452] = { width = 1.1, italic = 0.05 }, -- e - -- [0x00066] = { width = 1.4, italic = 0.0, }, -- f - -- [0x1D453] = { xoffset = 0.15, width = 1.15, italic = 0.1, }, -- f - -- [0x1D454] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- g - -- [0x0210E] = { width = 1.1, italic = 0, }, -- h - -- [0x1D457] = { xoffset = 0.2, width = 1.25, italic = 0.05 }, -- j - -- [0x1D458] = { width = 1, italic = 0, }, -- k - -- [0x1D459] = { width = 1, italic = 0.05 }, -- l - -- [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, }, -- p - -- [0x1D45E] = { width = 1.05, italic = 0 }, -- q - -- [0x1D45F] = { width = 1.05, italic = 0 }, -- r - -- [0x1D461] = { width = 1, italic = 0.1 }, -- t - -- [0x1D465] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- x - -- [0x1D466] = { xoffset = 0.2, width = 1.2, italic = 0, }, -- y - -- [0x1D6FD] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- \beta - -- [0x1D6FE] = { width = 1.05, italic = 0 }, -- \gamma - -- [0x1D6FF] = { width = 1, italic = 0.1 }, -- \delta - -- [0x1D716] = { width = 1.1, italic = 0 }, -- \epsilon - -- [0x1D700] = { width = 1.1, italic = 0 }, -- \varepsilon - -- [0x1D701] = { width = 1, italic = 0.15 }, -- \zeta - -- [0x1D703] = { width = 1, italic = 0.1 }, -- \theta - -- [0x1D705] = { width = 1, italic = 0.1 }, -- \kappa - -- [0x1D706] = { xoffset = 0.05, width = 1.1, italic = 0 }, -- \lambda - -- [0x1D707] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \mu - -- [0x1D708] = { width = 1.1, italic = 0 }, -- \nu - -- [0x1D709] = { width = 1.1, italic = 0 }, -- \xi - -- [0x1D70B] = { width = 1.05, italic = 0 }, -- \pi - -- [0x1D70C] = { xoffset = 0.2, width = 1.2, italic = 0 }, -- \rho - -- [0x1D70E] = { width = 1, italic = 0.1 }, -- \sigma - -- [0x1D70F] = { xoffset = 0.05, width = 1.05, italic = 0.1 }, -- \tau - -- [0x1D712] = { xoffset = 0.15, width = 1.2, italic = 0.05 }, -- \chi - -- [0x1D713] = { xoffset = 0.05, width = 1.05, italic = 0.05 }, -- \psi - -- }, - -- }, +-- -- [0x002C6] = { scale =.85, yoffset = .1, width = .85, height = .935 }, -- hat +-- [0x00393] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Gamma +-- -- [0x003A6] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \Phi difficult! +-- [0x003A8] = { xoffset = 0.05, width = 1.05, italic = 0.075 }, -- \Psi +-- [0x02113] = { width = 1, italic = 0.075 }, -- \ell +-- [0x1D436] = { width = 1, italic = 0.05 }, -- C +-- [0x1D43D] = { xoffset = 0.3, width = 1.4, italic = 0.1 }, -- J +-- [0x1D44B] = { width = 1, italic = 0.05 }, -- X +-- [0x1D44F] = { width = 1, italic = 0, }, -- b +-- [0x1D450] = { width = 1.1, italic = 0 }, -- c +-- [0x1D451] = { width = 1, italic = 0.05, }, -- d +-- [0x1D452] = { width = 1.1, italic = 0.05 }, -- e +-- [0x00066] = { width = 1.4, italic = 0.0, }, -- f +-- [0x1D453] = { xoffset = 0.15, width = 1.15, italic = 0.1, }, -- f +-- [0x1D454] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- g +-- [0x0210E] = { width = 1.1, italic = 0, }, -- h +-- [0x1D457] = { xoffset = 0.2, width = 1.25, italic = 0.05 }, -- j +-- [0x1D458] = { width = 1, italic = 0, }, -- k +-- [0x1D459] = { width = 1, italic = 0.05 }, -- l +-- [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, }, -- p +-- [0x1D45E] = { width = 1.05, italic = 0 }, -- q +-- [0x1D45F] = { width = 1.05, italic = 0 }, -- r +-- [0x1D461] = { width = 1, italic = 0.1 }, -- t +-- [0x1D465] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- x +-- [0x1D466] = { xoffset = 0.2, width = 1.2, italic = 0, }, -- y +-- [0x1D6FD] = { xoffset = 0.05, width = 1.1, italic = 0.05 }, -- \beta +-- [0x1D6FE] = { width = 1.05, italic = 0 }, -- \gamma +-- [0x1D6FF] = { width = 1, italic = 0.1 }, -- \delta +-- [0x1D716] = { width = 1.1, italic = 0 }, -- \epsilon +-- [0x1D700] = { width = 1.1, italic = 0 }, -- \varepsilon +-- [0x1D701] = { width = 1, italic = 0.15 }, -- \zeta +-- [0x1D703] = { width = 1, italic = 0.1 }, -- \theta +-- [0x1D705] = { width = 1, italic = 0.1 }, -- \kappa +-- [0x1D706] = { xoffset = 0.05, width = 1.1, italic = 0 }, -- \lambda +-- [0x1D707] = { xoffset = 0.05, width = 1.05, italic = 0 }, -- \mu +-- [0x1D708] = { width = 1.1, italic = 0 }, -- \nu +-- [0x1D709] = { width = 1.1, italic = 0 }, -- \xi +-- [0x1D70B] = { width = 1.05, italic = 0 }, -- \pi +-- [0x1D70C] = { xoffset = 0.2, width = 1.2, italic = 0 }, -- \rho +-- [0x1D70E] = { width = 1, italic = 0.1 }, -- \sigma +-- [0x1D70F] = { xoffset = 0.05, width = 1.05, italic = 0.1 }, -- \tau +-- [0x1D712] = { xoffset = 0.15, width = 1.2, italic = 0.05 }, -- \chi +-- [0x1D713] = { xoffset = 0.05, width = 1.05, italic = 0.05 }, -- \psi +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/generic-math.lfg b/tex/context/fonts/mkiv/generic-math.lfg index 214e479e0..2a55504da 100644 --- a/tex/context/fonts/mkiv/generic-math.lfg +++ b/tex/context/fonts/mkiv/generic-math.lfg @@ -36,7 +36,24 @@ return { -- whatever }, }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 1 }, + presets.rsfsuprighttoscript { rscale = 1 }, + presets.moderntocalligraphic { rscale = 1 }, + presets.eulertocalligraphic { rscale = 1 }, + presets.xitsarabic { rscale = 1 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, -- we need to check the 1.5 + presets.wipeanchors { }, + presets.wipeitalics { }, { + tweak = "simplifykerns", + }, + presets.moveitalics { + correct = true + }, { tweak = "fixprimes", factor = 0.85, -- accent base height smaller = true, -- replace multiples @@ -101,7 +118,7 @@ return { -- [0x21CB] = false, -- [0x21CC] = false, } - }, + }, -- { -- tweak = "limits", -- factor = 1.5, @@ -201,7 +218,7 @@ return { tweak = "margins", list = { }, - }, + }, -- { -- tweak = "fixanchors", -- factor = .5, @@ -222,6 +239,12 @@ return { { tweak = "wipecues", }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/kpfonts-math.lfg b/tex/context/fonts/mkiv/kpfonts-math.lfg index ed50baf3b..a4eff599f 100644 --- a/tex/context/fonts/mkiv/kpfonts-math.lfg +++ b/tex/context/fonts/mkiv/kpfonts-math.lfg @@ -1,3 +1,6 @@ +-- This font is under active development so we don't want to tweek it too much +-- before all issues are sorted out. + local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -82,9 +85,17 @@ return { }, }, }, - presets.matheulercalligraphic { rscale = 0.95 }, - presets.mathrsfscript { rscale = 0.95 }, - presets.mathxitsarabic { rscale = 0.92 }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.95 }, + presets.rsfsuprighttoscript { rscale = 0.95 }, + presets.moderntocalligraphic { rscale = 0.95 }, + presets.eulertocalligraphic { rscale = 0.95 }, + presets.xitsarabic { rscale = 0.92 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.4 }, + presets.wipeitalics { }, { tweak = "checkspacing", }, @@ -112,6 +123,12 @@ return { tweak = "setoptions", set = { "ignorekerndimensions" } }, + -- this is the mkiv section +-- { +-- tweak = "emulatelmtx", +-- feature = "emulatelmtx", +-- comment = "this is for mkiv", +-- }, }, }, alternates = { diff --git a/tex/context/fonts/mkiv/libertinus-math.lfg b/tex/context/fonts/mkiv/libertinus-math.lfg index ea6a27cad..5a1cbd088 100644 --- a/tex/context/fonts/mkiv/libertinus-math.lfg +++ b/tex/context/fonts/mkiv/libertinus-math.lfg @@ -47,38 +47,21 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.92 }, - presets.mathrsfscript { rscale = 0.92 }, - presets.mathxitsarabic { rscale = 0.85 }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.97 }, + presets.rsfsuprighttoscript { rscale = 0.97 }, + presets.moderntocalligraphic { rscale = 0.97 }, + presets.eulertocalligraphic { rscale = 0.97 }, + presets.xitsarabic { rscale = 0.85 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, { tweak = "simplifykerns", }, { - -- When it makes sense we get rid of italics. - tweak = "moveitalics", - correct = true, - list = { - "lowercasenormal", - "lowercaseitalic", - "lowercasebold", - "lowercasebolditalic", - "lowercasegreeknormal", - "lowercasegreekitalic", - "lowercasegreekbold", - "lowercasegreekbolditalic", - "uppercasenormal", - "uppercaseitalic", - "uppercasebold", - "uppercasebolditalic", - "uppercasegreeknormal", - "uppercasegreekitalic", - "uppercasegreekbold", - "uppercasegreekbolditalic", - mathematics.tweaks.subsets.dotless, - } - }, - - { tweak = "kerns", list = { [0x002F] = { topleft = -0.15, bottomright = -0.15 }, @@ -179,6 +162,12 @@ return { tweak = "setoptions", set = { "ignorekerndimensions" } }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { @@ -187,39 +176,39 @@ return { }, } --- Old values - -- { - -- tweak = "dimensions", - -- list = { - -- -- [0x00060] = { yoffset = -0.075 }, -- grave - -- -- [0x000B4] = { yoffset = -0.075 }, -- acute - -- -- [0x002C6] = { yoffset = -0.075 }, -- hat - -- -- [0x002DC] = { yoffset = -0.075 }, -- tilde - -- -- [0x000AF] = { yoffset = -0.1 }, -- bar - -- -- [0x002D8] = { yoffset = -0.075 }, -- breve - -- -- [0x002D9] = { yoffset = -0.05 }, -- dot - -- -- [0x000A8] = { yoffset = -0.02 }, -- ddot - -- -- [0x020DB] = { yoffset = -0.02 }, -- dddot - -- -- [0x002DA] = { yoffset = -0.1 }, -- ring - -- -- [0x002C7] = { yoffset = -0.1 }, -- check - -- -- [0x020D7] = { yoffset = -0.1 }, -- vec +-- For now we keep these commented as they show where we came from. - -- -- [0x00300] = { yoffset = -0.1, all = true }, -- widegrave - -- -- [0x00301] = { yoffset = -0.1, all = true }, -- wideacute - -- -- [0x00302] = { yoffset = -0.1, all = true }, -- widehat - -- -- [0x00303] = { yoffset = -0.09, all = true }, -- widetilde - -- -- [0x00304] = { yoffset = -0.12, all = true }, -- widebar - -- -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve - -- -- [0x00307] = { yoffset = -0.02, all = true }, -- widedot - -- -- [0x00308] = { yoffset = -0.02, all = true }, -- wideddot - -- -- [0x020DB] = { yoffset = -0.1, all = true }, -- widedddot - -- -- [0x0030A] = { yoffset = -0.12, all = true }, -- widering - -- -- [0x0030C] = { yoffset = -0.04, all = true }, -- widecheck +-- { +-- tweak = "dimensions", +-- list = { +-- -- [0x00060] = { yoffset = -0.075 }, -- grave +-- -- [0x000B4] = { yoffset = -0.075 }, -- acute +-- -- [0x002C6] = { yoffset = -0.075 }, -- hat +-- -- [0x002DC] = { yoffset = -0.075 }, -- tilde +-- -- [0x000AF] = { yoffset = -0.1 }, -- bar +-- -- [0x002D8] = { yoffset = -0.075 }, -- breve +-- -- [0x002D9] = { yoffset = -0.05 }, -- dot +-- -- [0x000A8] = { yoffset = -0.02 }, -- ddot +-- -- [0x020DB] = { yoffset = -0.02 }, -- dddot +-- -- [0x002DA] = { yoffset = -0.1 }, -- ring +-- -- [0x002C7] = { yoffset = -0.1 }, -- check +-- -- [0x020D7] = { yoffset = -0.1 }, -- vec - -- -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.5 }, -- b (6.8) - -- -- [0x1D451] = { width = 1, italic = 0, anchor = 1.2 }, -- d (6.8) - -- -- [0x0210E] = { width = 1, italic = 0, anchor = 1.5 }, -- h (6.8) - -- -- [0x1D458] = { width = 1, italic = 0, anchor = 1.5 }, -- k (6.8) - -- }, - -- }, +-- -- [0x00300] = { yoffset = -0.1, all = true }, -- widegrave +-- -- [0x00301] = { yoffset = -0.1, all = true }, -- wideacute +-- -- [0x00302] = { yoffset = -0.1, all = true }, -- widehat +-- -- [0x00303] = { yoffset = -0.09, all = true }, -- widetilde +-- -- [0x00304] = { yoffset = -0.12, all = true }, -- widebar +-- -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve +-- -- [0x00307] = { yoffset = -0.02, all = true }, -- widedot +-- -- [0x00308] = { yoffset = -0.02, all = true }, -- wideddot +-- -- [0x020DB] = { yoffset = -0.1, all = true }, -- widedddot +-- -- [0x0030A] = { yoffset = -0.12, all = true }, -- widering +-- -- [0x0030C] = { yoffset = -0.04, all = true }, -- widecheck +-- -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.5 }, -- b (6.8) +-- -- [0x1D451] = { width = 1, italic = 0, anchor = 1.2 }, -- d (6.8) +-- -- [0x0210E] = { width = 1, italic = 0, anchor = 1.5 }, -- h (6.8) +-- -- [0x1D458] = { width = 1, italic = 0, anchor = 1.5 }, -- k (6.8) +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/lm.lfg b/tex/context/fonts/mkiv/lm.lfg index 355b583d1..984038d58 100644 --- a/tex/context/fonts/mkiv/lm.lfg +++ b/tex/context/fonts/mkiv/lm.lfg @@ -4,59 +4,6 @@ local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - local kern_150 = { bottomright = { { kern = -150 } } } - local kern_200 = { bottomright = { { kern = -200 } } } - - kerns = { - [0x1D449] = kern_150, -- - [0x1D44A] = kern_200, -- 𝑊 - - [0x1D4AB] = { - -- topleft = { { kern = -200 } }, - bottomright = { { kern = -200 } }, - }, - } - - dimensions = { - -- always applied - -- default = { - -- }, - -- driven by 'mathdimensions' feature - default = { - -- the root is quite displaced - [0x221A] = { - -- 73, -960, 853, 40 - yoffset = 960 - 40, - height = 960, - depth = 40, - }, - - -- [0xFE932] = { xoffset = 50, width = 290 }, -- used prime - -- [0x2032] = { xoffset = 50, width = 290 }, -- prime - }, - -- -- seems ok now -- - -- signs = { - -- -- [0x00B1] = { -- ± - -- -- height = 500, depth = 0, - -- -- }, - -- -- [0x2213] = { -- ∓ - -- -- height = 500, depth = 0, - -- -- }, - -- -- move in boundingbox - -- [0x00B1] = { -- ± - -- yoffset = 100, - -- }, - -- [0x2213] = { -- ∓ - -- yoffset = -100, - -- }, - -- }, - } - -end - - return { name = "latin modern", version = "1.00", @@ -70,7 +17,7 @@ return { NoLimitSubFactor = 900, AccentTopShiftUp = -60, FlattenedAccentTopShiftUp = -60, - -- AccentExtendMargin = 50, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, -- AccentBaseDepth = 0, -- AccentTopOvershoot = 66, @@ -81,12 +28,12 @@ return { -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) PrimeRaisePercent = 60, PrimeRaiseComposedPercent = 15, - -- SubSuperscriptGapMin = 160, -- 160 in font + -- SubSuperscriptGapMin = 160, -- 160 in font SuperscriptBaselineDropMax = 250, -- 250 in font - -- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font - -- SuperscriptBottomMin = 108, -- 108 in font + -- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font + -- SuperscriptBottomMin = 108, -- 108 in font SuperscriptShiftUp = 363, -- 363 in font - SuperscriptShiftUpCramped = 89, -- 289 in font + SuperscriptShiftUpCramped = 89, -- 289 in font }, tweaks = { aftercopying = { @@ -97,68 +44,22 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 1 }, - presets.mathrsfscript { rscale = 1 }, - presets.mathxitsarabic { rscale = 0.88 }, - presets.moveitalics { correct = true }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.80 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.4 }, + presets.wipeanchors { }, + presets.wipeitalics { }, + -- these will become moveanchors { tweak = "dimensions", list = { - -- [0x00060] = { yoffset = -0.05 }, -- grave - -- [0x000B4] = { yoffset = -0.05 }, -- acute - -- [0x002C6] = { yoffset = -0.05 }, -- hat - -- [0x002DC] = { yoffset = -0.05 }, -- tilde - -- [0x000AF] = { yoffset = -0.075 }, -- bar - -- [0x002D8] = { yoffset = -0.05 }, -- breve - -- [0x002D9] = { yoffset = -0.05 }, -- dot - -- [0x000A8] = { yoffset = -0.05 }, -- ddot - -- [0x020DB] = { yoffset = 0.2 }, -- dddot (done below!) - -- [0x002DA] = { width = 0 }, -- ring (bounding box is wrong) - -- [0x002C7] = { yoffset = -0.05 }, -- check - -- [0x020D7] = { yoffset = -0.05 }, -- vec - - -- [0x00300] = { yoffset = -0.03, all = true }, -- widegrave - -- [0x00301] = { yoffset = -0.03, all = true }, -- wideacute - -- [0x00302] = { yoffset = -0.075, all = true }, -- widehat - -- [0x00303] = { yoffset = -0.05, all = true }, -- widetilde - -- [0x00304] = { yoffset = -0.02, all = true }, -- widebar - -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve - -- [0x00307] = { yoffset = -0.027, all = true }, -- widedot - -- [0x00308] = { yoffset = -0.027, all = true }, -- wideddot - -- [0x020DB] = { yoffset = -0.065, all = true }, -- widedddot - -- [0x0030C] = { yoffset = -0.05, all = true }, -- widecheck - -- [0x0030A] = { yoffset = -0.025, all = true }, -- widering - - -- [0x0212C] = { width = 0.95, italic = 0.05 }, -- script B - -- [0x1D49E] = { width = 0.8, italic = 0.25 }, -- script C - -- [0x1D49F] = { width = 0.9, italic = 0.11 }, -- script D - -- [0x02130] = { width = 0.85, italic = 0.18 }, -- script E - -- [0x02131] = { width = 0.75, italic = 0.3 }, -- script F - -- [0x1D4A2] = { width = 0.9, italic = 0.11 }, -- script G - -- [0x0210B] = { width = 0.85, italic = 0.18 }, -- script H - -- [0x02110] = { width = 0.8, italic = 0.25 }, -- script I - -- [0x1D4A5] = { width = 0.8, italic = 0.25 }, -- script J - -- [0x1D4A6] = { width = 0.9, italic = 0.11 }, -- script K - -- [0x02112] = { width = 0.95, italic = 0.05 }, -- script L - -- [0x02133] = { width = 0.9, italic = 0.11 }, -- script M - -- [0x1D4A9] = { width = 0.85, italic = 0.18 }, -- script N - -- [0x1D4AA] = { width = 0.95, italic = 0.05 }, -- script O - -- [0x1D4AB] = { width = 0.8, italic = 0.25 }, -- script P - -- [0x1D4AB] = { width = 0.95, italic = 0.05 }, -- script Q - -- [0x0211B] = { width = 0.95, italic = 0.05 }, -- script R - -- [0x1D4AE] = { width = 0.9, italic = 0.11 }, -- script S - -- [0x1D4AF] = { width = 0.75, italic = 0.33 }, -- script T - -- [0x1D4B0] = { width = 0.9, italic = 0.11 }, -- script U - -- [0x1D4B1] = { width = 0.8, italic = 0.25 }, -- script V - -- [0x1D4B2] = { width = 0.8, italic = 0.25 }, -- script W - -- [0x1D4B3] = { width = 0.9, italic = 0.11 }, -- script X - -- [0x1D4B4] = { width = 0.85, italic = 0.18 }, -- script Y - -- [0x1D4B5] = { width = 0.95, italic = 0.05 }, -- script Z - - -- Setting anchors to shift the location of accents - -- Note: Many non-italic alphabets are wiped below - -- Todo: Check the less common italic alphabets - -- [0x1D483] = { anchor = 1.15 }, -- bold italic b -- [0x1D485] = { anchor = 0.8 }, -- bold italic d [0x1D487] = { anchor = 0.9 }, -- bold italic f @@ -290,13 +191,13 @@ return { { tweak = "dimensions", list = { - -- [0x00300] = { width = 0.8 }, -- widegrave - -- [0x00301] = { width = 0.9 }, -- wideacute + -- [0x00300] = { width = 0.8 }, -- widegrave + -- [0x00301] = { width = 0.9 }, -- wideacute [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - -- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + -- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck }, }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent @@ -305,19 +206,17 @@ return { tweak = "dimensions", list = { -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, -- We now copy these to the not wide slots so that we can set these to stretch as well, @@ -333,12 +232,8 @@ return { -- to have the 2 in x^2/5 a bit over the slash tweak = "kerns", list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, -- solidus + [0x0002F] = { topleft = -0.2, bottomright = -0.2 }, -- solidus + -- [0x1D49C] = { bottomright = -0.05, }, -- script A [0x1D49D] = { bottomright = -0.05, }, -- script B [0x1D49E] = { bottomright = -0.25, }, -- script C @@ -365,43 +260,20 @@ return { [0x1D4B3] = { bottomright = -0.11, }, -- script X [0x1D4B4] = { bottomright = -0.18, }, -- script Y [0x1D4B5] = { bottomright = -0.05, }, -- script Z - - ["0x7D.parts.top"] = { - topright = -0.25, - }, -- right brace top - ["0x7D.parts.bottom"] = { - bottomright = -0.25, - }, -- right brace bottom - ["0x7D.variants.*"] = { - topright = -0.25, - bottomright = -0.25, - }, -- right brace variants - ["0x29.parts.top"] = { - topright = -0.3, - }, -- right parenthesis top - ["0x29.parts.bottom"] = { - bottomright = -0.3, - }, -- right parenthesis bottom - ["0x29.variants.*"] = { - topright = -0.25, - bottomright = -0.25, - }, -- right parenthesis variants - ["0x221A.parts.top"] = { - topright = 0.2, - }, -- right radical top - ["0x221A.parts.bottom"] = { - bottomright = 0.2, - }, -- right radical bottom - ["0x221A.variants.*"] = { - topright = 0.2, - bottomright = 0.2, - }, -- right radical variants - - -- angle - [0x27E9] = { topright = -0.2, bottomright = -0.2 }, - ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - [0x27EB] = { topright = -0.2, bottomright = -0.2 }, - ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + -- + ["0x7D.parts.top"] = { topright = -0.25 }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.25 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.3, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.3 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.2, bottomright = -0.2 }, -- angles + ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + [0x27EB] = { topright = -0.2, bottomright = -0.2 }, + ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, }, }, @@ -411,141 +283,72 @@ return { -- }, -- }, { - -- For upright alphabets, we unset the anchor. - -- This means that accents are placed - -- centered over the character - tweak = "wipeanchors", - -- list = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58 }, -- todo: ranges - list = { - "digitsbold", - "digitsdoublestruck", - "digitsmonospace", - "digitsnormal", - "digitssansserifbold", - "digitssansserifnormal", - "lowercasebold", - "lowercaseboldfraktur", - "lowercasedoublestruck", - "lowercasefraktur", - "lowercasegreekbold", - "lowercasegreeknormal", - "lowercasegreeksansserifbold", - "lowercasemonospace", - "lowercasenormal", - "lowercasesansserifbold", - "lowercasesansserifnormal", - "uppercasebold", - "uppercaseboldfraktur", - "uppercasedoublestruck", - "uppercasefraktur", - "uppercasegreekbold", - "uppercasegreeknormal", - "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasenormal", -- they are italic! - "uppercasesansserifbold", - "uppercasesansserifnormal", - }, - }, - { - -- For non-italic alphabets we - -- remove italic correction. - tweak = "wipeitalics", - list = { - -- "digitsbold", - -- "digitsdoublestruck", - -- "digitsmonospace", - -- "digitsnormal", - -- "digitssansserifbold", - -- "digitssansserifnormal", - -- "lowercasebold", - -- "lowercaseboldfraktur", - -- "lowercasedoublestruck", - -- "lowercasefraktur", - "lowercasemonospace", - -- "lowercasenormal", - -- "lowercasesansserifbold", - -- "lowercasesansserifnormal", - -- "lowercasegreeknormal", - "uppercasebold", - -- "uppercaseboldfraktur", - -- "uppercasedoublestruck", - -- "uppercasefraktur", - -- "uppercasegreekbold", - -- "uppercasegreeknormal", - -- "uppercasegreeksansserifbold", - "uppercasemonospace", - "uppercasesansserifbold", - "uppercasesanserifnormal", - }, - }, - { -- This one fakes margins to get larger/smaller accents -- with for example \widetilde. tweak = "margins", list = { - [0x1D487] = { left = -.2, right = -.2 }, -- bold italic f - [0x1D489] = { left = -.2, right = -.2 }, -- bold italic h - [0x1D496] = { left = -.1, right = -.1 }, -- bold italic u - [0x1D499] = { left = -.1, right = -.1 }, -- bold italic x - - [0x1D711] = { left = -.1, right = -.1 }, -- italic varphi - [0x1D713] = { left = -.1, right = -.1 }, -- italic psi - - [0x1D659] = { left = -.1, right = -.1 }, -- sans bold italic d - [0x1D65C] = { left = -.1, right = -.1 }, -- sans bold italic g - - [0x1D409] = { left = .1, right = .1 }, -- bold upright J - [0x1D412] = { left = .1, right = .1 }, -- bold upright S - - [0x1D509] = { left = .1, right = .1 }, -- fraktur F - [0x1D50C] = { left = .1, right = .1 }, -- fraktur I - [0x1D50D] = { left = .1, right = .1 }, -- fraktur J - [0x1D51D] = { left = .1, right = .1 }, -- fraktur Z - - [0x1D538] = { left = .1, right = .1 }, -- doublestruck A - [0x1D539] = { left = .1, right = .1 }, -- doublestruck B - [0x1D53C] = { left = .1, right = .1 }, -- doublestruck E - [0x1D53D] = { left = .1, right = .1 }, -- doublestruck F - [0x1D541] = { left = .1, right = .1 }, -- doublestruck J - [0x1D542] = { left = .1, right = .1 }, -- doublestruck K - [0x1D543] = { left = .1, right = .1 }, -- doublestruck L - [0x1D547] = { left = .1, right = .1 }, -- doublestruck P - [0x1D549] = { left = .1, right = .1 }, -- doublestruck R - [0x1D54A] = { left = .1, right = .1 }, -- doublestruck S - [0x1D54B] = { left = .1, right = .1 }, -- doublestruck T - [0x1D54D] = { left = .1, right = .1 }, -- doublestruck V - [0x1D550] = { left = .1, right = .1 }, -- doublestruck Y - - [0x1D506] = { left = .1, right = .1 }, -- fraktur C - - [0x00393] = { left = .1, right = .1 }, -- upfight Gamma - [0x00396] = { left = .1, right = .1 }, -- upfight Zeta - - [0x1D5D8] = { left = .1, right = .1 }, -- sans bold E - [0x1D5D9] = { left = .1, right = .1 }, -- sans bold F - -- [0x1D5DD] = { left = .2, right = .2 }, -- sans bold J -- nope - [0x1D5DF] = { left = .1, right = .1 }, -- sans bold L - [0x1D5E6] = { left = .1, right = .1 }, -- sans bold S - - [0x1D61A] = { left = .1, right = .1 }, -- sans italic S - - [0x1D5A2] = { left = .1, right = .1 }, -- sans C - [0x1D5A4] = { left = .1, right = .1 }, -- sans E - [0x1D5A5] = { left = .1, right = .1 }, -- sans F - -- [0x1D5AB] = { left = .1, right = .1 }, -- sans L -- nope - [0x1D5AF] = { left = .1, right = .1 }, -- sans P - [0x1D5B2] = { left = .1, right = .1 }, -- sans S - [0x1D5B9] = { left = .1, right = .1 }, -- sans Z - - [0x1D4A0] = { left = .1, right = .1 }, -- script E - [0x1D4AE] = { left = .1, right = .1 }, -- script S - [0x1D4B4] = { left = .1, right = .1 }, -- script Y - - -- [0x4A] = { left = .2, right = .2 }, -- J - [0x4C] = { left = .1, right = .1 }, -- L - [0x53] = { left = .1, right = .1 }, -- S - [0x5A] = { left = .1, right = .1 }, -- Z + [0x1D487] = { left = -.2, right = -.2 }, -- bold italic f + [0x1D489] = { left = -.2, right = -.2 }, -- bold italic h + [0x1D496] = { left = -.1, right = -.1 }, -- bold italic u + [0x1D499] = { left = -.1, right = -.1 }, -- bold italic x + + [0x1D711] = { left = -.1, right = -.1 }, -- italic varphi + [0x1D713] = { left = -.1, right = -.1 }, -- italic psi + + [0x1D659] = { left = -.1, right = -.1 }, -- sans bold italic d + [0x1D65C] = { left = -.1, right = -.1 }, -- sans bold italic g + + [0x1D409] = { left = .1, right = .1 }, -- bold upright J + [0x1D412] = { left = .1, right = .1 }, -- bold upright S + + [0x1D509] = { left = .1, right = .1 }, -- fraktur F + [0x1D50C] = { left = .1, right = .1 }, -- fraktur I + [0x1D50D] = { left = .1, right = .1 }, -- fraktur J + [0x1D51D] = { left = .1, right = .1 }, -- fraktur Z + + [0x1D538] = { left = .1, right = .1 }, -- doublestruck A + [0x1D539] = { left = .1, right = .1 }, -- doublestruck B + [0x1D53C] = { left = .1, right = .1 }, -- doublestruck E + [0x1D53D] = { left = .1, right = .1 }, -- doublestruck F + [0x1D541] = { left = .1, right = .1 }, -- doublestruck J + [0x1D542] = { left = .1, right = .1 }, -- doublestruck K + [0x1D543] = { left = .1, right = .1 }, -- doublestruck L + [0x1D547] = { left = .1, right = .1 }, -- doublestruck P + [0x1D549] = { left = .1, right = .1 }, -- doublestruck R + [0x1D54A] = { left = .1, right = .1 }, -- doublestruck S + [0x1D54B] = { left = .1, right = .1 }, -- doublestruck T + [0x1D54D] = { left = .1, right = .1 }, -- doublestruck V + [0x1D550] = { left = .1, right = .1 }, -- doublestruck Y + + [0x1D506] = { left = .1, right = .1 }, -- fraktur C + + [0x00393] = { left = .1, right = .1 }, -- upfight Gamma + [0x00396] = { left = .1, right = .1 }, -- upfight Zeta + + [0x1D5D8] = { left = .1, right = .1 }, -- sans bold E + [0x1D5D9] = { left = .1, right = .1 }, -- sans bold F + -- [0x1D5DD] = { left = .2, right = .2 }, -- sans bold J -- nope + [0x1D5DF] = { left = .1, right = .1 }, -- sans bold L + [0x1D5E6] = { left = .1, right = .1 }, -- sans bold S + + [0x1D61A] = { left = .1, right = .1 }, -- sans italic S + + [0x1D5A2] = { left = .1, right = .1 }, -- sans C + [0x1D5A4] = { left = .1, right = .1 }, -- sans E + [0x1D5A5] = { left = .1, right = .1 }, -- sans F + -- [0x1D5AB] = { left = .1, right = .1 }, -- sans L -- nope + [0x1D5AF] = { left = .1, right = .1 }, -- sans P + [0x1D5B2] = { left = .1, right = .1 }, -- sans S + [0x1D5B9] = { left = .1, right = .1 }, -- sans Z + + [0x1D4A0] = { left = .1, right = .1 }, -- script E + [0x1D4AE] = { left = .1, right = .1 }, -- script S + [0x1D4B4] = { left = .1, right = .1 }, -- script Y + + -- [0x0004A] = { left = .2, right = .2 }, -- J + [0x0004C] = { left = .1, right = .1 }, -- L + [0x00053] = { left = .1, right = .1 }, -- S + [0x0005A] = { left = .1, right = .1 }, -- Z [0x1D43D] = { left = -.1, right = -.1 }, -- italic J [0x1D409] = { left = -.1, right = -.1 }, -- bold J @@ -598,16 +401,17 @@ return { -- 0x7C, -- }, -- }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { 1, 3, 5, 7 -- In fact, 6 is the last one. }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, }, filenames = { ["latinmodern-math-regular.otf"] = { @@ -805,3 +609,93 @@ return { }, } } + +-- For now we keep these commented as they show where we came from. + +-- [0x00060] = { yoffset = -0.05 }, -- grave +-- [0x000B4] = { yoffset = -0.05 }, -- acute +-- [0x002C6] = { yoffset = -0.05 }, -- hat +-- [0x002DC] = { yoffset = -0.05 }, -- tilde +-- [0x000AF] = { yoffset = -0.075 }, -- bar +-- [0x002D8] = { yoffset = -0.05 }, -- breve +-- [0x002D9] = { yoffset = -0.05 }, -- dot +-- [0x000A8] = { yoffset = -0.05 }, -- ddot +-- [0x020DB] = { yoffset = 0.2 }, -- dddot (done below!) +-- [0x002DA] = { width = 0 }, -- ring (bounding box is wrong) +-- [0x002C7] = { yoffset = -0.05 }, -- check +-- [0x020D7] = { yoffset = -0.05 }, -- vec + +-- [0x00300] = { yoffset = -0.03, all = true }, -- widegrave +-- [0x00301] = { yoffset = -0.03, all = true }, -- wideacute +-- [0x00302] = { yoffset = -0.075, all = true }, -- widehat +-- [0x00303] = { yoffset = -0.05, all = true }, -- widetilde +-- [0x00304] = { yoffset = -0.02, all = true }, -- widebar +-- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve +-- [0x00307] = { yoffset = -0.027, all = true }, -- widedot +-- [0x00308] = { yoffset = -0.027, all = true }, -- wideddot +-- [0x020DB] = { yoffset = -0.065, all = true }, -- widedddot +-- [0x0030C] = { yoffset = -0.05, all = true }, -- widecheck +-- [0x0030A] = { yoffset = -0.025, all = true }, -- widering + +-- [0x0212C] = { width = 0.95, italic = 0.05 }, -- script B +-- [0x1D49E] = { width = 0.8, italic = 0.25 }, -- script C +-- [0x1D49F] = { width = 0.9, italic = 0.11 }, -- script D +-- [0x02130] = { width = 0.85, italic = 0.18 }, -- script E +-- [0x02131] = { width = 0.75, italic = 0.3 }, -- script F +-- [0x1D4A2] = { width = 0.9, italic = 0.11 }, -- script G +-- [0x0210B] = { width = 0.85, italic = 0.18 }, -- script H +-- [0x02110] = { width = 0.8, italic = 0.25 }, -- script I +-- [0x1D4A5] = { width = 0.8, italic = 0.25 }, -- script J +-- [0x1D4A6] = { width = 0.9, italic = 0.11 }, -- script K +-- [0x02112] = { width = 0.95, italic = 0.05 }, -- script L +-- [0x02133] = { width = 0.9, italic = 0.11 }, -- script M +-- [0x1D4A9] = { width = 0.85, italic = 0.18 }, -- script N +-- [0x1D4AA] = { width = 0.95, italic = 0.05 }, -- script O +-- [0x1D4AB] = { width = 0.8, italic = 0.25 }, -- script P +-- [0x1D4AB] = { width = 0.95, italic = 0.05 }, -- script Q +-- [0x0211B] = { width = 0.95, italic = 0.05 }, -- script R +-- [0x1D4AE] = { width = 0.9, italic = 0.11 }, -- script S +-- [0x1D4AF] = { width = 0.75, italic = 0.33 }, -- script T +-- [0x1D4B0] = { width = 0.9, italic = 0.11 }, -- script U +-- [0x1D4B1] = { width = 0.8, italic = 0.25 }, -- script V +-- [0x1D4B2] = { width = 0.8, italic = 0.25 }, -- script W +-- [0x1D4B3] = { width = 0.9, italic = 0.11 }, -- script X +-- [0x1D4B4] = { width = 0.85, italic = 0.18 }, -- script Y +-- [0x1D4B5] = { width = 0.95, italic = 0.05 }, -- script Z + +-- Setting anchors to shift the location of accents +-- Note: Many non-italic alphabets are wiped below +-- Todo: Check the less common italic alphabets + +-- { +-- -- For non-italic alphabets we +-- -- remove italic correction. +-- tweak = "wipeitalics", +-- list = { +-- -- "digitsbold", +-- -- "digitsdoublestruck", +-- -- "digitsmonospace", +-- -- "digitsnormal", +-- -- "digitssansserifbold", +-- -- "digitssansserifnormal", +-- -- "lowercasebold", +-- -- "lowercaseboldfraktur", +-- -- "lowercasedoublestruck", +-- -- "lowercasefraktur", +-- "lowercasemonospace", +-- -- "lowercasenormal", +-- -- "lowercasesansserifbold", +-- -- "lowercasesansserifnormal", +-- -- "lowercasegreeknormal", +-- "uppercasebold", +-- -- "uppercaseboldfraktur", +-- -- "uppercasedoublestruck", +-- -- "uppercasefraktur", +-- -- "uppercasegreekbold", +-- -- "uppercasegreeknormal", +-- -- "uppercasegreeksansserifbold", +-- "uppercasemonospace", +-- "uppercasesansserifbold", +-- "uppercasesanserifnormal", +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/lucida-opentype-math.lfg b/tex/context/fonts/mkiv/lucida-opentype-math.lfg index 97cf97ab1..6a5f5ab36 100644 --- a/tex/context/fonts/mkiv/lucida-opentype-math.lfg +++ b/tex/context/fonts/mkiv/lucida-opentype-math.lfg @@ -1,37 +1,10 @@ local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - -- local kern_250 = { bottomright = { { kern = -250 } }, force = true } - - -- kerns = { - -- [0x1D449] = kern_250, -- - -- [0x1D44A] = kern_250, -- 𝑊 - -- } - - dimensions = { - default = { -- experimental values - -- [0x02044] = { xoffset = 275, width = 600 }, - -- primes - [0xFE932] = { width = 200 }, - [0xFE933] = { width = 500 }, - [0xFE934] = { width = 800 }, - [0xFE935] = { width = 1100 }, - -- reverse primes - [0xFE935] = { width = 200 }, - [0xFE936] = { width = 500 }, - [0xFE937] = { width = 800 }, - }, - } - -end - --- When set this will bypass the italic correction hackery! local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } +----- integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.45 } - return { name = "lucida-opentype-math", version = "1.00", @@ -57,7 +30,7 @@ return { -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) PrimeRaisePercent = 60, -- 50 default PrimeRaiseComposedPercent = 50, -- 25 default --- AxisHeight = 325, + -- AxisHeight = 325, -- we keep the old fonts as they are (also for demos) }, tweaks = { aftercopying = { @@ -69,16 +42,24 @@ return { tweak = "fixoldschool", version = "Version 1.802", }, --- { --- tweak = "showinfo", --- version = "Version 1.803", --- }, + -- { + -- tweak = "showinfo", + -- version = "Version 1.803", + -- }, { tweak = "addmirrors", }, - presets.mathxitsarabic { - rscale = 1.05 - }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 1 }, + presets.rsfsuprighttoscript { rscale = 1 }, + presets.moderntocalligraphic { rscale = 1 }, + presets.eulertocalligraphic { rscale = 1 }, + presets.xitsarabic { rscale = 1.05 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, { tweak = "replacealphabets", list = { @@ -87,6 +68,17 @@ return { target = "uppercasecalligraphic", feature = "ss04", }, + { + source = "lowercasescript", + target = "lowercasecalligraphic", + feature = "ss04", + }, + { + source = "uppercaseboldscript", + target = "uppercaseboldcalligraphic", + feature = "ss04", + }, + -- No lowercase bold calligraphic/script in font }, }, { @@ -101,8 +93,9 @@ return { }, }, { - tweak = "dimensions", - list = { + tweak = "dimensions", + version = "Version 1.802", + list = { -- these we fix here. Remove when we have new version of Lucida ["0x23DC.parts.1"] = { xoffset = -0.075, height = .4, yoffset = -0.6 }, ["0x23DC.parts.2"] = { height = .4, yoffset = -0.6 }, @@ -134,34 +127,34 @@ return { }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. - { - tweak = "dimensions", - list = { - -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, +-- { +-- tweak = "dimensions", +-- list = { +-- -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat +-- -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde +-- -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve +-- -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck +-- }, +-- }, -- Then we deal with all offsets and heights in one go. So we treat the initial accent -- as well as the variants here. - { - tweak = "dimensions", - list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) - }, - }, +-- { +-- tweak = "dimensions", +-- list = { +-- -- here we want to apply to all +-- -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 +-- -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 +-- -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 +-- -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC +-- -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 +-- -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA +-- -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 +-- -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF +-- -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 +-- -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 +-- -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) +-- }, +-- }, -- We now copy these to the not wide slots so that we can set these to stretch as well, -- if only because it is less confusing and more consistent. { @@ -252,6 +245,12 @@ return { -- [0x21CC] = false, } }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, alternates = { @@ -260,6 +259,8 @@ return { operator = { feature = 'ss03', value = 1, comment = "Mathematical Alternative Smaller Operators" }, calligraphic = { feature = 'ss04', value = 1, comment = "Mathematical Alternative Calligraphic Characters" }, zero = { feature = 'ss05', value = 1, comment = "Mathematical Alternative Zero" }, + multipledots = { feature = 'ss06', value = 1, comment = "Mathematical Alternative Multiple Dots" }, + ldots = { feature = 'ss07', value = 1, comment = "Mathematical Alternative Ellipsis" }, }, bigslots = { 1, 2, 3, 4 diff --git a/tex/context/fonts/mkiv/minion-math.lfg b/tex/context/fonts/mkiv/minion-math.lfg index 5216e1289..a768c0518 100644 --- a/tex/context/fonts/mkiv/minion-math.lfg +++ b/tex/context/fonts/mkiv/minion-math.lfg @@ -2,18 +2,6 @@ -- ConTeXt (math) develoipment have official copies of all the text minion and math -- fonts without restrictions of usage in documents. -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - local kern_W = { bottomright = { { kern = -150 } } } - local kern_V = { bottomright = { { kern = -200 } } } - - kerns = { - [0x1D449] = kern_V, -- 𝑉 - [0x1D44A] = kern_W, -- 𝑊 - } - -end - local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -67,24 +55,19 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.95 }, - presets.mathrsfscript { rscale = 0.95 }, - presets.mathxitsarabic { rscale = 0.88 }, + presets.rsfstoscript { rscale = 0.97 }, + presets.rsfsuprighttoscript { rscale = 0.97 }, + presets.moderntocalligraphic { rscale = 0.97 }, + presets.eulertocalligraphic { rscale = 0.97 }, + presets.xitsarabic { rscale = 0.88 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.3 }, + presets.wipeitalics { }, { tweak = "simplifykerns", }, - presets.moveitalics { - correct = true - }, - { -- Check! - tweak = "replacealphabets", - list = { - { - source = "uppercasecalligraphic", - target = "uppercasescript", - }, - }, - }, { tweak = "extendaccents", }, @@ -115,12 +98,13 @@ return { tweak = "addfourier", variant = 1, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, }, } diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index 59eafeaaf..032450426 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -1,34 +1,3 @@ -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - local kern_V = { bottomright = { { kern = -200 } } } - local kern_W = { bottomright = { { kern = -100 } } } - - dimensions = { - default = { - -- [0x1D453] = { xoffset = 162, width = 278 + 162 },-- 𝑓 - -- [0x1D453] = offset_f, -- 𝑓 - -- ["1:0x1D453"] = offset_f, -- needed for compact - -- ["2:0x1D453"] = offset_f, -- needed for compact - -- ["*:0x1D453"] = offset_f, -- 𝑓 - }, - } - - kerns = { - -- [0x1D449] = kern_V, -- 𝑉 - -- ["1:0x1D449"] = kern_V, -- needed for compact - -- ["2:0x1D449"] = kern_V, -- needed for compact - -- [0x1D44A] = kern_W, -- 𝑊 - -- ["1:0x1D44A"] = kern_W, -- needed for compact - -- ["2:0x1D44A"] = kern_W, -- needed for compact - -- ["*:0x1D453"] = kern_f, - ["*:0x1D449"] = kern_V, -- 𝑉 - ["*:0x1D44A"] = kern_W, -- 𝑊 - } - -end - --- When set this will bypass the italic correction hackery! - local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets @@ -78,33 +47,42 @@ return { -- fake = 0.65, }, { + tweak = "replacealphabets", + feature = "euleroverpagella", + filename = "euler.otf", + list = { + -- { source = { first = 0x02100, last = 0x0210D } }, -- no 0x2210E + -- { source = { first = 0x0210F, last = 0x02BFF } }, + { source = { first = 0x02100, last = 0x02BFF } }, + { source = { first = 0x1D400, last = 0x1D7FF } }, + { source = { first = 0x1D538, last = 0x1D550 } }, + }, + }, + { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.97 }, - presets.mathrsfscript { rscale = 0.97 }, - presets.mathxitsarabic { rscale = 0.95 }, { - -- When it makes sense we get rid of italics. - tweak = "moveitalics", - correct = true, + tweak = "fixoldschool", + feature = "euleroverpagella", + }, + + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.95 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, -- we need to check the 1.5 + presets.wipeanchors { }, + presets.wipeitalics { }, + { + tweak = "parameters", + feature = "euleroverpagella", list = { - "lowercasenormal", - "lowercaseitalic", - "lowercasebold", - "lowercasebolditalic", - "lowercasegreeknormal", - "lowercasegreekitalic", - "lowercasegreekbold", - "lowercasegreekbolditalic", - "uppercasenormal", - "uppercaseitalic", - "uppercasebold", - "uppercasebolditalic", - "uppercasegreeknormal", - "uppercasegreekitalic", - "uppercasegreekbold", - "uppercasegreekbolditalic", - mathematics.tweaks.subsets.dotless, + RadicalRuleThickness = 54, } }, { @@ -249,6 +227,20 @@ return { }, }, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, + { + tweak = "parameters", + feature = "emulatelmtx", + comment = "this is for mkiv", + list = { + AccentBaseHeight = 400, + } + }, }, }, bigslots = { @@ -257,45 +249,36 @@ return { alternates = { dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" }, }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, }, } +-- For now we keep these commented as they show where we came from. - - - --- Old values - - -- { - -- tweak = "dimensions", - -- list = { -- offset width italic - -- [0x020D7] = { yoffset = -0.05 }, -- vec - -- [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a - -- [0x1D44F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- b - -- [0x1D450] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- c - -- [0x1D451] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- d - -- [0x1D452] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- e - -- [0x1D453] = { xoffset = 0.50, width = 1.70, italic = 0.6, anchor = 1.2 }, -- f - -- [0x1D454] = { xoffset = 0.10, width = 1.15, italic = 0.2 }, -- g - -- [0x0210E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- h - -- [0x1D458] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- k - -- [0x1D459] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- l - -- [0x1D45E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- q - -- [0x1D463] = { xoffset = 0, width = 1, italic = 0, anchor = 1.25 }, -- v - -- [0x1D464] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- w - -- [0x1D6FE] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \gamma - -- [0x1D706] = { xoffset = 0, width = 1, italic = 0, anchor = 1.05 }, -- \lambda - -- [0x1D70A] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \omicron - -- [0x1D70D] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \varsigma - -- [0x1D70E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- \sigma - -- [0x1D70F] = { xoffset = -.10, width = 1, italic = 0, anchor = 0.95 }, -- \tau - -- [0x1D712] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- \chi - -- [0x1D713] = { xoffset = -0.05, width = 0.95, italic = 0.1 }, -- \psi - -- [0x1D71D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- \varpi - -- }, - -- }, +-- { +-- tweak = "dimensions", +-- list = { -- offset width italic +-- [0x020D7] = { yoffset = -0.05 }, -- vec +-- [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a +-- [0x1D44F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- b +-- [0x1D450] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- c +-- [0x1D451] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- d +-- [0x1D452] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- e +-- [0x1D453] = { xoffset = 0.50, width = 1.70, italic = 0.6, anchor = 1.2 }, -- f +-- [0x1D454] = { xoffset = 0.10, width = 1.15, italic = 0.2 }, -- g +-- [0x0210E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- h +-- [0x1D458] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- k +-- [0x1D459] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- l +-- [0x1D45E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- q +-- [0x1D463] = { xoffset = 0, width = 1, italic = 0, anchor = 1.25 }, -- v +-- [0x1D464] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- w +-- [0x1D6FE] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \gamma +-- [0x1D706] = { xoffset = 0, width = 1, italic = 0, anchor = 1.05 }, -- \lambda +-- [0x1D70A] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \omicron +-- [0x1D70D] = { xoffset = 0, width = 1, italic = 0, anchor = 1.2 }, -- \varsigma +-- [0x1D70E] = { xoffset = 0, width = 1, italic = 0, anchor = 1.1 }, -- \sigma +-- [0x1D70F] = { xoffset = -.10, width = 1, italic = 0, anchor = 0.95 }, -- \tau +-- [0x1D712] = { xoffset = 0.1, width = 1.2, italic = 0.1 }, -- \chi +-- [0x1D713] = { xoffset = -0.05, width = 0.95, italic = 0.1 }, -- \psi +-- [0x1D71D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- \varpi +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/schola-math.lfg b/tex/context/fonts/mkiv/schola-math.lfg index 54d24ffa3..9a7b3dca6 100644 --- a/tex/context/fonts/mkiv/schola-math.lfg +++ b/tex/context/fonts/mkiv/schola-math.lfg @@ -1,21 +1,9 @@ -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - local kern_V = { bottomright = { { kern = -200 } }, topright = { { kern = 50 } } } - local kern_W = { bottomright = { { kern = -100 } }, topright = { { kern = 50 } } } - - kerns = { - [0x1D449] = kern_V, -- 𝑉 - [0x1D44A] = kern_W, -- 𝑊 - } - -end +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets local integral_variants = { bottomright = -0.20 } local integral_bottom = { bottomright = -0.20 } -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets - return { name = "schola-math", version = "1.00", @@ -55,10 +43,17 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 1 }, - presets.mathrsfscript { rscale = 1 }, - presets.mathxitsarabic { rscale = 0.93 }, - presets.moveitalics { correct = true }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.93 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { }, + presets.wipeitalics { }, { tweak = "kerns", list = { @@ -161,6 +156,12 @@ return { -- scale = 1.25, variant = 1, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { @@ -169,10 +170,5 @@ return { alternates = { dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" }, }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, }, } diff --git a/tex/context/fonts/mkiv/stix-two-math.lfg b/tex/context/fonts/mkiv/stix-two-math.lfg index 8b03a7730..1f370359f 100644 --- a/tex/context/fonts/mkiv/stix-two-math.lfg +++ b/tex/context/fonts/mkiv/stix-two-math.lfg @@ -1,11 +1,10 @@ --- When set this will bypass the italic correction hackery! -local integral_variants = { bottomright = -0.4 } --- local integral_top = { topright = 0.05 } -local integral_bottom = { bottomright = -0.35 } - local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets +local integral_variants = { bottomright = -0.4 } +----- integral_top = { topright = 0.05 } +local integral_bottom = { bottomright = -0.35 } + return { name = "stix-two-math", version = "1.00", @@ -61,12 +60,35 @@ return { { tweak = "addmirrors", }, - presets.mathxitsarabic { rscale = 0.95 }, + -- MS: we need to check this, I moved it up { - tweak = "simplifykerns", + tweak = "replacealphabets", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = "uppercasescript", + target = "uppercasescript", + feature = "ss01", + }, + }, }, - presets.moveitalics { - correct = true + -- + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.95 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { }, + presets.wipeitalics { }, + { + tweak = "simplifykerns", }, { tweak = "kerns", @@ -97,20 +119,6 @@ return { ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, - { - tweak = "replacealphabets", - list = { - { - source = "uppercasescript", - target = "uppercasecalligraphic", - }, - { - source = "uppercasescript", - target = "uppercasescript", - feature = "ss01", - }, - }, - }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent -- and then need to tweak the width (which is auto set because it was zero with a large -- accent anchor offset). First we copy and fix. @@ -197,6 +205,12 @@ return { } } }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/termes-math.lfg b/tex/context/fonts/mkiv/termes-math.lfg index 6a54535df..6e3eb9306 100644 --- a/tex/context/fonts/mkiv/termes-math.lfg +++ b/tex/context/fonts/mkiv/termes-math.lfg @@ -1,28 +1,9 @@ -local dimensions, kerns if CONTEXTLMTXMODE == 0 then - - -- local kern_V = { bottomright = { { kern = -200 } } } - -- local kern_W = { bottomright = { { kern = -100 } } } - -- local offset_f = { xoffset = "llx" } - -- - -- dimensions = { - -- default = { - -- [0x1D453] = offset_f, -- 𝑓 - -- }, - -- } - -- - -- kerns = { - -- [0x1D449] = kern_V, -- 𝑉 - -- [0x1D44A] = kern_W, -- 𝑊 - -- } - -end +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets local integral_variants = { bottomright = -0.20 } local integral_bottom = { bottomright = -0.30 } -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets - return { name = "termes-math", version = "1.00", @@ -61,10 +42,17 @@ return { { tweak = "addmirrors", }, - presets.matheulercalligraphic { rscale = 0.95 }, - presets.mathrsfscript { rscale = 0.95 }, - presets.mathxitsarabic { rscale = 0.88 }, - presets.moveitalics { correct = true }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.97 }, + presets.rsfsuprighttoscript { rscale = 0.97 }, + presets.moderntocalligraphic { rscale = 0.97 }, + presets.eulertocalligraphic { rscale = 0.97 }, + presets.xitsarabic { rscale = 0.88 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, { tweak = "kerns", list = { @@ -165,6 +153,12 @@ return { tweak = "addfourier", variant = 1, }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, bigslots = { @@ -173,32 +167,29 @@ return { alternates = { dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" }, }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, }, } +-- For now we keep these commented as they show where we came from. - -- Do a testrun with hats on these: - -- { - -- tweak = "dimensions", - -- list = { - -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.3 }, -- b - -- [0x1D451] = { width = 1, italic = 0, anchor = 0.8 }, -- d - -- [0x1D452] = { width = 1, italic = 0, anchor = 0.9 }, -- e - -- [0x0210E] = { width = 1, italic = 0, anchor = 1.3 }, -- h - -- [0x1D458] = { width = 1, italic = 0, anchor = 1.3 }, -- k - -- [0x1D453] = { xoffset = 0.6, width = 1.4, italic = 1.2, anchor = 1.5 }, -- f - -- [0x1D457] = { xoffset = 0.5, width = 1.3, italic = 1.7 }, -- j - -- [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, anchor = 1.4 }, -- p - -- [0x1D45E] = { width = 1, italic = 0, anchor = 0.9 }, -- q - -- [0x1D464] = { width = 1, italic = 0, anchor = 1.1 }, -- w - -- [0x1D6FE] = { width = 1, italic = 0, anchor = 1.1 }, -- \gamma - -- [0x1D706] = { width = 1, italic = 0, anchor = 1.05 }, -- \lambda - -- [0x1D70A] = { width = 1, italic = 0, anchor = 1.2 }, -- \omicron - -- [0x1D70F] = { width = 1, italic = 0, anchor = 1.05 }, -- \tau - -- }, - -- }, +-- Do a testrun with hats on these: +-- +-- { +-- tweak = "dimensions", +-- list = { +-- [0x1D44F] = { width = 1, italic = 0, anchor = 1.3 }, -- b +-- [0x1D451] = { width = 1, italic = 0, anchor = 0.8 }, -- d +-- [0x1D452] = { width = 1, italic = 0, anchor = 0.9 }, -- e +-- [0x0210E] = { width = 1, italic = 0, anchor = 1.3 }, -- h +-- [0x1D458] = { width = 1, italic = 0, anchor = 1.3 }, -- k +-- [0x1D453] = { xoffset = 0.6, width = 1.4, italic = 1.2, anchor = 1.5 }, -- f +-- [0x1D457] = { xoffset = 0.5, width = 1.3, italic = 1.7 }, -- j +-- [0x1D45D] = { xoffset = 0.15, width = 1.15, italic = 0, anchor = 1.4 }, -- p +-- [0x1D45E] = { width = 1, italic = 0, anchor = 0.9 }, -- q +-- [0x1D464] = { width = 1, italic = 0, anchor = 1.1 }, -- w +-- [0x1D6FE] = { width = 1, italic = 0, anchor = 1.1 }, -- \gamma +-- [0x1D706] = { width = 1, italic = 0, anchor = 1.05 }, -- \lambda +-- [0x1D70A] = { width = 1, italic = 0, anchor = 1.2 }, -- \omicron +-- [0x1D70F] = { width = 1, italic = 0, anchor = 1.05 }, -- \tau +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/type-imp-minion.mkiv b/tex/context/fonts/mkiv/type-imp-minion.mkiv index b158deddf..aa953623c 100644 --- a/tex/context/fonts/mkiv/type-imp-minion.mkiv +++ b/tex/context/fonts/mkiv/type-imp-minion.mkiv @@ -11,8 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\definefontfallback[MinionMathFallback] [file:latinmodern-math.otf][uppercasescript] -\definefontfallback[MinionBoldMathFallback][file:latinmodern-math.otf][uppercasescript] +% \definefontfallback[MinionMathFallback] [file:latinmodern-math.otf][uppercasescript] +% \definefontfallback[MinionBoldMathFallback][file:latinmodern-math.otf][uppercasescript] \starttypescriptcollection[minion] @@ -34,14 +34,14 @@ \starttypescript [\s!math][minion][\s!all] \loadfontgoodies[minion-math] - \definefontsynonym[\s!MathRoman] [Minion-Math] [\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math,\s!fallbacks=MinionMathFallback] - \definefontsynonym[\s!MathRomanBold][Minion-BoldMath][\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math,\s!fallbacks=MinionBoldMathFallback] + \definefontsynonym[\s!MathRoman] [Minion-Math] [\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math] % ,\s!fallbacks=MinionMathFallback] + \definefontsynonym[\s!MathRomanBold][Minion-BoldMath][\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math] % ,\s!fallbacks=MinionBoldMathFallback] \stoptypescript \starttypescript [\s!math][minion-medium][\s!all] \loadfontgoodies[minion-math] - \definefontsynonym[\s!MathRoman] [Minion-Math] [\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math,\s!fallbacks=MinionMathFallback] - \definefontsynonym[\s!MathRomanBold][Minion-MediumMath][\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math,\s!fallbacks=MinionBoldMathFallback] + \definefontsynonym[\s!MathRoman] [Minion-Math] [\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math] % ,\s!fallbacks=MinionMathFallback] + \definefontsynonym[\s!MathRomanBold][Minion-MediumMath][\s!features={\s!math\mathsizesuffix,mathextra},\s!designsize=\s!auto,\s!goodies=minion-math] % ,\s!fallbacks=MinionBoldMathFallback] \stoptypescript \starttypescript [minion,minion-medium] diff --git a/tex/context/fonts/mkiv/xits-math.lfg b/tex/context/fonts/mkiv/xits-math.lfg index 374f03a0e..9eb1a1200 100644 --- a/tex/context/fonts/mkiv/xits-math.lfg +++ b/tex/context/fonts/mkiv/xits-math.lfg @@ -45,6 +45,31 @@ return { expected = "Version 1.302", }, { + tweak = "replacealphabets", + list = { + { + source = "uppercasescript", + target = "uppercasecalligraphic", + }, + { + source = "uppercasescript", + target = "uppercasescript", + feature = "ss01", + }, + }, + }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { rscale = 0.95 }, + presets.rsfsuprighttoscript { rscale = 0.95 }, + presets.moderntocalligraphic { rscale = 0.95 }, + presets.eulertocalligraphic { rscale = 0.95 }, + presets.xitsarabic { rscale = 0.88 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.4 }, + presets.wipeitalics { }, + { tweak = "kerns", list = { [0x2F] = { @@ -55,20 +80,6 @@ return { }, }, }, - -- 0xFEOO should be chancery style, if present - { - tweak = "variants", - kind = "script", - feature = "ss01",-- this changes to chancery style for xits - -- feature = false, -- use the saved ones (see typescript) - selector = 0xFE00, - }, - -- 0xFEO1 should be roundhand style, if present - { - tweak = "variants", - kind = "script", - selector = 0xFE01, - }, { tweak = "dimensions", list = { @@ -96,6 +107,12 @@ return { tweak = "setoptions", set = { "ignorekerndimensions" } }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, }, }, alternates = { diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml index 58002a9f3..c5e12f9a1 100644 --- a/tex/context/interface/mkii/keys-cs.xml +++ b/tex/context/interface/mkii/keys-cs.xml @@ -96,7 +96,6 @@ <cd:variable name='author' value='autor'/> <cd:variable name='auto' value='auto'/> <cd:variable name='autointro' value='autouvod'/> - <cd:variable name='autopunctuation' value='autopunctuation'/> <cd:variable name='back' value='zpet'/> <cd:variable name='background' value='pozadi'/> <cd:variable name='backmatter' value='epilogy'/> @@ -683,9 +682,13 @@ <cd:constant name='authoretaltext' value='authoretaltext'/> <cd:constant name='auto' value='auto'/> <cd:constant name='autocase' value='autocase'/> + <cd:constant name='autofencing' value='autofencing'/> <cd:constant name='autofile' value='autofile'/> <cd:constant name='autofocus' value='autoostreni'/> <cd:constant name='autohang' value='autohang'/> + <cd:constant name='autonumbers' value='autonumbers'/> + <cd:constant name='autopunctuation' value='autopunctuation'/> + <cd:constant name='autospacing' value='autospacing'/> <cd:constant name='autostrut' value='autostrut'/> <cd:constant name='autowidth' value='autosirka'/> <cd:constant name='availableheight' value='availableheight'/> diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml index 08686da99..92dbfde4c 100644 --- a/tex/context/interface/mkii/keys-it.xml +++ b/tex/context/interface/mkii/keys-it.xml @@ -682,6 +682,7 @@ <cd:constant name='authoretaltext' value='authoretaltext'/> <cd:constant name='auto' value='auto'/> <cd:constant name='autocase' value='autocase'/> + <cd:constant name='autofencing' value='autofencing'/> <cd:constant name='autofile' value='autofile'/> <cd:constant name='autofocus' value='autofocus'/> <cd:constant name='autohang' value='autohang'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 10d1591d5..e8138b736 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2022-10-15 10:32 +-- merge date : 2022-10-21 21:11 do -- begin closure to overcome local limits and interference @@ -37982,27 +37982,6 @@ local fonts=fonts local handlers=fonts.handlers local registerotffeature=handlers.otf.features.register local registerafmfeature=handlers.afm.features.register -local function initialize(tfmdata,key,value) - local factor=tonumber(value) or 1 - for unicode,character in next,tfmdata.characters do - local olditalic=character.italic - if olditalic and olditalic~=0 then - character.width=character.width+olditalic - character.italic=0 - character.bottomright=-factor*olditalic - end - end -end -local specification={ - name="italicwidths", - description="add italic to width", - manipulators={ - base=initialize, - node=initialize, - } -} -registerotffeature(specification) -registerafmfeature(specification) local function initialize(tfmdata,value) if value then local parameters=tfmdata.parameters diff --git a/tex/generic/context/luatex/luatex-math.lua b/tex/generic/context/luatex/luatex-math.lua index c316182ba..2696bd961 100644 --- a/tex/generic/context/luatex/luatex-math.lua +++ b/tex/generic/context/luatex/luatex-math.lua @@ -33,7 +33,6 @@ local gaps = { [0x1D551] = 0x02124, } - local function fixmath(tfmdata,key,value) if value then local characters = tfmdata.characters @@ -51,3 +50,156 @@ fonts.handlers.otf.features.register { node = fixmath, } } + +-- This emulation is experimental and work in progress. This plain support is +-- for testing only anyway. If needed disable the feature which is there mostly +-- for MS and HH (a side effect of their math project). + +local emulate = true + +local integrals = table.tohash { 8747, 8748, 8749, 8750, 8751, 8752, 8753, 8754, +8755, 8992, 8993, 10763, 10764, 10765, 10766, 10767, 10768, 10769, 10770, 10771, +10772, 10773, 10774, 10775, 10776, 10777, 10778, 10779, 10780 } + +local italics = table.tohash { 8458, 8459, 8462, 8464, 8466, 8475, 8492, 8495, +8496, 8497, 8499, 8500, 119860, 119861, 119862, 119863, 119864, 119865, 119866, +119867, 119868, 119869, 119870, 119871, 119872, 119873, 119874, 119875, 119876, +119877, 119878, 119879, 119880, 119881, 119882, 119883, 119884, 119885, 119886, +119887, 119888, 119889, 119890, 119891, 119892, 119893, 119894, 119895, 119896, +119897, 119898, 119899, 119900, 119901, 119902, 119903, 119904, 119905, 119906, +119907, 119908, 119909, 119910, 119911, 119912, 119913, 119914, 119915, 119916, +119917, 119918, 119919, 119920, 119921, 119922, 119923, 119924, 119925, 119926, +119927, 119928, 119929, 119930, 119931, 119932, 119933, 119934, 119935, 119936, +119937, 119938, 119939, 119940, 119941, 119942, 119943, 119944, 119945, 119946, +119947, 119948, 119949, 119950, 119951, 119952, 119953, 119954, 119955, 119956, +119957, 119958, 119959, 119960, 119961, 119962, 119963, 119964, 119965, 119966, +119967, 119968, 119969, 119970, 119971, 119972, 119973, 119974, 119975, 119976, +119977, 119978, 119979, 119980, 119981, 119982, 119983, 119984, 119985, 119986, +119987, 119988, 119989, 119990, 119991, 119992, 119993, 119994, 119995, 119996, +119997, 119998, 119999, 120000, 120001, 120002, 120003, 120004, 120005, 120006, +120007, 120008, 120009, 120010, 120011, 120012, 120013, 120014, 120015, 120016, +120017, 120018, 120019, 120020, 120021, 120022, 120023, 120024, 120025, 120026, +120027, 120028, 120029, 120030, 120031, 120032, 120033, 120034, 120035, 120036, +120037, 120038, 120039, 120040, 120041, 120042, 120043, 120044, 120045, 120046, +120047, 120048, 120049, 120050, 120051, 120052, 120053, 120054, 120055, 120056, +120057, 120058, 120059, 120060, 120061, 120062, 120063, 120064, 120065, 120066, +120067, 120328, 120329, 120330, 120331, 120332, 120333, 120334, 120335, 120336, +120337, 120338, 120339, 120340, 120341, 120342, 120343, 120344, 120345, 120346, +120347, 120348, 120349, 120350, 120351, 120352, 120353, 120354, 120355, 120356, +120357, 120358, 120359, 120360, 120361, 120362, 120363, 120364, 120365, 120366, +120367, 120368, 120369, 120370, 120371, 120372, 120373, 120374, 120375, 120376, +120377, 120378, 120379, 120380, 120381, 120382, 120383, 120384, 120385, 120386, +120387, 120388, 120389, 120390, 120391, 120392, 120393, 120394, 120395, 120396, +120397, 120398, 120399, 120400, 120401, 120402, 120403, 120404, 120405, 120406, +120407, 120408, 120409, 120410, 120411, 120412, 120413, 120414, 120415, 120416, +120417, 120418, 120419, 120420, 120421, 120422, 120423, 120424, 120425, 120426, +120427, 120428, 120429, 120430, 120431, 120546, 120547, 120548, 120549, 120550, +120551, 120552, 120553, 120554, 120555, 120556, 120557, 120558, 120559, 120560, +120561, 120562, 120563, 120564, 120565, 120566, 120567, 120568, 120569, 120570, +120571, 120572, 120573, 120574, 120575, 120576, 120577, 120578, 120579, 120580, +120581, 120582, 120583, 120584, 120585, 120586, 120587, 120588, 120589, 120590, +120591, 120592, 120593, 120594, 120595, 120596, 120597, 120604, 120605, 120606, +120607, 120608, 120609, 120610, 120611, 120612, 120613, 120614, 120615, 120616, +120617, 120618, 120619, 120620, 120621, 120622, 120623, 120624, 120625, 120626, +120627, 120628, 120629, 120630, 120631, 120632, 120633, 120634, 120635, 120636, +120637, 120638, 120639, 120640, 120641, 120642, 120643, 120644, 120645, 120646, +120647, 120648, 120649, 120650, 120651, 120652, 120653, 120654, 120655, 120720, +120721, 120722, 120723, 120724, 120725, 120726, 120727, 120728, 120729, 120730, +120731, 120732, 120733, 120734, 120735, 120736, 120737, 120738, 120739, 120740, +120741, 120742, 120743, 120744, 120745, 120746, 120747, 120748, 120749, 120750, +120751, 120752, 120753, 120754, 120755, 120756, 120757, 120758, 120759, 120760, +120761, 120762, 120763, 120764, 120765, 120766, 120767, 120768, 120769, 120770, +120771 } + +local function emulatelmtx(tfmdata,key,value) + if tfmdata.mathparameters and not tfmdata.emulatedlmtx then + tfmdata.fonts = { { id = 0 } } + tfmdata.type = "virtual" + tfmdata.properties.virtualized = true + end +end + +fonts.handlers.otf.features.register { + name = "emulate lmtx", + description = "emulate lmtx mode", + default = emulate, + manipulators = { base = emulatelmtx }, +} + +local function emulatelmtx(tfmdata,key,value) + if tfmdata.mathparameters and not tfmdata.emulatedlmtx then + local targetcharacters = tfmdata.characters + local targetdescriptions = tfmdata.descriptions + local factor = tfmdata.parameters.factor + local function getllx(u) + local d = targetdescriptions[u] + if d then + local b = d.boundingbox + if b then + local llx = b[1] + if llx < 0 then + return - llx + end + end + end + return false + end + for u, c in next, targetcharacters do + local uc = c.unicode or u + if integrals[uc] then + -- skip this one + else + local accent = c.top_accent + local italic = c.italic + local width = c.width or 0 + local llx = getllx(u) + local bl, br, tl, tr + if llx then + llx = llx * factor + width = width + llx + bl = - llx + tl = bl + c.commands = { { "right", llx }, { "slot", 0, u } } + if accent then + accent = accent + llx + end + end + if accent then + if italics[uc] then + c.top_accent = accent + else + c.top_accent = nil + end + end + if italic and italic ~= 0 then + width = width + italic + br = - italic + end + c.width = width + if italic then + c.italic = nil + end + if bl or br or tl or tr then + -- watch out: singular and _ because we are post copying / scaling + c.mathkern = { + bottom_left = bl and { { height = 0, kern = bl } } or nil, + bottom_right = br and { { height = 0, kern = br } } or nil, + top_left = tl and { { height = c.height or 0, kern = tl } } or nil, + top_right = tr and { { height = c.height or 0, kern = tr } } or nil, + } + end + end + end + tfmdata.fonts = { { id = 0 } } + tfmdata.type = "virtual" + tfmdata.properties.virtualized = true + tfmdata.emulatedlmtx = true + end +end + +fonts.handlers.otf.features.register { + name = "emulate lmtx", + description = "emulate lmtx mode", + default = emulate, + manipulators = { base = emulatelmtx }, +} |