From b79e123941f1d1b3cc13d05ee4d4d37c72c6a253 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 28 Apr 2021 19:25:48 +0200 Subject: 2021-04-28 18:37:00 --- scripts/context/lua/mtx-update.lua | 60 ---- scripts/context/lua/mtxrun.lua | 6 +- scripts/context/stubs/mswin/mtxrun.lua | 6 +- scripts/context/stubs/unix/mtxrun | 6 +- scripts/context/stubs/win64/mtxrun.lua | 6 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-en.mkii | 1 + tex/context/base/mkii/mult-pe.mkii | 1 + tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-imp-effects.lua | 172 +++++------ tex/context/base/mkiv/l-os.lua | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 23923 -> 23961 bytes tex/context/base/mkiv/status-lua.pdf | Bin 224973 -> 224975 bytes tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/driv-shp.lmt | 172 +++++++---- tex/context/base/mkxl/font-chk.lmt | 4 +- tex/context/base/mkxl/font-col.lmt | 1 + tex/context/base/mkxl/font-imp-effects.lmt | 317 +++++++++++++++++++++ tex/context/base/mkxl/font-imp-tracing.lmt | 126 +++++--- tex/context/base/mkxl/font-lib.mklx | 2 +- tex/context/base/mkxl/font-mat.mklx | 14 +- tex/context/base/mkxl/font-ots.lmt | 84 +++--- tex/context/base/mkxl/font-vfc.lmt | 6 +- tex/context/interface/mkii/keys-en.xml | 1 + tex/context/interface/mkii/keys-pe.xml | 1 + tex/generic/context/luatex/luatex-fonts-merged.lua | 144 ++++------ 29 files changed, 731 insertions(+), 413 deletions(-) create mode 100644 tex/context/base/mkxl/font-imp-effects.lmt diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua index f3e22493b..f360c996b 100644 --- a/scripts/context/lua/mtx-update.lua +++ b/scripts/context/lua/mtx-update.lua @@ -157,66 +157,6 @@ update.goodies = { }, } --- update.platforms = { --- ["mswin"] = "mswin", --- ["windows"] = "mswin", --- ["win32"] = "mswin", --- ["win"] = "mswin", --- -- ["mswin"] = "win32", --- -- ["windows"] = "win32", --- -- ["win32"] = "win32", --- -- ["win"] = "win32", --- -- --- -- ["mswin-64"] = "mswin-64", --- -- ["windows-64"] = "mswin-64", --- -- ["win64"] = "mswin-64", --- ["mswin-64"] = "win64", --- ["windows-64"] = "win64", --- ["win64"] = "win64", --- -- --- ["linux"] = "linux", --- ["linux-32"] = "linux", --- ["linux32"] = "linux", --- -- --- ["linux-64"] = "linux-64", --- ["linux64"] = "linux-64", --- -- --- ["linuxmusl-64"] = "linuxmusl-64", --- -- --- ["linux-armhf"] = "linux-armhf", --- -- --- ["freebsd"] = "freebsd", --- -- --- ["freebsd-amd64"] = "freebsd-amd64", --- -- --- ["kfreebsd"] = "kfreebsd-i386", --- ["kfreebsd-i386"] = "kfreebsd-i386", --- -- --- ["kfreebsd-amd64"] = "kfreebsd-amd64", --- -- --- ["linux-ppc"] = "linux-ppc", --- ["ppc"] = "linux-ppc", --- -- --- ["osx"] = "osx-intel", --- ["macosx"] = "osx-intel", --- ["osx-intel"] = "osx-intel", --- ["osxintel"] = "osx-intel", --- -- --- ["osx-ppc"] = "osx-ppc", --- ["osx-powerpc"] = "osx-ppc", --- ["osxppc"] = "osx-ppc", --- ["osxpowerpc"] = "osx-ppc", --- -- --- ["osx-64"] = "osx-64", --- -- --- ["solaris-intel"] = "solaris-intel", --- -- --- ["solaris-sparc"] = "solaris-sparc", --- ["solaris"] = "solaris-sparc", --- -- --- ["unknown"] = "unknown", --- } - update.platforms = { ["mswin"] = "mswin", ["windows"] = "mswin", diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 19158704c..f2562be4e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -3837,7 +3837,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-os"] = package.loaded["l-os"] or true --- original size: 19409, stripped down to: 10419 +-- original size: 19410, stripped down to: 10420 if not modules then modules={} end modules ['l-os']={ version=1.001, @@ -4061,7 +4061,7 @@ elseif name=="macosx" then elseif find(architecture,"x86_64",1,true) then platform="osx-64" elseif find(architecture,"arm64",1,true) then - platform="osx-64" + platform="osx-arm" else platform="osx-ppc" end @@ -25850,7 +25850,7 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1026427 +-- original bytes : 1026428 -- stripped bytes : 405705 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 19158704c..f2562be4e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -3837,7 +3837,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-os"] = package.loaded["l-os"] or true --- original size: 19409, stripped down to: 10419 +-- original size: 19410, stripped down to: 10420 if not modules then modules={} end modules ['l-os']={ version=1.001, @@ -4061,7 +4061,7 @@ elseif name=="macosx" then elseif find(architecture,"x86_64",1,true) then platform="osx-64" elseif find(architecture,"arm64",1,true) then - platform="osx-64" + platform="osx-arm" else platform="osx-ppc" end @@ -25850,7 +25850,7 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1026427 +-- original bytes : 1026428 -- stripped bytes : 405705 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 19158704c..f2562be4e 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -3837,7 +3837,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-os"] = package.loaded["l-os"] or true --- original size: 19409, stripped down to: 10419 +-- original size: 19410, stripped down to: 10420 if not modules then modules={} end modules ['l-os']={ version=1.001, @@ -4061,7 +4061,7 @@ elseif name=="macosx" then elseif find(architecture,"x86_64",1,true) then platform="osx-64" elseif find(architecture,"arm64",1,true) then - platform="osx-64" + platform="osx-arm" else platform="osx-ppc" end @@ -25850,7 +25850,7 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1026427 +-- original bytes : 1026428 -- stripped bytes : 405705 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 19158704c..f2562be4e 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -3837,7 +3837,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-os"] = package.loaded["l-os"] or true --- original size: 19409, stripped down to: 10419 +-- original size: 19410, stripped down to: 10420 if not modules then modules={} end modules ['l-os']={ version=1.001, @@ -4061,7 +4061,7 @@ elseif name=="macosx" then elseif find(architecture,"x86_64",1,true) then platform="osx-64" elseif find(architecture,"arm64",1,true) then - platform="osx-64" + platform="osx-arm" else platform="osx-ppc" end @@ -25850,7 +25850,7 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1026427 +-- original bytes : 1026428 -- stripped bytes : 405705 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 3a4d4cdcc..9a776779e 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{2021.04.26 20:39} +\newcontextversion{2021.04.28 18:34} %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 6539eea05..1862a0199 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{2021.04.26 20:39} +\edef\contextversion{2021.04.28 18:34} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii index df67038c3..76a626954 100644 --- a/tex/context/base/mkii/mult-en.mkii +++ b/tex/context/base/mkii/mult-en.mkii @@ -761,6 +761,7 @@ \setinterfaceconstant{coupling}{coupling} \setinterfaceconstant{couplingway}{couplingway} \setinterfaceconstant{criterium}{criterium} +\setinterfaceconstant{crop}{crop} \setinterfaceconstant{cropoffset}{cropoffset} \setinterfaceconstant{crossreference}{crossreference} \setinterfaceconstant{cssfile}{cssfile} diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index bbfae9556..9b19ce661 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -761,6 +761,7 @@ \setinterfaceconstant{coupling}{تزویج} \setinterfaceconstant{couplingway}{روش‌تزویج} \setinterfaceconstant{criterium}{criterium} +\setinterfaceconstant{crop}{crop} \setinterfaceconstant{cropoffset}{cropoffset} \setinterfaceconstant{crossreference}{crossreference} \setinterfaceconstant{cssfile}{cssfile} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index be48bbe8d..cd7b5e90c 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{2021.04.26 20:39} +\newcontextversion{2021.04.28 18:34} %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 87793ce03..4dd68dcd4 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.04.26 20:39} +\edef\contextversion{2021.04.28 18:34} %D Kind of special: diff --git a/tex/context/base/mkiv/font-imp-effects.lua b/tex/context/base/mkiv/font-imp-effects.lua index 43ce82b71..27a16914b 100644 --- a/tex/context/base/mkiv/font-imp-effects.lua +++ b/tex/context/base/mkiv/font-imp-effects.lua @@ -207,94 +207,63 @@ local rules = { "UnderbarRuleThickness", } --- local commands = char.commands --- if commands then --- local command = commands[1] --- if command and command[1] == "right" then --- commands[1] = rightcommand[command[2]-snap] --- end --- end - -- radicals are not yet ok -local setmathparameters -local setmathcharacters - -if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then - - setmathparameters = function(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) - if delta ~= 0 then - for i=1,#rules do - local name = rules[i] - local value = mathparameters[name] - if value then - mathparameters[name] = (squeeze or 1) * (value + dy) - end +local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + -- hm, this was "if delta ~= 0 then" but delta was gone + if dy ~= 0 then + for i=1,#rules do + local name = rules[i] + local value = mathparameters[name] + if value then + mathparameters[name] = (squeeze or 1) * (value + dy) end end end +end - setmathcharacters = function() - end +local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) -else + -- still not the perfect rule - setmathparameters = function(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) - if delta ~= 0 then - for i=1,#rules do - local name = rules[i] - local value = mathparameters[name] - if value then - mathparameters[name] = (squeeze or 1) * (value + dy) - end - end + local function wdpatch(char) + if wsnap ~= 0 then + char.width = char.width + wdelta/2 end end - setmathcharacters = function(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) - - -- still not the perfect rule - - local function wdpatch(char) - if wsnap ~= 0 then - char.width = char.width + wdelta/2 - end - end - - local function htpatch(char) - if hsnap ~= 0 then - local height = char.height - if height then - char.height = char.height + 2 * dy - end + local function htpatch(char) + if hsnap ~= 0 then + local height = char.height + if height then + char.height = char.height + 2 * dy end end + end - local character = characters[0x221A] + local character = characters[0x221A] - if character and character.next then - local char = character - local next = character.next + if character and character.next then + local char = character + local next = character.next + wdpatch(char) + htpatch(char) + while next do + char = characters[next] wdpatch(char) htpatch(char) - while next do - char = characters[next] - wdpatch(char) - htpatch(char) - next = char.next - end - if char then - local v = char.vert_variants - if v then - local top = v[#v] - if top then - local char = characters[top.glyph] - htpatch(char) - end + next = char.next + end + if char then + local v = char.vert_variants + if v then + local top = v[#v] + if top then + local char = characters[top.glyph] + htpatch(char) end end end - end end @@ -304,8 +273,6 @@ end -- inspect(fonts.hashes.characters[f][c]) -- end } -local shiftmode = CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 - local function manipulateeffect(tfmdata) local effect = tfmdata.properties.effect if effect then @@ -327,49 +294,42 @@ local function manipulateeffect(tfmdata) local factor = (1 + effect.factor) * factor local hfactor = (1 + effect.hfactor) * hfactor local vfactor = (1 + effect.vfactor) * vfactor - if shiftmode then - parameters.hshift = hshift - parameters.vshift = vshift - else - vshift = vshift ~= 0 and upcommand[vshift] or false - hshift = rightcommand[hshift] - end + vshift = vshift ~= 0 and upcommand[vshift] or false + hshift = rightcommand[hshift] for unicode, character in next, characters do local oldwidth = character.width local oldheight = character.height local olddepth = character.depth if oldwidth and oldwidth > 0 then character.width = oldwidth + wdelta - if not shiftmode then - local commands = character.commands - if vshift then - if commands then - prependcommands ( commands, - -- show_effect, - hshift, - vshift - ) - else - character.commands = { - -- show_effect, - hshift, - vshift, - charcommand[unicode] - } - end + local commands = character.commands + if vshift then + if commands then + prependcommands ( commands, + -- show_effect, + hshift, + vshift + ) + else + character.commands = { + -- show_effect, + hshift, + vshift, + charcommand[unicode] + } + end + else + if commands then + prependcommands ( commands, + -- show_effect, + hshift + ) else - if commands then - prependcommands ( commands, - -- show_effect, - hshift - ) - else - character.commands = { - -- show_effect, - hshift, - charcommand[unicode] - } - end + character.commands = { + -- show_effect, + hshift, + charcommand[unicode] + } end end end diff --git a/tex/context/base/mkiv/l-os.lua b/tex/context/base/mkiv/l-os.lua index 73841074c..c7584ccce 100644 --- a/tex/context/base/mkiv/l-os.lua +++ b/tex/context/base/mkiv/l-os.lua @@ -359,7 +359,7 @@ elseif name == "macosx" then elseif find(architecture,"x86_64",1,true) then platform = "osx-64" elseif find(architecture,"arm64",1,true) then - platform = "osx-64" + platform = "osx-arm" else platform = "osx-ppc" end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index ae6464bfa..54187bc87 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index ff552cb3c..e12630a56 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 9b2fb738e..39593056b 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{2021.04.26 20:39} +\newcontextversion{2021.04.28 18:34} %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 35103e9b4..f7395c758 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{2021.04.26 20:39} +\immutable\edef\contextversion{2021.04.28 18:34} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index cd117f326..2be1fd105 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -164,10 +164,22 @@ local flush_character do -- todo: cache streams - local default = 16384 * number.dimenfactors.bp -- 65536 // 4 + local default = 16384 -- * number.dimenfactors.bp -- 65536 // 4 local vfinjectors = fonts.helpers.vfinjectors + local function flushchar(current,font,char,fnt,chr,f,e) + if fnt then + local nest = char ~= chr or font ~= fnt + if fnt == 0 then + fnt = main + end + return flush_character(current,fnt,chr,factor,nest,pos_h,pos_v,pos_r,f,e) + else + return 0 + end + end + local function flush_vf_packet(current,pos_h,pos_v,pos_r,font,char,data,factor,vfcommands,sx,sy) if nesting > 100 then @@ -188,23 +200,20 @@ local flush_character do local fonts = data.fonts local siz = (data.parameters.factor or 1)/65536 - local function flushchar(font,char,fnt,chr,f,e) - if fnt then - local nest = char ~= chr or font ~= fnt - if fnt == 0 then - fnt = main - end - return flush_character(current,fnt,chr,factor,nest,pos_h,pos_v,pos_r,f,e) - else - return 0 - end - end + -- An alternative where we (here) locally define handlers like this: + -- + -- if not vfinjectors then + -- function vfinjectors.char(hpos,vpos,packet) + -- -- .... access: font, char, factor, sx, xy + -- end + -- end + -- + -- doesn't work because accessing the parameters passed to the outer function doesn't + -- work as expected (so we end up in a nesting loop). I remember hitting this somewhat + -- unexpected feature before. -- we assume resolved fonts: id mandate but maybe also size - -- we could map left, right, up, down -> offset - -- we could map char, font, slot to -> slot - for i=1,#vfcommands do local packet = vfcommands[i] local command = packet[1] @@ -212,24 +221,24 @@ local flush_character do local chr = packet[2] local f = packet[3] local e = packet[4] - pos_h = pos_h + flushchar(font,char,fnt,chr,f,e) + pos_h = pos_h + flushchar(current,font,char,fnt,chr,f,e) elseif command == "slot" then local index = packet[2] local chr = packet[3] local f = packet[4] local e = packet[5] if index == 0 then - pos_h = pos_h + flushchar(font,char,font,chr,f,e) + pos_h = pos_h + flushchar(current,font,char,font,chr,f,e) else local okay = fonts and fonts[index] if okay then local fnt = okay.id if fnt then - pos_h = pos_h + flushchar(font,char,fnt,chr,f,e) + pos_h = pos_h + flushchar(current,font,char,fnt,chr,f,e) end else -- safeguard, we assume the font itself (often index 1) - pos_h = pos_h + flushchar(font,char,font,chr,f,e) + pos_h = pos_h + flushchar(current,font,char,font,chr,f,e) end end elseif command == "use" then @@ -300,7 +309,7 @@ local flush_character do pos_v = pos_v + v * sy end if c then - flushchar(font,char,fnt,c) + flushchar(current,font,char,fnt,c) pos_h = ph pos_v = pv end @@ -320,7 +329,7 @@ local flush_character do pos_v = pos_v + v * sy end if c then - flushchar(font,char,fnt,c) + flushchar(current,font,char,fnt,c) pos_h = ph pos_v = pv end @@ -336,6 +345,62 @@ local flush_character do pos_v = s[2] level = level - 1 end + elseif command == "frame" then + -- d:width d:height d:depth d:rulethickness b:outline b:advance b:baseline s:color + local width = packet[2] + local height = packet[3] + local depth = packet[4] + local wd, ht, dp + if width == true or height == true or depth == true then + wd, ht, dp = getwhd(current,true) + end + if width == true then + width = wd + elseif not width then + width = 0 + end + if height == true then + height = ht + elseif not height then + height = 0 + end + if depth == true then + depth = dp + elseif not depth then + depth = 0 + end + local total = height + depth + if width > 0 and total > 0 then + if factor ~= 0 then + width = width + width * factor / 1000 + end + if width > 0 then + local line = packet[5] or default + local outline = packet[6] + local advance = packet[7] + if outline == nil then + outline = true + end + if advance == nil then + advance = true + end + local baseline = outline and packet[8] + local color = packet[9] -- no longer needed probably + if color then + vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string + end + width = width * sx + height = height * sy + depth = depth * sy + flushspecialrule(pos_h,pos_v,pos_r,width,height,depth,line,outline,baseline) + if color then + vfinjectors.stopcolor() + end + if advance then + pos_h = pos_h + width + end + end + end elseif command == "rule" then local size_v = packet[2] local size_h = packet[3] @@ -350,37 +415,27 @@ local flush_character do pos_h = pos_h + size_h end end - elseif command == "frame" then - -- d:width d:height d:depth d:rulethickness b:outline b:advance b:baseline s:color - local width = packet[2] - if width > 0 then - local height = packet[3] or 0 - local depth = packet[4] or 0 - local total = height + depth - if total > 0 then - if factor ~= 0 then - width = width + width * factor / 1000 + elseif command == "line" then + local wd = packet[2] or 0 + local ht = packet[3] or 0 + local dp = packet[4] or 0 + if wd > 0 and ht ~= 0 and dp ~= 0 then + if factor ~= 0 then + wd = wd + wd * factor / 1000 + end + if wd > 0 then + wd = wd * sx + ht = ht * sy + dp = dp * sy + local color = packet[5] -- no longer needed probably + if color then + vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string end - if width > 0 then - local line = packet[5] or default - local outline = not packet[6] - local advance = not packet[7] - local baseline = outline and packet[8] - local color = packet[9] -- no longer needed probably - if color then - vfinjectors.startcolor(pos_h,pos_v,color) -- takes packet or string - end - width = width * sx - height = height * sy - depth = depth * sy - flushspecialrule(pos_h,pos_v,pos_r,width,height,depth,line,outline,baseline) - if color then - vfinjectors.stopcolor() - end - if advance then - pos_h = pos_h + width - end + flushsimplerule(pos_h,pos_v-dp,pos_r,wd,ht+dp) + if color then + vfinjectors.stopcolor() end + pos_h = pos_h + wd end end elseif command == "font" then @@ -399,20 +454,25 @@ local flush_character do if kind == "function" then code(font,char,pos_h,pos_v,sx,sy) end - elseif command == "node" then -- obsolete + elseif command == "node" then local h = packet[2] hlist_out(h,getlist(h)) + -- elseif command == "pdf" then + -- unsupported + -- elseif command == "pdfmode" then + -- unsupported + -- elseif command == "special" then + -- unsupported + -- elseif command == "nop" then + -- just ignored + -- elseif command == "image" then + -- unsupported, use "node" else local injector = vfinjectors[command] if injector then injector(pos_h,pos_v,packet) end end - -- image : not needed, maybe some day - -- pdfmode : not used - -- special : makes no sense - -- nop : the official ignore - -- scale : not supported end pos_h = saved_h diff --git a/tex/context/base/mkxl/font-chk.lmt b/tex/context/base/mkxl/font-chk.lmt index 6f927e097..fa1167b1c 100644 --- a/tex/context/base/mkxl/font-chk.lmt +++ b/tex/context/base/mkxl/font-chk.lmt @@ -430,9 +430,11 @@ local function addvisualspace(tfmdata) if spacechar and not spacechar.commands then local w = spacechar.width local h = tfmdata.parameters.xheight + -- local h = tfmdata.parameters.xheight / 4 -- could be "visualspace=large" or so local c = { width = w, - commands = { { "rule", h, w } } + commands = { { "rule", h, w } }, + -- commands = { { "line", w, 5*h, h } }, } local u = addprivate(tfmdata, "visualspace", c) end diff --git a/tex/context/base/mkxl/font-col.lmt b/tex/context/base/mkxl/font-col.lmt index 41d327400..d60efb216 100644 --- a/tex/context/base/mkxl/font-col.lmt +++ b/tex/context/base/mkxl/font-col.lmt @@ -384,6 +384,7 @@ local function monoslot(font,char,parent,factor) width = width, height = character.height, depth = character.depth, + -- { "offset", ... } commands = { rightcommand[(width - character.width or 0)/2], charcommand[char], diff --git a/tex/context/base/mkxl/font-imp-effects.lmt b/tex/context/base/mkxl/font-imp-effects.lmt new file mode 100644 index 000000000..1f9810f93 --- /dev/null +++ b/tex/context/base/mkxl/font-imp-effects.lmt @@ -0,0 +1,317 @@ +if not modules then modules = { } end modules ['font-imp-effects'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: pickup from goodies: if type(effect) then ... + +local next, type, tonumber = next, type, tonumber +local is_boolean = string.is_boolean + +local fonts = fonts + +local handlers = fonts.handlers +local registerotffeature = handlers.otf.features.register +local registerafmfeature = handlers.afm.features.register + +local settings_to_hash = utilities.parsers.settings_to_hash_colon_too + +local report_effect = logs.reporter("fonts","effect") +local report_slant = logs.reporter("fonts","slant") +local report_extend = logs.reporter("fonts","extend") +local report_squeeze = logs.reporter("fonts","squeeze") + +local trace = false + +trackers.register("fonts.effect", function(v) trace = v end) +trackers.register("fonts.slant", function(v) trace = v end) +trackers.register("fonts.extend", function(v) trace = v end) +trackers.register("fonts.squeeze",function(v) trace = v end) + +local function initializeslant(tfmdata,value) + value = tonumber(value) + if not value then + value = 0 + elseif value > 1 then + value = 1 + elseif value < -1 then + value = -1 + end + if trace then + report_slant("applying %0.3f",value) + end + tfmdata.parameters.slantfactor = value +end + +local specification = { + name = "slant", + description = "slant glyphs", + initializers = { + base = initializeslant, + node = initializeslant, + } +} + +registerotffeature(specification) +registerafmfeature(specification) + +local function initializeextend(tfmdata,value) + value = tonumber(value) + if not value then + value = 0 + elseif value > 10 then + value = 10 + elseif value < -10 then + value = -10 + end + if trace then + report_extend("applying %0.3f",value) + end + tfmdata.parameters.extendfactor = value +end + +local specification = { + name = "extend", + description = "scale glyphs horizontally", + initializers = { + base = initializeextend, + node = initializeextend, + } +} + +registerotffeature(specification) +registerafmfeature(specification) + +local function initializesqueeze(tfmdata,value) + value = tonumber(value) + if not value then + value = 0 + elseif value > 10 then + value = 10 + elseif value < -10 then + value = -10 + end + if trace then + report_squeeze("applying %0.3f",value) + end + tfmdata.parameters.squeezefactor = value +end + +local specification = { + name = "squeeze", + description = "scale glyphs vertically", + initializers = { + base = initializesqueeze, + node = initializesqueeze, + } +} + +registerotffeature(specification) +registerafmfeature(specification) + +local effects = { + inner = 0, + normal = 0, + outer = 1, + outline = 1, + both = 2, + hidden = 3, +} + +local function initializeeffect(tfmdata,value) + local spec + if type(value) == "number" then + spec = { width = value } + else + spec = settings_to_hash(value) + end + local effect = spec.effect or "both" + local width = tonumber(spec.width) or 0 + local mode = effects[effect] + if not mode then + report_effect("invalid effect %a",effect) + elseif width == 0 and mode == 0 then + report_effect("invalid width %a for effect %a",width,effect) + else + local parameters = tfmdata.parameters + local properties = tfmdata.properties + parameters.mode = mode + parameters.width = width * 1000 + if is_boolean(spec.auto) == true then + local squeeze = 1 - width/20 + local average = (1 - squeeze) * width * 100 + spec.squeeze = squeeze + spec.extend = 1 + width/2 + spec.wdelta = average + spec.hdelta = average/2 + spec.ddelta = average/2 + spec.vshift = average/2 + end + local factor = tonumber(spec.factor) or 0 + local hfactor = tonumber(spec.hfactor) or factor + local vfactor = tonumber(spec.vfactor) or factor + local delta = tonumber(spec.delta) or 1 + local wdelta = tonumber(spec.wdelta) or delta + local hdelta = tonumber(spec.hdelta) or delta + local ddelta = tonumber(spec.ddelta) or hdelta + local vshift = tonumber(spec.vshift) or 0 + local slant = spec.slant + local extend = spec.extend + local squeeze = spec.squeeze + if slant then + initializeslant(tfmdata,slant) + end + if extend then + initializeextend(tfmdata,extend) + end + if squeeze then + initializesqueeze(tfmdata,squeeze) + end + properties.effect = { + effect = effect, + width = width, + factor = factor, + hfactor = hfactor, + vfactor = vfactor, + wdelta = wdelta, + hdelta = hdelta, + ddelta = ddelta, + vshift = vshift, + slant = tfmdata.parameters.slantfactor, + extend = tfmdata.parameters.extendfactor, + squeeze = tfmdata.parameters.squeezefactor, + } + end +end + +local rules = { + "RadicalRuleThickness", + "OverbarRuleThickness", + "FractionRuleThickness", + "UnderbarRuleThickness", +} + +-- radicals are not yet ok + +local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + -- hm, this was "if delta ~= 0 then" but delta was gone + if dy ~= 0 then + for i=1,#rules do + local name = rules[i] + local value = mathparameters[name] + if value then + mathparameters[name] = (squeeze or 1) * (value + dy) + end + end + end +end + +-- local show_effect = { "lua", function(f,c) +-- report_effect("font id %i, char %C",f,c) +-- inspect(fonts.hashes.characters[f][c]) +-- end } + +local function manipulateeffect(tfmdata) + local effect = tfmdata.properties.effect + if effect then + local characters = tfmdata.characters + local parameters = tfmdata.parameters + local mathparameters = tfmdata.mathparameters + local multiplier = effect.width * 100 + local factor = parameters.factor + local hfactor = parameters.hfactor + local vfactor = parameters.vfactor + local wdelta = effect.wdelta * hfactor * multiplier + local hdelta = effect.hdelta * vfactor * multiplier + local ddelta = effect.ddelta * vfactor * multiplier + local vshift = effect.vshift * vfactor * multiplier + local squeeze = effect.squeeze + local hshift = wdelta / 2 + local dx = multiplier * vfactor + local dy = vshift + local factor = (1 + effect.factor) * factor + local hfactor = (1 + effect.hfactor) * hfactor + local vfactor = (1 + effect.vfactor) * vfactor + parameters.hshift = hshift + parameters.vshift = vshift + for unicode, character in next, characters do + local oldwidth = character.width + local oldheight = character.height + local olddepth = character.depth + if oldwidth and oldwidth > 0 then + character.width = oldwidth + wdelta + end + if oldheight and oldheight > 0 then + character.height = oldheight + hdelta + end + if olddepth and olddepth > 0 then + character.depth = olddepth + ddelta + end + end + if mathparameters then + setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + end + parameters.factor = factor + parameters.hfactor = hfactor + parameters.vfactor = vfactor + if trace then + report_effect("applying") + report_effect(" effect : %s", effect.effect) + report_effect(" width : %s => %s", effect.width, multiplier) + report_effect(" factor : %s => %s", effect.factor, factor ) + report_effect(" hfactor : %s => %s", effect.hfactor,hfactor) + report_effect(" vfactor : %s => %s", effect.vfactor,vfactor) + report_effect(" wdelta : %s => %s", effect.wdelta, wdelta) + report_effect(" hdelta : %s => %s", effect.hdelta, hdelta) + report_effect(" ddelta : %s => %s", effect.ddelta, ddelta) + end + end +end + +local specification = { + name = "effect", + description = "apply effects to glyphs", + initializers = { + base = initializeeffect, + node = initializeeffect, + }, + manipulators = { + base = manipulateeffect, + node = manipulateeffect, + }, +} + +registerotffeature(specification) +registerafmfeature(specification) + +local function initializeoutline(tfmdata,value) + value = tonumber(value) + if not value then + value = 0 + else + value = tonumber(value) or 0 + end + local parameters = tfmdata.parameters + local properties = tfmdata.properties + parameters.mode = effects.outline + parameters.width = value * 1000 + properties.effect = { + effect = effect, + width = width, + } +end + +local specification = { + name = "outline", + description = "outline glyphs", + initializers = { + base = initializeoutline, + node = initializeoutline, + } +} + +registerotffeature(specification) +registerafmfeature(specification) diff --git a/tex/context/base/mkxl/font-imp-tracing.lmt b/tex/context/base/mkxl/font-imp-tracing.lmt index 59603c9dd..9f842b522 100644 --- a/tex/context/base/mkxl/font-imp-tracing.lmt +++ b/tex/context/base/mkxl/font-imp-tracing.lmt @@ -33,6 +33,81 @@ local v_frame = variables.frame local v_empty = variables.empty local v_none = variables.none +-- d:width d:height d:depth d:rulethickness b:outline b:advance b:baseline s:color + +-- local function initialize(tfmdata,key,value) +-- if value then +-- local vfspecials = fonts.helpers.vfspecials +-- local vfcommands = fonts.helpers.commands +-- local backgrounds = vfspecials.backgrounds +-- local outlines = vfspecials.outlines +-- local characters = tfmdata.characters +-- local rulecache = backgrounds +-- local showchar = true +-- local color = "palegray" +-- if type(value) == "string" then +-- value = settings_to_array(value) +-- for i=1,#value do +-- local v = value[i] +-- if v == v_frame then +-- rulecache = outlines +-- elseif v == v_background then +-- rulecache = backgrounds +-- elseif v == v_empty then +-- showchar = false +-- elseif v == v_none then +-- color = nil +-- else +-- color = v +-- end +-- end +-- end +-- local gray = color and { "startcolor", color } or nil +-- local black = gray and { "stopcolor" } or nil +-- for unicode, character in next, characters do +-- local width = character.width or 0 +-- local height = character.height or 0 +-- local depth = character.depth or 0 +-- local rule = rulecache[height][depth][width] +-- if showchar then +-- local commands = character.commands +-- if commands then +-- if gray then +-- character.commands = prependcommands ( +-- commands, gray, rule, black +-- ) +-- else +-- character.commands = prependcommands ( +-- commands, rule +-- ) +-- end +-- else +-- local char = charcommand[unicode] +-- if gray then +-- character.commands = { +-- gray, rule, black, char +-- } +-- else +-- character.commands = { +-- rule, char +-- } +-- end +-- end +-- else +-- if gray then +-- character.commands = { +-- gray, rule, black +-- } +-- else +-- character.commands = { +-- rule +-- } +-- end +-- end +-- end +-- end +-- end + local function initialize(tfmdata,key,value) if value then local vfspecials = fonts.helpers.vfspecials @@ -40,67 +115,38 @@ local function initialize(tfmdata,key,value) local backgrounds = vfspecials.backgrounds local outlines = vfspecials.outlines local characters = tfmdata.characters - local rulecache = backgrounds + local rule = { "frame", true, true, true, false, false, false, false, "palegray" } local showchar = true - local color = "palegray" if type(value) == "string" then value = settings_to_array(value) for i=1,#value do local v = value[i] if v == v_frame then - rulecache = outlines + rule[6] = true elseif v == v_background then - rulecache = backgrounds + rule[6] = false elseif v == v_empty then showchar = false elseif v == v_none then - color = nil + rule[9] = false else - color = v + rule[9] = v end end end - local gray = color and { "startcolor", color } or nil - local black = gray and { "stopcolor" } or nil + if not showchar then + rule = { rule } + end for unicode, character in next, characters do - local width = character.width or 0 - local height = character.height or 0 - local depth = character.depth or 0 - local rule = rulecache[height][depth][width] if showchar then local commands = character.commands if commands then - if gray then - character.commands = prependcommands ( - commands, gray, rule, black - ) - else - character.commands = prependcommands ( - commands, rule - ) - end + character.commands = prependcommands ( commands, rule ) else - local char = charcommand[unicode] - if gray then - character.commands = { - gray, rule, black, char - } - else - character.commands = { - rule, char - } - end + character.commands = { rule, charcommand[unicode] } end else - if gray then - character.commands = { - gray, rule, black - } - else - character.commands = { - rule - } - end + character.commands = rule end end end diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index f1f7f5ce0..063d84976 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -104,7 +104,7 @@ \registerctxluafile{font-imp-unicode}{} \registerctxluafile{font-imp-math}{autosuffix} \registerctxluafile{font-imp-notused}{} -\registerctxluafile{font-imp-effects}{} +\registerctxluafile{font-imp-effects}{autosuffix} \registerctxluafile{font-imp-quality}{} \registerctxluafile{font-imp-italics}{} \registerctxluafile{font-imp-dimensions}{} diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 3fc6275a6..055624d03 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -475,13 +475,13 @@ \installcorenamespace{fontmathsynchronizer} \installcorenamespace{fontmathstoredstrategy} -\letvalue{\??fontmathsynchronizer\s!tf }\font_helpers_synchronize_math_family_mr -\letvalue{\??fontmathsynchronizer\s!sl }\font_helpers_synchronize_math_family_mr -\letvalue{\??fontmathsynchronizer\s!it }\font_helpers_synchronize_math_family_mr -\letvalue{\??fontmathsynchronizer\s!bf }\font_helpers_synchronize_math_family_mb -\letvalue{\??fontmathsynchronizer\s!bs }\font_helpers_synchronize_math_family_mb -\letvalue{\??fontmathsynchronizer\s!bi }\font_helpers_synchronize_math_family_mb -\letvalue{\??fontmathsynchronizer\empty}\font_helpers_synchronize_math_family_mr +\letcsname\??fontmathsynchronizer\s!tf \endcsname\font_helpers_synchronize_math_family_mr +\letcsname\??fontmathsynchronizer\s!sl \endcsname\font_helpers_synchronize_math_family_mr +\letcsname\??fontmathsynchronizer\s!it \endcsname\font_helpers_synchronize_math_family_mr +\letcsname\??fontmathsynchronizer\s!bf \endcsname\font_helpers_synchronize_math_family_mb +\letcsname\??fontmathsynchronizer\s!bs \endcsname\font_helpers_synchronize_math_family_mb +\letcsname\??fontmathsynchronizer\s!bi \endcsname\font_helpers_synchronize_math_family_mb +\letcsname\??fontmathsynchronizer\empty\endcsname\font_helpers_synchronize_math_family_mr % \def\font_helpers_synchronize_math_family % {\csname\??fontmathsynchronizer\ifcsname\??fontmathsynchronizer\fontalternative\endcsname\fontalternative\fi\endcsname} diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index be5b0ce40..ec2d4bb29 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -4124,49 +4124,60 @@ end -- so far -local plugins = { } -otf.plugins = plugins - -local report = logs.reporter("fonts") - -function otf.registerplugin(name,f) - if type(name) == "string" and type(f) == "function" then - plugins[name] = { name, f } - report() - report("plugin %a has been loaded, please be aware of possible side effects",name) - report() - if logs.pushtarget then - logs.pushtarget("log") - end - report("Plugins are not officially supported unless stated otherwise. This is because") - report("they bypass the regular font handling and therefore some features in ConTeXt") - report("(especially those related to fonts) might not work as expected or might not work") - report("at all. Some plugins are for testing and development only and might change") - report("whenever we feel the need for it.") - report() - if logs.poptarget then - logs.poptarget() +do + + local plugins = { } + otf.plugins = plugins + + local report = logs.reporter("fonts") + local warned = false + local okay = { text = true } + + function otf.registerplugin(name,f) + if type(name) == "string" and type(f) == "function" then + plugins[name] = { name, f } + if okay[name] then + -- no warning (e.g. the diagnostic text plugin) + else + report("plugin %a has been loaded, please be aware of possible side effects",name) + if not warned then + if logs.pushtarget then + logs.pushtarget("log") + end + report("Plugins are not officially supported unless stated otherwise. This is because") + report("they bypass the regular font handling and therefore some features in ConTeXt") + report("(especially those related to fonts) might not work as expected or might not work") + report("at all. Some plugins are for testing and development only and might change") + report("whenever we feel the need for it.") + report() + if logs.poptarget then + logs.poptarget() + end + warned = true + end + end end end -end -function otf.plugininitializer(tfmdata,value) - if type(value) == "string" then - tfmdata.shared.plugin = plugins[value] + function otf.plugininitializer(tfmdata,value) + if type(value) == "string" then + tfmdata.shared.plugin = plugins[value] + end end -end -function otf.pluginprocessor(head,font,dynamic,direction) -- n - local s = fontdata[font].shared - local p = s and s.plugin - if p then - if trace_plugins then - report_process("applying plugin %a",p[1]) + function otf.pluginprocessor(head,font,dynamic,direction) -- n + local s = fontdata[font].shared + local p = s and s.plugin + if p then + if trace_plugins then + report_process("applying plugin %a",p[1]) + end + return p[2](head,font,dynamic,direction) + else + return head, false end - return p[2](head,font,dynamic,direction) - else - return head, false end + end function otf.featuresinitializer(tfmdata,value) @@ -4188,6 +4199,7 @@ registerotffeature { } } + -- Moved here (up) a bit. This doesn't really belong in generic so it will -- move to a context module some day. diff --git a/tex/context/base/mkxl/font-vfc.lmt b/tex/context/base/mkxl/font-vfc.lmt index 2872bb908..93e6fd4e5 100644 --- a/tex/context/base/mkxl/font-vfc.lmt +++ b/tex/context/base/mkxl/font-vfc.lmt @@ -94,7 +94,7 @@ helpers.vfspecials = { backgrounds = setmetatableindex(function(t,h) local v = setmetatableindex(function(t,d) local v = setmetatableindex(function(t,w) - local v = { "frame", w, h, d, defaultline, true, true } + local v = { "frame", w, h, d, defaultline, false, false } t[w] = v return v end) @@ -108,7 +108,7 @@ helpers.vfspecials = { outlines = setmetatableindex(function(t,h) local v = setmetatableindex(function(t,d) local v = setmetatableindex(function(t,w) - local v = { "frame", w, h, d, defaultline, false, true } + local v = { "frame", w, h, d, defaultline, true, false } t[w] = v return v end) @@ -168,6 +168,8 @@ function helpers.scalecommands(list,hdelta,vdelta) result[i] = { key, cmd[2]*vdelta } elseif key == "offset" or key == "rule" then -- or key == "compose" result[i] = { key, cmd[2]*hdelta, cmd[3]*vdelta } + elseif key == "line" then -- or key == "compose" + result[i] = { key, cmd[2]*hdelta, cmd[3]*vdelta, cmd[4]*vdelta, cmd[5] } -- elseif key == "frame" then -- result[i] = cmd -- already scaled, for now else diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml index 6f225eef6..5915aef11 100644 --- a/tex/context/interface/mkii/keys-en.xml +++ b/tex/context/interface/mkii/keys-en.xml @@ -767,6 +767,7 @@ + diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index d4fbccd21..00ae8cff7 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -767,6 +767,7 @@ + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1a0cf868e..86d81983a 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 : 2021-04-26 20:39 +-- merge date : 2021-04-28 18:34 do -- begin closure to overcome local limits and interference @@ -37180,74 +37180,55 @@ local rules={ "FractionRuleThickness", "UnderbarRuleThickness", } -local setmathparameters -local setmathcharacters -if CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 then - setmathparameters=function(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) - if delta~=0 then - for i=1,#rules do - local name=rules[i] - local value=mathparameters[name] - if value then - mathparameters[name]=(squeeze or 1)*(value+dy) - end +local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + if dy~=0 then + for i=1,#rules do + local name=rules[i] + local value=mathparameters[name] + if value then + mathparameters[name]=(squeeze or 1)*(value+dy) end end end - setmathcharacters=function() - end -else - setmathparameters=function(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) - if delta~=0 then - for i=1,#rules do - local name=rules[i] - local value=mathparameters[name] - if value then - mathparameters[name]=(squeeze or 1)*(value+dy) - end - end +end +local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) + local function wdpatch(char) + if wsnap~=0 then + char.width=char.width+wdelta/2 end end - setmathcharacters=function(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) - local function wdpatch(char) - if wsnap~=0 then - char.width=char.width+wdelta/2 + local function htpatch(char) + if hsnap~=0 then + local height=char.height + if height then + char.height=char.height+2*dy end end - local function htpatch(char) - if hsnap~=0 then - local height=char.height - if height then - char.height=char.height+2*dy - end - end - end - local character=characters[0x221A] - if character and character.next then - local char=character - local next=character.next + end + local character=characters[0x221A] + if character and character.next then + local char=character + local next=character.next + wdpatch(char) + htpatch(char) + while next do + char=characters[next] wdpatch(char) htpatch(char) - while next do - char=characters[next] - wdpatch(char) - htpatch(char) - next=char.next - end - if char then - local v=char.vert_variants - if v then - local top=v[#v] - if top then - local char=characters[top.glyph] - htpatch(char) - end + next=char.next + end + if char then + local v=char.vert_variants + if v then + local top=v[#v] + if top then + local char=characters[top.glyph] + htpatch(char) end end end end end -local shiftmode=CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 local function manipulateeffect(tfmdata) local effect=tfmdata.properties.effect if effect then @@ -37269,45 +37250,38 @@ local function manipulateeffect(tfmdata) local factor=(1+effect.factor)*factor local hfactor=(1+effect.hfactor)*hfactor local vfactor=(1+effect.vfactor)*vfactor - if shiftmode then - parameters.hshift=hshift - parameters.vshift=vshift - else - vshift=vshift~=0 and upcommand[vshift] or false - hshift=rightcommand[hshift] - end + vshift=vshift~=0 and upcommand[vshift] or false + hshift=rightcommand[hshift] for unicode,character in next,characters do local oldwidth=character.width local oldheight=character.height local olddepth=character.depth if oldwidth and oldwidth>0 then character.width=oldwidth+wdelta - if not shiftmode then - local commands=character.commands - if vshift then - if commands then + local commands=character.commands + if vshift then + if commands then + prependcommands (commands, + hshift, + vshift + ) + else + character.commands={ + hshift, + vshift, + charcommand[unicode] + } + end + else + if commands then prependcommands (commands, - hshift, - vshift + hshift ) - else - character.commands={ - hshift, - vshift, - charcommand[unicode] - } - end else - if commands then - prependcommands (commands, - hshift - ) - else - character.commands={ - hshift, - charcommand[unicode] - } - end + character.commands={ + hshift, + charcommand[unicode] + } end end end -- cgit v1.2.3