From 273b29a84706a7cefb56963300a7f54f3ffe147f Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 30 Nov 2019 20:31:49 +0100 Subject: 2019-11-29 21:57:00 --- doc/context/documents/general/qrcs/setup-cs.pdf | Bin 919923 -> 888245 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 919820 -> 889889 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 918121 -> 893992 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 917539 -> 885763 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 921459 -> 891887 bytes .../documents/general/qrcs/setup-mapping-cs.pdf | Bin 329602 -> 383777 bytes .../documents/general/qrcs/setup-mapping-de.pdf | Bin 329216 -> 384071 bytes .../documents/general/qrcs/setup-mapping-en.pdf | Bin 327644 -> 380569 bytes .../documents/general/qrcs/setup-mapping-fr.pdf | Bin 328659 -> 383919 bytes .../documents/general/qrcs/setup-mapping-it.pdf | Bin 329276 -> 383311 bytes .../documents/general/qrcs/setup-mapping-nl.pdf | Bin 328359 -> 382141 bytes .../documents/general/qrcs/setup-mapping-ro.pdf | Bin 537751 -> 620409 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 914751 -> 881480 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 917126 -> 885645 bytes scripts/context/lua/mtxrun.lua | 9 +- scripts/context/stubs/mswin/mtxrun.lua | 9 +- scripts/context/stubs/unix/mtxrun | 9 +- scripts/context/stubs/win64/mtxrun.lua | 9 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-it.mkii | 1 + tex/context/base/mkiv/colo-ini.mkiv | 10 +- tex/context/base/mkiv/colo-ini.mkxl | 10 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/context.mkxl | 2 +- tex/context/base/mkiv/driv-shp.lua | 130 +- tex/context/base/mkiv/font-con.lua | 7 +- tex/context/base/mkiv/font-ctx.lua | 4 + tex/context/base/mkiv/font-imp-quality.lua | 134 +- tex/context/base/mkiv/font-ocl.lua | 2 + tex/context/base/mkiv/node-aux.lua | 77 +- tex/context/base/mkiv/node-dir.lua | 129 +- tex/context/base/mkiv/node-ini.lua | 1 + tex/context/base/mkiv/node-ini.mkiv | 2 +- tex/context/base/mkiv/node-ltp.lua | 1351 +++++++++++--------- tex/context/base/mkiv/node-res.lua | 24 +- tex/context/base/mkiv/page-txt.mklx | 24 +- tex/context/base/mkiv/status-files.pdf | Bin 26096 -> 26661 bytes tex/context/base/mkiv/status-lua.pdf | Bin 230884 -> 268220 bytes tex/context/base/mkiv/trac-vis.lua | 45 +- tex/context/base/mkiv/typo-cap.lua | 4 +- tex/context/base/mkiv/util-sbx.lua | 3 +- tex/context/interface/mkii/keys-it.xml | 1 + tex/context/interface/mkiv/i-context.pdf | Bin 918121 -> 893992 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 24419 -> 61165 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 5 +- 47 files changed, 1151 insertions(+), 859 deletions(-) diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index c2bc58a10..92f8489e7 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index ccce3d287..7237f4fde 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index d57e3f0e4..6e498dc8e 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index 330b61558..d8f379b5c 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index 157475def..0e3f18386 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf index 03d835033..e65484c2e 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf and b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf index 257bf9547..0ec77450b 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-de.pdf and b/doc/context/documents/general/qrcs/setup-mapping-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf index 33314b29f..a7704a49f 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-en.pdf and b/doc/context/documents/general/qrcs/setup-mapping-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf index 224e69e38..47c7071e0 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf and b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf index b0c3d05d2..8b8af223e 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-it.pdf and b/doc/context/documents/general/qrcs/setup-mapping-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf index f60727ee1..e131b0474 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf and b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf index a847ca390..3e0bef424 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf and b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index 050f05eba..74d3d7d74 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 8e4a2831d..4f4eb4993 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index bf87526f2..94ca07bb3 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -14879,7 +14879,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 21058, stripped down to: 13199 +-- original size: 21084, stripped down to: 13214 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15125,6 +15125,7 @@ local iopopen=sandbox.original(io.popen) local reported={} local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict) if validbinaries~=false and (validbinaries==true or validbinaries[program]) then + local binpath=nil if variables then for variable,value in next,variables do local chktype=checkers[variable] @@ -15164,8 +15165,8 @@ local function validcommand(name,program,template,checkers,defaults,variables,re end end end + binpath=variables.binarypath end - local binpath=variables.binarypath if type(binpath)=="string" and binpath~="" then program=binpath.."/"..program end @@ -26128,8 +26129,8 @@ 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1040817 --- stripped bytes : 412122 +-- original bytes : 1040843 +-- stripped bytes : 412133 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index bf87526f2..94ca07bb3 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -14879,7 +14879,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 21058, stripped down to: 13199 +-- original size: 21084, stripped down to: 13214 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15125,6 +15125,7 @@ local iopopen=sandbox.original(io.popen) local reported={} local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict) if validbinaries~=false and (validbinaries==true or validbinaries[program]) then + local binpath=nil if variables then for variable,value in next,variables do local chktype=checkers[variable] @@ -15164,8 +15165,8 @@ local function validcommand(name,program,template,checkers,defaults,variables,re end end end + binpath=variables.binarypath end - local binpath=variables.binarypath if type(binpath)=="string" and binpath~="" then program=binpath.."/"..program end @@ -26128,8 +26129,8 @@ 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1040817 --- stripped bytes : 412122 +-- original bytes : 1040843 +-- stripped bytes : 412133 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index bf87526f2..94ca07bb3 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -14879,7 +14879,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 21058, stripped down to: 13199 +-- original size: 21084, stripped down to: 13214 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15125,6 +15125,7 @@ local iopopen=sandbox.original(io.popen) local reported={} local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict) if validbinaries~=false and (validbinaries==true or validbinaries[program]) then + local binpath=nil if variables then for variable,value in next,variables do local chktype=checkers[variable] @@ -15164,8 +15165,8 @@ local function validcommand(name,program,template,checkers,defaults,variables,re end end end + binpath=variables.binarypath end - local binpath=variables.binarypath if type(binpath)=="string" and binpath~="" then program=binpath.."/"..program end @@ -26128,8 +26129,8 @@ 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1040817 --- stripped bytes : 412122 +-- original bytes : 1040843 +-- stripped bytes : 412133 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index bf87526f2..94ca07bb3 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -14879,7 +14879,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 21058, stripped down to: 13199 +-- original size: 21084, stripped down to: 13214 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15125,6 +15125,7 @@ local iopopen=sandbox.original(io.popen) local reported={} local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict) if validbinaries~=false and (validbinaries==true or validbinaries[program]) then + local binpath=nil if variables then for variable,value in next,variables do local chktype=checkers[variable] @@ -15164,8 +15165,8 @@ local function validcommand(name,program,template,checkers,defaults,variables,re end end end + binpath=variables.binarypath end - local binpath=variables.binarypath if type(binpath)=="string" and binpath~="" then program=binpath.."/"..program end @@ -26128,8 +26129,8 @@ 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1040817 --- stripped bytes : 412122 +-- original bytes : 1040843 +-- stripped bytes : 412133 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 129aa988b..92326c9fb 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{2019.11.25 17:28} +\newcontextversion{2019.11.29 21:47} %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 1f1e6a492..e5f3237d9 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{2019.11.25 17:28} +\edef\contextversion{2019.11.29 21:47} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index 6f8042894..1d2425c9a 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -1045,6 +1045,7 @@ \setinterfaceconstant{overprint}{overprint} \setinterfaceconstant{ownerpassword}{ownerpassword} \setinterfaceconstant{ownnumber}{numeroproprio} +\setinterfaceconstant{packcriterium}{packcriterium} \setinterfaceconstant{page}{pagina} \setinterfaceconstant{pageboundaries}{limitipagina} \setinterfaceconstant{pagecolor}{colorepagina} diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv index fc456e824..bc4d1c82f 100644 --- a/tex/context/base/mkiv/colo-ini.mkiv +++ b/tex/context/base/mkiv/colo-ini.mkiv @@ -1417,10 +1417,10 @@ \definecolor[trace:g][g=.75,t=.5,a=1] \definecolor[trace:b][b=.75,t=.5,a=1] %definecolor[trace:c][c=.75,t=.5,a=1] -\definecolor[trace:c][g=.75,b=.75,t=.5,a=1] %definecolor[trace:m][m=.75,t=.5,a=1] -\definecolor[trace:m][r=.75,b=.75,t=.5,a=1] %definecolor[trace:y][y=.75,t=.5,a=1] +\definecolor[trace:c][g=.75,b=.75,t=.5,a=1] +\definecolor[trace:m][r=.75,b=.75,t=.5,a=1] \definecolor[trace:y][r=.75,g=.75,t=.5,a=1] \definecolor[trace:s][s=.75,t=.5,a=1] \definecolor[trace:d][s=.25,t=.5,a=1] @@ -1431,11 +1431,11 @@ \definecolor[trace:dg][g=.75,t=.75,a=1] \definecolor[trace:db][b=.75,t=.75,a=1] %definecolor[trace:dc][c=.75,t=.75,a=1] -\definecolor[trace:dc][g=.75,b=.75,t=.75,a=1] %definecolor[trace:dm][m=.75,t=.75,a=1] -\definecolor[trace:dm][r=.75,b=.75,t=.75,a=1] %definecolor[trace:dy][y=.75,t=.75,a=1] -\definecolor[trace:y][r=.75,g=.75,t=.75,a=1] +\definecolor[trace:dc][g=.75,b=.75,t=.75,a=1] +\definecolor[trace:dm][r=.75,b=.75,t=.75,a=1] +\definecolor[trace:dy][r=.75,g=.75,t=.75,a=1] \definecolor[trace:ds][s=.75,t=.75,a=1] \definecolor[trace:dd][s=.25,t=.75,a=1] \definecolor[trace:do][r=1,g=.6,b=.1,t=.75,a=1] diff --git a/tex/context/base/mkiv/colo-ini.mkxl b/tex/context/base/mkiv/colo-ini.mkxl index 53d45f943..726e1c47b 100644 --- a/tex/context/base/mkiv/colo-ini.mkxl +++ b/tex/context/base/mkiv/colo-ini.mkxl @@ -1359,10 +1359,10 @@ \definecolor[trace:g][g=.75,t=.5,a=1] \definecolor[trace:b][b=.75,t=.5,a=1] %definecolor[trace:c][c=.75,t=.5,a=1] -\definecolor[trace:c][g=.75,b=.75,t=.5,a=1] %definecolor[trace:m][m=.75,t=.5,a=1] -\definecolor[trace:m][r=.75,b=.75,t=.5,a=1] %definecolor[trace:y][y=.75,t=.5,a=1] +\definecolor[trace:c][g=.75,b=.75,t=.5,a=1] +\definecolor[trace:m][r=.75,b=.75,t=.5,a=1] \definecolor[trace:y][r=.75,g=.75,t=.5,a=1] \definecolor[trace:s][s=.75,t=.5,a=1] \definecolor[trace:d][s=.25,t=.5,a=1] @@ -1373,11 +1373,11 @@ \definecolor[trace:dg][g=.75,t=.75,a=1] \definecolor[trace:db][b=.75,t=.75,a=1] %definecolor[trace:dc][c=.75,t=.75,a=1] -\definecolor[trace:dc][g=.75,b=.75,t=.75,a=1] %definecolor[trace:dm][m=.75,t=.75,a=1] -\definecolor[trace:dm][r=.75,b=.75,t=.75,a=1] %definecolor[trace:dy][y=.75,t=.75,a=1] -\definecolor[trace:y][r=.75,g=.75,t=.75,a=1] +\definecolor[trace:dc][g=.75,b=.75,t=.75,a=1] +\definecolor[trace:dm][r=.75,b=.75,t=.75,a=1] +\definecolor[trace:dy][r=.75,g=.75,t=.75,a=1] \definecolor[trace:ds][s=.75,t=.75,a=1] \definecolor[trace:dd][s=.25,t=.75,a=1] \definecolor[trace:do][r=1,g=.6,b=.1,t=.75,a=1] diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 044fc4ce4..4c5925235 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{2019.11.25 17:28} +\newcontextversion{2019.11.29 21:47} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 8c264224b..a40bf3a14 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{2019.11.25 17:28} +\edef\contextversion{2019.11.29 21:47} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 95a7f2f8e..ab1d2d6f8 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.11.25 17:28} +\edef\contextversion{2019.11.29 21:47} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/driv-shp.lua b/tex/context/base/mkiv/driv-shp.lua index 5e4d9a29a..0137fb203 100644 --- a/tex/context/base/mkiv/driv-shp.lua +++ b/tex/context/base/mkiv/driv-shp.lua @@ -31,16 +31,15 @@ local getwhd = nuts.getwhd local getkern = nuts.getkern local getheight = nuts.getheight local getdepth = nuts.getdepth -local getwidth = nuts.getwidth +----- getwidth = nuts.getwidth local getnext = nuts.getnext local getsubtype = nuts.getsubtype local getid = nuts.getid local getleader = nuts.getleader -local getglue = nuts.getglue +----- getglue = nuts.getglue local getshift = nuts.getshift local getdata = nuts.getdata -local getboxglue = nuts.getboxglue -local getexpansion = nuts.getexpansion +----- getexpansion = nuts.getexpansion local getreplace = nuts.getreplace local setreplace = nuts.setreplace local getfont = nuts.getfont @@ -57,6 +56,7 @@ local nextnode = nuts.traversers.node local rangedimensions = node.direct.rangedimensions -- nuts ? local effectiveglue = nuts.effective_glue local start_of_par = nuts.start_of_par +local dirdimensions = nuts.dirdimensions local texget = tex.get @@ -511,27 +511,27 @@ local hlist_out, vlist_out do -- to be checked: begin- or enddir kan nil zijn, weird - local function calculate_width_to_enddir(this_box,begindir) -- can be a helper - local dir_nest = 1 - local enddir = begindir - for current, subtype in nextdir, getnext(begindir) do - if subtype == normaldir_code then -- todo - dir_nest = dir_nest + 1 - else - dir_nest = dir_nest - 1 - end - if dir_nest == 0 then -- does the type matter - enddir = current - local width = rangedimensions(this_box,begindir,enddir) - return enddir, width - end - end - if enddir == begindir then - local width = rangedimensions(this_box,begindir) -- ,enddir) - return enddir, width - end - return enddir, 0 - end + -- local function calculate_width_to_enddir(this_box,begindir) -- can be a helper + -- local dir_nest = 1 + -- local enddir = begindir + -- for current, subtype in nextdir, getnext(begindir) do + -- if subtype == normaldir_code then -- todo + -- dir_nest = dir_nest + 1 + -- else + -- dir_nest = dir_nest - 1 + -- end + -- if dir_nest == 0 then -- does the type matter + -- enddir = current + -- local width = rangedimensions(this_box,begindir,enddir) + -- return enddir, width + -- end + -- end + -- if enddir == begindir then + -- local width = rangedimensions(this_box,begindir) -- ,enddir) + -- return enddir, width + -- end + -- return enddir, 0 + -- end -- check frequencies of nodes @@ -815,59 +815,33 @@ local hlist_out, vlist_out do end pos_r = dir else --- local enddir, width = calculate_width_to_enddir(this_box,current) --- local ds = dirstack[enddir] --- ds.cur_h = cur_h + width --- if dir ~= pos_r then --- cur_h = ds.cur_h --- end --- if enddir ~= current then --- -- local ds = dirstack[enddir] --- ds.cur_v = cur_v --- ds.ref_h = ref_h --- ds.ref_v = ref_v --- setdirection(enddir,pos_r) --- end --- if pos_r == righttoleft_code then --- pos_h = ref_h - cur_h --- else --- pos_h = ref_h + cur_h --- end --- pos_v = ref_v - cur_v --- -- synced --- ref_h = pos_h --- ref_v = pos_v --- cur_h = 0 --- cur_v = 0 --- pos_r = dir --- end -local enddir, width = calculate_width_to_enddir(this_box,current) -local new_h = cur_h + width -if dir ~= pos_r then - cur_h = new_h -end -if enddir ~= current then - dirstack[enddir] = { - cur_h = new_h, - cur_v = cur_v, - ref_h = ref_h, - ref_v = ref_v, - } - setdirection(enddir,pos_r) -end -if pos_r == righttoleft_code then - pos_h = ref_h - cur_h -else - pos_h = ref_h + cur_h -end -pos_v = ref_v - cur_v --- synced -ref_h = pos_h -ref_v = pos_v -cur_h = 0 -cur_v = 0 -pos_r = dir -end + local width, enddir = dirdimensions(this_box,current) + local new_h = cur_h + width + if dir ~= pos_r then + cur_h = new_h + end + if enddir ~= current then + dirstack[enddir] = { + cur_h = new_h, + cur_v = cur_v, + ref_h = ref_h, + ref_v = ref_v, + } + setdirection(enddir,pos_r) + end + if pos_r == righttoleft_code then + pos_h = ref_h - cur_h + else + pos_h = ref_h + cur_h + end + pos_v = ref_v - cur_v + -- synced + ref_h = pos_h + ref_v = pos_v + cur_h = 0 + cur_v = 0 + pos_r = dir + end elseif id == whatsit_code then if subtype == literalwhatsit_code then flushliteral(current,pos_h,pos_v) diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 47b8580d4..cd1b56c83 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -51,6 +51,8 @@ constructors.cacheintex = true -- so we see the original table in fonts.fon constructors.addtounicode = true +constructors.fixprotrusion = true + -- This might become an interface: local designsizes = allocate() @@ -599,7 +601,10 @@ function constructors.scale(tfmdata,specification) -- constructors.enhanceparameters(targetparameters) -- official copies for us, now virtual -- - local protrusionfactor = (targetquad ~= 0 and 1000/targetquad) or 0 + -- I need to fix this in luatex ... get rid of quad there so that we can omit this here. + -- + local protrusionfactor = constructors.fixprotrusion and ((targetquad ~= 0 and 1000/targetquad) or 1) or 1 + -- local scaledwidth = defaultwidth * hdelta local scaledheight = defaultheight * vdelta local scaleddepth = defaultdepth * vdelta diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 0a492b119..a0e695005 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -168,6 +168,10 @@ addformatter(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],{ s constructors.resolvevirtualtoo = true -- context specific (due to resolver) +if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then + constructors.fixprotrusion = false +end + constructors.sharefonts = true -- experimental constructors.nofsharedhashes = 0 constructors.nofsharedvectors = 0 diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua index b3ea73f02..053a2562f 100644 --- a/tex/context/base/mkiv/font-imp-quality.lua +++ b/tex/context/base/mkiv/font-imp-quality.lua @@ -9,8 +9,6 @@ if not modules then modules = { } end modules ['font-imp-quality'] = { if not context then return end local next, type, tonumber = next, type, tonumber -local byte = string.byte -local insert = table.insert local fonts = fonts local utilities = utilities @@ -65,26 +63,63 @@ local vectors = expansions.vectors or allocate() expansions.classes = classes expansions.vectors = vectors --- beware, pdftex itself uses percentages * 10 --- --- todo: get rid of byte() here - -classes.preset = { stretch = 2, shrink = 2, step = .5, factor = 1 } +classes.preset = { + stretch = 2, + shrink = 2, + step = .5, + factor = 1, +} classes['quality'] = { - stretch = 2, shrink = 2, step = .5, vector = 'default', factor = 1 + stretch = 2, + shrink = 2, + step = .5, + vector = 'default', + factor = 1, } vectors['default'] = { - [byte('A')] = 0.5, [byte('B')] = 0.7, [byte('C')] = 0.7, [byte('D')] = 0.5, [byte('E')] = 0.7, - [byte('F')] = 0.7, [byte('G')] = 0.5, [byte('H')] = 0.7, [byte('K')] = 0.7, [byte('M')] = 0.7, - [byte('N')] = 0.7, [byte('O')] = 0.5, [byte('P')] = 0.7, [byte('Q')] = 0.5, [byte('R')] = 0.7, - [byte('S')] = 0.7, [byte('U')] = 0.7, [byte('W')] = 0.7, [byte('Z')] = 0.7, - [byte('a')] = 0.7, [byte('b')] = 0.7, [byte('c')] = 0.7, [byte('d')] = 0.7, [byte('e')] = 0.7, - [byte('g')] = 0.7, [byte('h')] = 0.7, [byte('k')] = 0.7, [byte('m')] = 0.7, [byte('n')] = 0.7, - [byte('o')] = 0.7, [byte('p')] = 0.7, [byte('q')] = 0.7, [byte('s')] = 0.7, [byte('u')] = 0.7, - [byte('w')] = 0.7, [byte('z')] = 0.7, - [byte('2')] = 0.7, [byte('3')] = 0.7, [byte('6')] = 0.7, [byte('8')] = 0.7, [byte('9')] = 0.7, + [0x0041] = 0.5, -- A + [0x0042] = 0.7, -- B + [0x0043] = 0.7, -- C + [0x0044] = 0.5, -- D + [0x0045] = 0.7, -- E + [0x0046] = 0.7, -- F + [0x0047] = 0.5, -- G + [0x0048] = 0.7, -- H + [0x004B] = 0.7, -- K + [0x004D] = 0.7, -- M + [0x004E] = 0.7, -- N + [0x004F] = 0.5, -- O + [0x0050] = 0.7, -- P + [0x0051] = 0.5, -- Q + [0x0052] = 0.7, -- R + [0x0053] = 0.7, -- S + [0x0055] = 0.7, -- U + [0x0057] = 0.7, -- W + [0x005A] = 0.7, -- Z + [0x0061] = 0.7, -- a + [0x0062] = 0.7, -- b + [0x0063] = 0.7, -- c + [0x0064] = 0.7, -- d + [0x0065] = 0.7, -- e + [0x0067] = 0.7, -- g + [0x0068] = 0.7, -- h + [0x006B] = 0.7, -- k + [0x006D] = 0.7, -- m + [0x006E] = 0.7, -- n + [0x006F] = 0.7, -- o + [0x0070] = 0.7, -- p + [0x0071] = 0.7, -- q + [0x0073] = 0.7, -- s + [0x0075] = 0.7, -- u + [0x0077] = 0.7, -- w + [0x007A] = 0.7, -- z + [0x0032] = 0.7, -- 2 + [0x0033] = 0.7, -- 3 + [0x0036] = 0.7, -- 6 + [0x0038] = 0.7, -- 8 + [0x0039] = 0.7, -- 9 } vectors['quality'] = vectors['default'] -- metatable ? @@ -174,21 +209,17 @@ local vectors = protrusions.vectors -- the values need to be revisioned -classes.preset = { factor = 1, left = 1, right = 1 } - -classes['pure'] = { - vector = 'pure', factor = 1 -} -classes['punctuation'] = { - vector = 'punctuation', factor = 1 -} -classes['alpha'] = { - vector = 'alpha', factor = 1 -} -classes['quality'] = { - vector = 'quality', factor = 1 +classes.preset = { + factor = 1, + left = 1, + right = 1, } +classes['pure'] = { vector = 'pure', factor = 1 } +classes['punctuation'] = { vector = 'punctuation', factor = 1 } +classes['alpha'] = { vector = 'alpha', factor = 1 } +classes['quality'] = { vector = 'quality', factor = 1 } + vectors['pure'] = { [0x002C] = { 0, 1 }, -- comma @@ -250,24 +281,24 @@ vectors['punctuation'] = { vectors['alpha'] = { - [byte("A")] = { .05, .05 }, - [byte("F")] = { 0, .05 }, - [byte("J")] = { .05, 0 }, - [byte("K")] = { 0, .05 }, - [byte("L")] = { 0, .05 }, - [byte("T")] = { .05, .05 }, - [byte("V")] = { .05, .05 }, - [byte("W")] = { .05, .05 }, - [byte("X")] = { .05, .05 }, - [byte("Y")] = { .05, .05 }, - - [byte("k")] = { 0, .05 }, - [byte("r")] = { 0, .05 }, - [byte("t")] = { 0, .05 }, - [byte("v")] = { .05, .05 }, - [byte("w")] = { .05, .05 }, - [byte("x")] = { .05, .05 }, - [byte("y")] = { .05, .05 }, + [0x0041] = { .05, .05 }, -- A + [0x0046] = { 0, .05 }, -- F + [0x004A] = { .05, 0 }, -- J + [0x004B] = { 0, .05 }, -- K + [0x004C] = { 0, .05 }, -- L + [0x0054] = { .05, .05 }, -- T + [0x0056] = { .05, .05 }, -- V + [0x0057] = { .05, .05 }, -- W + [0x0058] = { .05, .05 }, -- X + [0x0059] = { .05, .05 }, -- Y + + [0x006B] = { 0, .05 }, -- k + [0x0072] = { 0, .05 }, -- r + [0x0074] = { 0, .05 }, -- t + [0x0076] = { .05, .05 }, -- v + [0x0077] = { .05, .05 }, -- w + [0x0078] = { .05, .05 }, -- x + [0x0079] = { .05, .05 }, -- y } @@ -301,7 +332,9 @@ vectors['quality'] = table.merged( -- \definefontfeature[whocares][default][mode=node,protrusion=2,opbd=yes,script=latn,featurefile=texgyrepagella-regularxx.fea] classes['double'] = { -- for testing opbd - factor = 2, left = 1, right = 1, + factor = 2, + left = 1, + right = 1, } local function map_opbd_onto_protrusion(tfmdata,value,opbd) @@ -434,8 +467,7 @@ local function initialize(tfmdata,value) report_protrusions("setting class %a, vector %a, factor %a, left %a, right %a", value,class.vector,factor,left,right) end - local data = characters.data - local emwidth = tfmdata.parameters.quad + local data = characters.data local lfactor = left * factor local rfactor = right * factor if trace_protrusion then diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index ba8ee5ae1..be62ea434 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -439,6 +439,8 @@ do local xmlfirst = xml.first function otfsvg.filterglyph(entry,index) + -- we only support decompression in lmtx, so one needs to wipe the + -- cache when invalid xml is reported local svg = xmlconvert(entry.data) local root = svg and xmlfirst(svg,"/svg[@id='glyph"..index.."']") local data = root and tostring(root) diff --git a/tex/context/base/mkiv/node-aux.lua b/tex/context/base/mkiv/node-aux.lua index ef884987b..e68a672cd 100644 --- a/tex/context/base/mkiv/node-aux.lua +++ b/tex/context/base/mkiv/node-aux.lua @@ -51,8 +51,10 @@ local setprev = nuts.setprev local setcomponents = nuts.setcomponents local setattrlist = nuts.setattrlist -local nextnode = nuts.traversers.node -local nextglyph = nuts.traversers.glyph +local traversers = nuts.traversers +local nextnode = traversers.node +local nextglyph = traversers.glyph + local flush_node = nuts.flush local flush_list = nuts.flush_list local hpack_nodes = nuts.hpack @@ -504,3 +506,74 @@ do end end + +-- Currently only in luametatex ... experimental anyway .. if it doesn't end +-- up in luatex I'll move this to a different module. + +do + + local nextnode = traversers.glue + local findfail = nuts.tail + + local getid = nuts.getid + local getsubtype = nuts.getsubtype + local getlist = nuts.getlist + local getwidth = nuts.getwidth + + local direct = node.direct + + local nodecodes = nodes.nodecodes + local skipcodes = nodes.skipcodes + + local hlist_code = nodecodes.hlist + local line_code = nodecodes.line + + local leftskip_code = skipcodes.leftskip + local rightskip_code = skipcodes.rightskip + local lefthangskip_code = skipcodes.lefthangskip + local righthangskip_code = skipcodes.righthangskip + local indentskip_code = skipcodes.indentskip + local parfillskip_code = skipcodes.parfillskip + + local find_node = direct.find_node or function(h,t,s) + if h then + if s then + for node, subtype in traversers[t] do + if s == subtype then + return current + end + end + else + for node, subtype in traversers[t] do + return current, subtype + end + end + end + end + + nuts.find_node = find_node + + nuts.getnormalizeline = direct.getnormalizeline or function() return 0 end + nuts.setnormalizeline = direct.setnormalizeline or function() end + + nuts.getnormalizedline = direct.getnormalizedline or function(h) + if getid(h) == hlist_code and getsubtype(h) == line_code then + local ls, rs = 0, 0 + local lh, rh = 0, 0 + local is, ps = 0, 0 + local h = getlist(h) + local t = findtail(h) + for n, subtype in nextglue, h do + if subtype == leftskip_code then ls = getwidth(n) + elseif subtype == rightskip_code then rs = getwidth(n) + elseif subtype == lefthangskip_code then lh = getwidth(n) + elseif subtype == righthangskip_code then rh = getwidth(n) + elseif subtype == indentskip_code then is = getwidth(n) + elseif subtype == parfillskip_code then ps = getwidth(n) + end + end + return ls, rs, lh, rh, is, ps, h, t + end + end + +end diff --git a/tex/context/base/mkiv/node-dir.lua b/tex/context/base/mkiv/node-dir.lua index abfd4a8c7..ef26286e5 100644 --- a/tex/context/base/mkiv/node-dir.lua +++ b/tex/context/base/mkiv/node-dir.lua @@ -1,71 +1,96 @@ if not modules then modules = { } end modules ['node-dir'] = { version = 1.001, comment = "companion to node-ini.mkiv", - author = "Taco Hoekwater and Hans Hagen", + author = "Hans Hagen", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- This is experimental code, so when I change it I need to check other modules --- too. --- --- Local par nodes are somewhat special. They start a paragraph and then register --- the par direction. But they can also show op mid paragraph in which case they --- register boxes and penalties. In that case the direction should not be affected. --- --- We can assume that when hpack and prelinebreak filters are called, a local par --- still sits at the head, but after a linebreak pass this node can be after the --- leftskip (when present). +local nodes = nodes +local nuts = nodes.nuts -local nodes = nodes -local nuts = nodes.nuts +local normaldir_code = nodes.dircodes.normal +local line_code = nodes.listcodes.line +local lefttoright_code = nodes.dirvalues.lefttoright -local nodecodes = nodes.nodecodes -local localpar_code = nodecodes.localpar +local getnext = nuts.getnext +local getlist = nuts.getlist +local getwhd = nuts.getwhd +local getdirection = nuts.getdirection -local getid = nuts.getid -local getsubtype = nuts.getsubtype -local getdirection = nuts.getdirection +local setlist = nuts.setlist -local dirvalues = nodes.dirvalues -local lefttoright = dirvalues.lefttoright -local righttoleft = dirvalues.righttoleft +local nextdir = nuts.traversers.dir +local nexthlist = nuts.traversers.hlist -local localparcodes = nodes.localparcodes -local hmodepar_code = localparcodes.vmode_par -local vmodepar_code = localparcodes.hmode_par +local rangedimensions = nuts.rangedimensions +local insert_before = nuts.insert_before -function nodes.dirstack(head,direction) - local stack = { } - local top = 0 - if head and getid(head) == localpar_code then - local s = getsubtype(head) - if s == hmodepar_code or s == vmodepar_code then - direction = getdirection(head) +local new_rule = nuts.pool.rule +local new_kern = nuts.pool.kern + +local setcolor = nodes.tracers.colors.set +local settransparency = nodes.tracers.transparencies.set + +local function dirdimensions(parent,begindir) -- can be a helper + local level = 1 + local enddir = begindir + local width = 0 + for current, subtype in nextdir, getnext(begindir) do + if subtype == normaldir_code then -- todo + level = level + 1 + else + level = level - 1 + end + if level == 0 then -- does the type matter + enddir = current + width = rangedimensions(parent,begindir,enddir) end end - if not direction then - direction = lefttoright - elseif direction == "TLT" then - direction = lefttoright - elseif direction == "TRT" then - direction = righttoleft + if enddir == begindir then + width = rangedimensions(parent,begindir) end - local function update(node) - local dir, pop = getdirection(node) - if not pop then - top = top + 1 - stack[top] = dir - return dir - elseif top == 0 then - return direction - elseif top == 1 then - top = 0 - return direction - else - top = top - 1 - return stack[top] + return width, enddir +end + +nuts.dirdimensions = dirdimensions + +local function colorit(list,current,dir,w,h,d) + local rule = new_rule(w,h,d) + local kern = new_kern(-w) + local color = dir == lefttoright_code and "trace:s" or "trace:o" + setcolor(rule,color) + settransparency(rule,color) + list, current = insert_before(list,current,kern) + list, current = insert_before(list,current,rule) + return list, current +end + +function nodes.tracers.directions(head) + for hlist, subtype in nexthlist, head do + if subtype == line_code then + local list = getlist(hlist) + local w, h, d = getwhd(hlist) + list = colorit(list,list,getdirection(hlist),w,h,d) + for current in nextdir, list do + local dir, cancel = getdirection(current) + if not cancel then + local width = dirdimensions(hlist,current) + list = colorit(list,current,dir,width,h,d) + end + end + setlist(hlist,list) end end - return direction, update + return head end + +local enabled = false + +trackers.register("nodes.directions", function(v) + if not enabled then + enabled = true + nodes.tasks.appendaction("finalizers","after","nodes.tracers.directions",nil,"nut","enabled") + end + nodes.tasks.setaction(v) +end) diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index b4346cfe0..fcb6d3865 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -184,6 +184,7 @@ if not gluecodes.indentskip then gluecodes.indentskip = gluecodes.userskip gluecodes.lefthangskip = gluecodes.userskip gluecodes.righthangskip = gluecodes.userskip + gluecodes.correctionskip = gluecodes.userskip end if CONTEXTLMTXMODE > 0 then diff --git a/tex/context/base/mkiv/node-ini.mkiv b/tex/context/base/mkiv/node-ini.mkiv index 685614bdb..7a00a8930 100644 --- a/tex/context/base/mkiv/node-ini.mkiv +++ b/tex/context/base/mkiv/node-ini.mkiv @@ -22,13 +22,13 @@ \registerctxluafile{node-nut}{} \registerctxluafile{node-res}{} %registerctxluafile{node-ppt}{} % experimental, not used so probably useless -%registerctxluafile{node-dir}{} % experimental, not yet (and maybe never) used \registerctxluafile{node-aux}{} \registerctxluafile{node-tst}{} \registerctxluafile{node-tra}{} % we might split it off (module) \registerctxluafile{node-snp}{} \registerctxluafile{node-tsk}{} \registerctxluafile{node-tex}{} +\registerctxluafile{node-dir}{} % experimental, not yet (and maybe never) used \registerctxluafile{node-pro}{} \registerctxluafile{node-ser}{} \registerctxluafile{node-ext}{} diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua index 3e4fea0b1..dd655f93d 100644 --- a/tex/context/base/mkiv/node-ltp.lua +++ b/tex/context/base/mkiv/node-ltp.lua @@ -7,21 +7,17 @@ if not modules then modules = { } end modules ['node-par'] = { comment = "a translation of the built in parbuilder, initial convertsin by Taco Hoekwater", } --- todo: not yet in sync with the experimental variant on my disk -- todo: remove nest_stack from linebreak.w -- todo: permit global steps i.e. using an attribute that sets min/max/step and overloads the font parameters -- todo: split the three passes into three functions --- todo: simplify the direction stack, no copy needed -- todo: see if we can do without delta nodes (needs thinking) -- todo: add more mkiv like tracing -- todo: add a couple of plugin hooks --- todo: maybe split expansion code paths -- todo: fix line numbers (cur_list.pg_field needed) --- todo: check and improve protrusion --- todo: I need to check this with the latest patches to the tex kernel --- todo: adapt math glue spacing to new model (left/right) -- todo: optimize a bit more (less par.*) +-- issue: ls / rs added when zero content and normalize + --[[ This code is derived from traditional TeX and has bits of pdfTeX, Aleph (Omega), and of course LuaTeX. So, @@ -123,21 +119,23 @@ if not modules then modules = { } end modules ['node-par'] = { retrofit the same approach into the core, the overhead of expansion can be sort of nilled. In 2013 the expansion factor method became also used at the TeX end so then I could complete the code - here, and indeed, expansions works quite well now (not compatible of course because we use floats at the - Lua end. The Lua base variant is still slower but quite ok, especially if we go nuts. + here, and indeed, expansions works quite well now (not compatible of course because we use floats at + the Lua end. The Lua base variant is still slower but quite ok, especially if we go nuts. - A next iteration will provide plug-ins and more control. I will also explore the possibility to avoid the - redundant hpack calculations (easier now, although I've only done some quick and dirty experiments.) + A next iteration will provide plug-ins and more control. I will also explore the possibility to avoid + the redundant hpack calculations (easier now, although I've only done some quick and dirty experiments.) The code has been adapted to the more reasonable and simplified direction model. + In case I forget when I added the normalization code: it was november 2019 and it took me way more time + than usual because I got distracted after discovering Alyona Yarushina on YT (in november 2019) which + blew some fuses in the musical aware part of my brain in a similar way as when I discovered Kate Bush, + so I had to watch a whole lot of her perfect covers (multiple times and for sure many more times). A + new benchmark. + ]]-- -local tonumber, unpack = tonumber, unpack -local utfchar = utf.char -local write, write_nl = texio.write, texio.write_nl -local sub, formatters = string.sub, string.formatters -local insert, remove = table.insert, table.remove +local unpack = unpack -- local fonts, nodes, node = fonts, nodes, node -- too many locals @@ -151,7 +149,6 @@ local report_parbuilders = logs.reporter("nodes","parbuilders") ----- report_hpackers = logs.reporter("nodes","hpackers") local calculate_badness = tex.badness ------ texnest = tex.nest local texlists = tex.lists local texget = tex.get local texset = tex.set @@ -181,232 +178,275 @@ local texgetglue = tex.getglue -- end -- end -local parbuilders = builders.paragraphs -local constructors = parbuilders.constructors - -local setmetatableindex = table.setmetatableindex - -local fonthashes = fonts.hashes -local chardata = fonthashes.characters -local quaddata = fonthashes.quads -local parameters = fonthashes.parameters - -local nuts = nodes.nuts -local tonut = nuts.tonut - -local getfield = nuts.getfield -local getid = nuts.getid -local getsubtype = nuts.getsubtype -local getnext = nuts.getnext -local getprev = nuts.getprev -local getboth = nuts.getboth -local getlist = nuts.getlist -local getdisc = nuts.getdisc -local getattr = nuts.getattr -local getdisc = nuts.getdisc -local getglue = nuts.getglue -local getwhd = nuts.getwhd -local getkern = nuts.getkern -local getpenalty = nuts.getpenalty -local getdirection = nuts.getdirection -local getshift = nuts.getshift -local getwidth = nuts.getwidth -local getheight = nuts.getheight -local getdepth = nuts.getdepth -local getdata = nuts.getdata -local getreplace = nuts.getreplace -local setreplace = nuts.setreplace -local getpost = nuts.getpost -local setpost = nuts.setpost -local getpre = nuts.getpre -local setpre = nuts.setpre - -local isglyph = nuts.isglyph - -local setfield = nuts.setfield -local setlink = nuts.setlink -local setlist = nuts.setlist -local setboth = nuts.setboth -local setnext = nuts.setnext -local setprev = nuts.setprev -local setdisc = nuts.setdisc -local setsubtype = nuts.setsubtype -local setglue = nuts.setglue -local setwhd = nuts.setwhd -local setkern = nuts.setkern -local setdirection = nuts.setdirection -local setshift = nuts.setshift -local setwidth = nuts.setwidth -local setexpansion = nuts.setexpansion - -local find_tail = nuts.tail -local copy_node = nuts.copy -local flush_node = nuts.flush -local flush_node_list = nuts.flush_list ------ hpack_nodes = nuts.hpack -local xpack_nodes = nuts.hpack -local replace_node = nuts.replace -local insert_node_after = nuts.insert_after -local insert_node_before = nuts.insert_before -local is_zero_glue = nuts.is_zero_glue -local is_skipable = nuts.protrusion_skippable -local setattributelist = nuts.setattributelist - -local nodepool = nuts.pool - -local nodecodes = nodes.nodecodes -local kerncodes = nodes.kerncodes -local glyphcodes = nodes.glyphcodes -local leadercodes = nodes.leadercodes -local margincodes = nodes.margincodes -local disccodes = nodes.disccodes -local mathcodes = nodes.mathcodes -local fillcodes = nodes.fillcodes -local boundarycodes = nodes.boundarycodes - -local temp_code = nodecodes.temp -local glyph_code = nodecodes.glyph -local ins_code = nodecodes.ins -local mark_code = nodecodes.mark -local adjust_code = nodecodes.adjust -local penalty_code = nodecodes.penalty -local disc_code = nodecodes.disc -local math_code = nodecodes.math -local kern_code = nodecodes.kern -local glue_code = nodecodes.glue -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist -local unset_code = nodecodes.unset -local marginkern_code = nodecodes.marginkern -local dir_code = nodecodes.dir -local boundary_code = nodecodes.boundary -local localpar_code = nodecodes.localpar - -local protrusionboundary_code = boundarycodes.protrusion - -local leaders_code = leadercodes.leaders - -local userkern_code = kerncodes.userkern -local italickern_code = kerncodes.italiccorrection -local fontkern_code = kerncodes.fontkern -local accentkern_code = kerncodes.accentkern - -local ligatureglyph_code = glyphcodes.ligature - -local fillcodes = nodes.fillcodes - -local leftmargin_code = margincodes.left ------ rightmargin_code = margincodes.right - -local automaticdisc_code = disccodes.automatic -local regulardisc_code = disccodes.regular -local firstdisc_code = disccodes.first -local seconddisc_code = disccodes.second - -local endmath_code = mathcodes.endmath - -local nosubtype_code = 0 - -local unhyphenated_code = nodecodes.unhyphenated or 1 -local hyphenated_code = nodecodes.hyphenated or 2 -local delta_code = nodecodes.delta or 3 -local passive_code = nodecodes.passive or 4 - -local maxdimen = number.maxdimen - -local max_halfword = 0x7FFFFFFF -local infinite_penalty = 10000 -local eject_penalty = -10000 -local infinite_badness = 10000 -local awful_badness = 0x3FFFFFFF -local ignore_depth = -65536000 - -local fit_very_loose_class = 0 -- fitness for lines stretching more than their stretchability -local fit_loose_class = 1 -- fitness for lines stretching 0.5 to 1.0 of their stretchability -local fit_decent_class = 2 -- fitness for all other lines -local fit_tight_class = 3 -- fitness for lines shrinking 0.5 to 1.0 of their shrinkability - -local new_penalty = nodepool.penalty -local new_direction = nodepool.direction -local new_leftmarginkern = nodepool.leftmarginkern -local new_rightmarginkern = nodepool.rightmarginkern -local new_leftskip = nodepool.leftskip -local new_rightskip = nodepool.rightskip -local new_lineskip = nodepool.lineskip -local new_baselineskip = nodepool.baselineskip -local new_temp = nodepool.temp -local new_rule = nodepool.rule -local new_hlist = nodepool.hlist +local parbuilders = builders.paragraphs +local constructors = parbuilders.constructors + +local setmetatableindex = table.setmetatableindex + +local fonthashes = fonts.hashes +local chardata = fonthashes.characters +local quaddata = fonthashes.quads +local parameters = fonthashes.parameters + +local nuts = nodes.nuts +local tonut = nuts.tonut + +local getfield = nuts.getfield +local getid = nuts.getid +local getsubtype = nuts.getsubtype +local getnext = nuts.getnext +local getprev = nuts.getprev +local getboth = nuts.getboth +local getlist = nuts.getlist +local getdisc = nuts.getdisc +local getattr = nuts.getattr +local getdisc = nuts.getdisc +local getglue = nuts.getglue +local getwhd = nuts.getwhd +local getkern = nuts.getkern +local getpenalty = nuts.getpenalty +local getdirection = nuts.getdirection +local getshift = nuts.getshift +local getwidth = nuts.getwidth +local getheight = nuts.getheight +local getdepth = nuts.getdepth +local getdata = nuts.getdata +local getreplace = nuts.getreplace +local setreplace = nuts.setreplace +local getpost = nuts.getpost +local setpost = nuts.setpost +local getpre = nuts.getpre +local setpre = nuts.setpre + +local isglyph = nuts.isglyph +local start_of_par = nuts.start_of_par + +local setfield = nuts.setfield +local setlink = nuts.setlink +local setlist = nuts.setlist +local setboth = nuts.setboth +local setnext = nuts.setnext +local setprev = nuts.setprev +local setdisc = nuts.setdisc +local setsubtype = nuts.setsubtype +local setglue = nuts.setglue +local setwhd = nuts.setwhd +local setkern = nuts.setkern +local setdirection = nuts.setdirection +local setshift = nuts.setshift +local setwidth = nuts.setwidth +local setexpansion = nuts.setexpansion + +local find_tail = nuts.tail +local copy_node = nuts.copy +local flush_node = nuts.flush +local flush_node_list = nuts.flush_list +----- hpack_nodes = nuts.hpack +local xpack_nodes = nuts.hpack +local replace_node = nuts.replace +local remove_node = nuts.remove +local insert_node_after = nuts.insert_after +local insert_node_before = nuts.insert_before +local is_zero_glue = nuts.is_zero_glue +local is_skipable = nuts.protrusion_skippable +local setattributelist = nuts.setattributelist +local find_node = nuts.find_node + +local nextnode = nuts.traversers.node +local nextglue = nuts.traversers.glue + +local nodepool = nuts.pool + +local nodecodes = nodes.nodecodes +local kerncodes = nodes.kerncodes +local margincodes = nodes.margincodes +local disccodes = nodes.disccodes +local mathcodes = nodes.mathcodes +local fillcodes = nodes.fillcodes +local gluecodes = nodes.gluecodes + +local temp_code = nodecodes.temp +local glyph_code = nodecodes.glyph +local ins_code = nodecodes.ins +local mark_code = nodecodes.mark +local adjust_code = nodecodes.adjust +local penalty_code = nodecodes.penalty +local disc_code = nodecodes.disc +local math_code = nodecodes.math +local kern_code = nodecodes.kern +local glue_code = nodecodes.glue +local hlist_code = nodecodes.hlist +local vlist_code = nodecodes.vlist +local unset_code = nodecodes.unset +local marginkern_code = nodecodes.marginkern +local dir_code = nodecodes.dir +local boundary_code = nodecodes.boundary +local localpar_code = nodecodes.localpar + +local protrusionboundary_code = nodes.boundarycodes.protrusion +local leaders_code = nodes.leadercodes.leaders +local indentlist_code = nodes.listcodes.indent +local ligatureglyph_code = nodes.glyphcodes.ligature +local cancel_code = nodes.dircodes.cancel + +local userkern_code = kerncodes.userkern +local italickern_code = kerncodes.italiccorrection +local fontkern_code = kerncodes.fontkern +local accentkern_code = kerncodes.accentkern + +local leftmargin_code = margincodes.left +----- rightmargin_code = margincodes.right + +local automaticdisc_code = disccodes.automatic +local regulardisc_code = disccodes.regular +local firstdisc_code = disccodes.first +local seconddisc_code = disccodes.second + +local spaceskip_code = gluecodes.spaceskip +local xspaceskip_code = gluecodes.xspaceskip +local rightskip_code = gluecodes.rightskip + +local endmath_code = mathcodes.endmath + +local righttoleft_code = nodes.dirvalues.righttoleft + +local nosubtype_code = 0 + +local unhyphenated_code = nodecodes.unhyphenated or 1 +local hyphenated_code = nodecodes.hyphenated or 2 +local delta_code = nodecodes.delta or 3 +local passive_code = nodecodes.passive or 4 + +local maxdimen = number.maxdimen + +local max_halfword = 0x7FFFFFFF +local infinite_penalty = 10000 +local eject_penalty = -10000 +local infinite_badness = 10000 +local awful_badness = 0x3FFFFFFF +local ignore_depth = -65536000 + +local fit_very_loose_class = 0 -- fitness for lines stretching more than their stretchability +local fit_loose_class = 1 -- fitness for lines stretching 0.5 to 1.0 of their stretchability +local fit_decent_class = 2 -- fitness for all other lines +local fit_tight_class = 3 -- fitness for lines shrinking 0.5 to 1.0 of their shrinkability + +local new_penalty = nodepool.penalty +local new_direction = nodepool.direction +local new_leftmarginkern = nodepool.leftmarginkern +local new_rightmarginkern = nodepool.rightmarginkern +local new_leftskip = nodepool.leftskip +local new_rightskip = nodepool.rightskip +local new_lefthangskip = nodepool.lefthangskip +local new_righthangskip = nodepool.righthangskip +local new_indentskip = nodepool.indentskip +local new_correctionskip = nodepool.correctionskip +local new_lineskip = nodepool.lineskip +local new_baselineskip = nodepool.baselineskip +local new_temp = nodepool.temp +local new_rule = nodepool.rule +local new_hlist = nodepool.hlist + +local getnormalizeline = nuts.getnormalizeline -- helpers -- -- It makes more sense to move the somewhat messy dir state tracking -- out of the main functions. First we create a stack allocator. -local function new_dir_stack(dir) -- also use elsewhere - return { n = 0, dir } -end - -- The next function checks a dir node and returns the new dir state. By -- using a static table we are quite efficient. This function is used -- in the parbuilder. -local function checked_line_dir(stack,current) +local function checked_line_dir(stack,current) -- can be inlined now local direction, pop = getdirection(current) + local n = stack.n if not pop then - local n = stack.n + 1 + n = n + 1 stack.n = n - stack[n] = current + stack[n] = direction return direction elseif n > 0 then - local n = stack.n - local dirnode = stack[n] - dirstack.n = n - 1 - direction = getdirection(dirnode) -- we could save it - return direction + n = n - 1 + stack.n = n + return stack[n] else report_parbuilders("warning: missing pop node (%a)",1) -- in line ... end end --- The next function checks dir nodes in a list and appends the negations --- that are currently needed (some day LuaTeX will be more tolerant). We use --- the negations for the next line. +-- The next function checks dir nodes in a list and injects dir nodes +-- that are currently needed. + +local function inject_dirs_at_begin_of_line(stack,current) + local n = stack.n + if n > 0 then + local h = current + for i=1,n do + local d = new_direction(stack[i]) + setattributelist(d,current) + h, current = insert_node_after(h,current,d) + end + stack.n = 0 + return h + else + return current + end +end local function inject_dirs_at_end_of_line(stack,current,start,stop) - local e = start local n = stack.n - local h = nil - -- todo: traverse while start and start ~= stop do local id = getid(start) if id == dir_code then local direction, pop = getdirection(start) if not pop then n = n + 1 - stack[n] = start + stack[n] = direction elseif n > 0 then +if direction == stack[n] then + -- like in the engine n = n - 1 +end else report_parbuilders("warning: missing pop node (%a)",2) -- in line ... end end start = getnext(start) end - for i=n,1,-1 do - h, current = insert_node_after(current,current,new_direction(getdirection(stack[i]),true)) + if n > 0 then + -- from 1,n and before + local h = start + for i=n,1,-1 do + local d = new_direction(stack[i],true) + setattributelist(d,start) + h, current = insert_node_after(h,current,d) + end end stack.n = n return current end -local function inject_dirs_at_begin_of_line(stack,current) - local h = nil - for i=stack.n,1,-1 do - h, current = insert_node_after(current,current,new_direction(stack[i])) +local ignore_math_skip = node.direct.ignore_math_skip or function(current) + local mode = texget("mathskipmode") + if mode == 6 or mode == 7 then + local b = true + local n = getsubtype(current) == endmath_code and getnext(current) or getprev(current) + if n and getid(n) == glue_code then + local s = getsubtype(n) + if s == spaceskip_code or s == xspaceskip_code then + b = false + end + end + if mode == 7 then + b = not b + end + if b then + setglue(current) + return true + end end - stack.n = 0 - return current + return false end -- diagnostics -- @@ -446,59 +486,117 @@ local function calculate_fraction(x,n,d,max_answer) end end -local function check_shrinkage(par,n) - -- called often, so maybe move inline -- use NORMAL - if getfield(n,"shrink_order") ~= 0 and getfield(n,"shrink") ~= 0 then - if par.no_shrink_error_yet then - par.no_shrink_error_yet = false - report_parbuilders("infinite glue shrinkage found in a paragraph and removed") - end - n = copy_node(n) - setfield(n,"shrink_order",0) +local function infinite_shrinkage_error(par) + if par.no_shrink_error_yet then + par.no_shrink_error_yet = false + report_parbuilders("infinite glue shrinkage found in a paragraph and removed") end - return n end -- It doesn't really speed up much but the additional memory usage is -- rather small so it doesn't hurt too much. local expansions = { } -local nothing = { stretch = 0, shrink = 0 } +local nothing = { stretch = 0, shrink = 0 } -- or just true or so + +-- setmetatableindex(expansions,function(t,font) -- we can store this in tfmdata if needed +-- local expansion = parameters[font].expansion -- can be an extra hash +-- if expansion and expansion.step ~= 0 then +-- local stretch = expansion.stretch +-- local shrink = expansion.shrink +-- if shrink ~= 0 or stretch ~= 0 then +-- local factors = { } +-- local c = chardata[font] +-- setmetatableindex(factors,function(t,char) +-- local fc = c[char] +-- local ef = fc.expansion_factor +-- if ef and ef > 0 then +-- if stretch ~= 0 or shrink ~= 0 then +-- -- todo in lmtx: get rid of quad related scaling +-- local factor = ef / 1000 +-- local ef_quad = factor * quaddata[font] / 1000 +-- local v = { +-- glyphstretch = stretch * ef_quad, +-- glyphshrink = shrink * ef_quad, +-- factor = factor, -- do we need these, if not then we +-- stretch = stretch, -- can as well use the chardata table +-- shrink = shrink, -- to store the two above +-- } +-- t[char] = v +-- return v +-- end +-- end +-- t[char] = nothing +-- return nothing +-- end) +-- t[font] = factors +-- return factors +-- end +-- end +-- t[font] = false +-- return false +-- end) + +-- local function kern_stretch_shrink(p,d) +-- local left = getprev(p) +-- if left then +-- local char, font = isglyph(left) +-- if char then +-- local data = expansions[font] +-- if data then +-- data = data[char] +-- if data then +-- local stretch = data.stretch +-- local shrink = data.shrink +-- if stretch ~= 0 then +-- stretch = data.factor * d * (stretch - 1) +-- end +-- if shrink ~= 0 then +-- shrink = data.factor * d * (shrink - 1) +-- end +-- return stretch, shrink +-- end +-- end +-- end +-- end +-- return 0, 0 +-- end setmetatableindex(expansions,function(t,font) -- we can store this in tfmdata if needed local expansion = parameters[font].expansion -- can be an extra hash - if expansion and expansion.auto then - local factors = { } - local c = chardata[font] - setmetatableindex(factors,function(t,char) - local fc = c[char] - local ef = fc.expansion_factor - if ef and ef > 0 then - local stretch = expansion.stretch - local shrink = expansion.shrink - if stretch ~= 0 or shrink ~= 0 then + if expansion and expansion.step ~= 0 then + local stretch = expansion.stretch + local shrink = expansion.shrink + if shrink ~= 0 or stretch ~= 0 then + local factors = { + stretch = stretch, + shrink = shrink, + } + local c = chardata[font] + setmetatableindex(factors,function(t,char) + local fc = c[char] + local ef = fc.expansion_factor + if ef and ef > 0 and stretch ~= 0 or shrink ~= 0 then + -- todo in lmtx: get rid of quad related scaling local factor = ef / 1000 local ef_quad = factor * quaddata[font] / 1000 local v = { glyphstretch = stretch * ef_quad, glyphshrink = shrink * ef_quad, factor = factor, - stretch = stretch, - shrink = shrink, } t[char] = v return v end - end - t[char] = nothing - return nothing - end) - t[font] = factors - return factors - else - t[font] = false - return false + t[char] = nothing + return nothing + end) + t[font] = factors + return factors + end end + t[font] = false + return false end) local function kern_stretch_shrink(p,d) @@ -506,17 +604,21 @@ local function kern_stretch_shrink(p,d) if left then local char, font = isglyph(left) if char then - local data = expansions[font][char] - if data then - local stretch = data.stretch - local shrink = data.shrink - if stretch ~= 0 then - stretch = data.factor * d * (stretch - 1) + local fdata = expansions[font] + if fdata then + local cdata = fdata[char] + if cdata then + local stretch = fdata.stretch + local shrink = fdata.shrink + local factor = cdata.factor * d + if stretch ~= 0 then + stretch = factor * (stretch - 1) + end + if shrink ~= 0 then + shrink = factor * (shrink - 1) + end + return stretch, shrink end - if shrink ~= 0 then - shrink = data.factor * d * (shrink - 1) - end - return stretch, shrink end end end @@ -540,6 +642,9 @@ end) -- state: +-- the step criterium is no longer an issue, we can be way more tolerant in +-- luatex as we act per glyph + local function check_expand_pars(checked_expansion,f) local expansion = parameters[f].expansion if not expansion then @@ -627,7 +732,7 @@ local function find(head) -- do we really want to recurse into an hlist? elseif id == boundary_code then if getsubtype(head) == protrusionboundary_code then local v = getdata(head) - if v == 1 or v == 3 then + if v == 1 or v == 3 then -- brrr head = getnext(head) if head then head = getnext(head) @@ -711,7 +816,7 @@ local function left_pw(p) if not prot or prot == 0 then return 0 end - return prot * quaddata[font] / 1000, p + return prot, p end local function right_pw(p) @@ -720,7 +825,7 @@ local function right_pw(p) if not prot or prot == 0 then return 0 end - return prot * quaddata[font] / 1000, p + return prot, p end -- par parameters @@ -913,8 +1018,8 @@ do local hsize = texget("hsize") local hang_after = texget("hangafter") local par_shape_ptr = texget("parshape") - local left_skip = tonut(texget("leftskip")) -- nodes - local right_skip = tonut(texget("rightskip")) -- nodes + local left_skip = { texgetglue("leftskip") } + local right_skip = { texgetglue("rightskip") } local pretolerance = texget("pretolerance") local tolerance = texget("tolerance") local adjust_spacing = texget("adjustspacing") @@ -946,7 +1051,7 @@ do active_width = { size = 0, normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0, adjust_stretch = 0, adjust_shrink = 0 }, break_width = { size = 0, normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0, adjust_stretch = 0, adjust_shrink = 0 }, - disc_width = { size = 0, adjust_stretch = 0, adjust_shrink = 0 }, + disc_width = { size = 0, adjust_stretch = 0, adjust_shrink = 0 }, fill_width = { normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0 }, background = { size = 0, normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0 }, @@ -1056,11 +1161,6 @@ do } - -- optimizers - - par.used_left_skip = used_skip(par.left_skip) - par.used_right_skip = used_skip(par.right_skip) - -- so far if adjust_spacing > 1 then @@ -1076,7 +1176,7 @@ do par.tolerance = hztolerance end - expand_kerns = expand_kerns_mode or (adjust_spacing == 2) + expand_kerns = expand_kerns_mode or (adjust_spacing == 2) -- why not > 1 ? end @@ -1084,11 +1184,17 @@ do local background = par.background - local l = check_shrinkage(par,left_skip) - local r = check_shrinkage(par,right_skip) + local lwidth, lstretch, lshrink, lstretch_order, lshrink_order = unpack(left_skip) + local rwidth, rstretch, rshrink, rstretch_order, rshrink_order = unpack(right_skip) - local lwidth, lstretch, lshrink, lstretch_order, lshrink_order = getglue(l) - local rwidth, rstretch, rshrink, rstretch_order, rshrink_order = getglue(r) + if lshrink_order ~= 0 and lshrink ~= 0 then + infinite_shrinkage_error(par) + lshrink_order = 0 + end + if rshrink_order ~= 0 and rshrink ~= 0 then + infinite_shrinkage_error(par) + rshrink_order = 0 + end local l_order = fillcodes[lstretch_order] local r_order = fillcodes[rstretch_order] @@ -1105,8 +1211,8 @@ do par.second_width = hsize par.second_indent = 0 else - local abs_hang_after = hang_after >0 and hang_after or -hang_after - local abs_hang_indent = hang_indent>0 and hang_indent or -hang_indent + local abs_hang_after = hang_after > 0 and hang_after or -hang_after + local abs_hang_indent = hang_indent > 0 and hang_indent or -hang_indent par.last_special_line = abs_hang_after if hang_after < 0 then par.first_width = hsize - abs_hang_indent @@ -1186,12 +1292,14 @@ do local adjust_spacing = par.adjust_spacing local protrude_chars = par.protrude_chars local statistics = par.statistics - local leftskip = par.used_left_skip -- used or normal ? + local leftskip = par.left_skip local rightskip = par.right_skip local parshape = par.par_shape_ptr - local adapt_width = par.adapt_width + -- local adapt_width = par.adapt_width + local hsize = par.hsize - local stack = new_dir_stack() + local dirstack = par.dirstack + local normalize = getnormalizeline() -- reverse the links of the relevant passive nodes, goto first breakpoint @@ -1207,11 +1315,15 @@ do local head = par.head - -- maybe : each_... + -- when we normalize and have no content still ls/rs gets appended while + -- the engine doesnt' do that so there is some test missing that prevents + -- entering here while current_break do - inject_dirs_at_begin_of_line(stack,head) + -- hm, here we have head == localpar and in the engine it's a temp node + + head = inject_dirs_at_begin_of_line(dirstack,head) local disc_break = false local post_disc_break = false @@ -1219,7 +1331,6 @@ do local lineend = nil -- lineend : the last node of the line (and paragraph) local lastnode = current_break.cur_break -- lastnode: the node after which the dir nodes should be closed - if not lastnode then -- only at the end lastnode = find_tail(head) @@ -1230,18 +1341,16 @@ do else -- todo: use insert_list_after local id = getid(lastnode) if id == glue_code then - -- lastnode is normal skip - local r = new_rightskip(rightskip) + local r = new_rightskip(unpack(rightskip)) setattributelist(r,lastnode) lastnode = replace_node(lastnode,r) glue_break = true lineend = lastnode lastnode = getprev(lastnode) elseif id == disc_code then - local prevlast = getprev(lastnode) - local nextlast = getnext(lastnode) - local subtype = getsubtype(lastnode) + local prevlast, nextlast = getboth(lastnode) local pre, post, replace, pretail, posttail, replacetail = getdisc(lastnode,true) + local subtype = getsubtype(lastnode) if subtype == seconddisc_code then if not (getid(prevlast) == disc_code and getsubtype(prevlast) == firstdisc_code) then report_parbuilders('unsupported disc at location %a',3) @@ -1292,13 +1401,16 @@ do disc_break = true elseif id == kern_code then setkern(lastnode,0) - elseif getid(lastnode) == math_code then + elseif id == math_code then setkern(lastnode,0) -- surround -- new in luatex setglue(lastnode) -- zeros end end - lastnode = inject_dirs_at_end_of_line(stack,lastnode,getnext(head),current_break.cur_break) + -- todo: clean up this mess which results from all kind of engine merges + -- (start/end nodes) + -- hm, head ? + lastnode = inject_dirs_at_end_of_line(dirstack,lastnode,getnext(head),current_break.cur_break) local rightbox = current_break.passive_right_box if rightbox then lastnode = insert_node_after(lastnode,lastnode,copy_node(rightbox)) @@ -1307,30 +1419,101 @@ do lineend = lastnode end if lineend and lineend ~= head and protrude_chars > 0 then - local id = getid(lineend) - local c = (disc_break and (id == glyph_code or id ~= disc_code) and lineend) or getprev(lineend) - local p = find_protchar_right(getnext(head),c) - if p and getid(p) == glyph_code then - local w, last_rightmost_char = right_pw(p) - if last_rightmost_char and w ~= 0 then - -- so we inherit attributes, lineend is new pseudo head - lineend, c = insert_node_after(lineend,c,new_rightmarginkern(copy_node(last_rightmost_char),-w)) + if par.line_break_dir == righttoleft_code then + if protrude_chars > 2 then + local p = lineend + local l = nil + -- Backtrack over the last zero glues and dirs. + while p do + local id = getid(p) + if id == dir_code then + if getsubtype(p) ~= cancel_code then + break + end + p = getprev(p) + elseif id == glue_code then + if getwidth(p) == 0 then + p = getprev(p) + else + p = nil + break + end + elseif id == glyph_code then + break + else + p = nil + break + end + end + -- When |p| is non zero we have something. + while p do + local id = getid(p) + if id == glyph_code then + l = p + elseif id == glue_code then + if getwidth(p) == 0 then + -- No harm done. + else + l = nil + end + elseif id == dir_code then + if getdirection(p) ~= righttoleft_code then + p = nil + end + break + elseif id == localpar_code then + break + elseif id == temp_code then + -- Go on. + else + l = nil + end + p = getprev(p) + end + if l and p then + local w, last_rightmost_char = right_pw(l) + if last_rightmost_char and w ~= 0 then + local k = new_rightmarginkern(copy_node(last_rightmost_char),-w) + setattributelist(k,l) + setlink(p,k,l) + end + end + end + else + local id = getid(lineend) + local c = nil + if disc_break and (id == glyph_code or id ~= disc_code) then + c = lineend + else + c = getprev(lineend) + end + local p = find_protchar_right(getnext(head),c) + if p and getid(p) == glyph_code then + local w, last_rightmost_char = right_pw(p) + if last_rightmost_char and w ~= 0 then + -- so we inherit attributes, lineend is new pseudo head + local k = new_rightmarginkern(copy_node(last_rightmost_char),-w) + setattributelist(k,p) +-- insert_node_after(c,c,k) + insert_node_after(p,p,k) +-- if c == lineend then +-- lineend = getnext(c) +-- end + end end end end -- we finish the line local r = getnext(lineend) - setnext(lineend) - if not glue_break then - if rightskip then - local r = new_rightskip(right_skip) - setattributelist(r,lastnode) - insert_node_after(lineend,lineend,r) -- lineend moves on as pseudo head - end - end - -- each time ? + setnext(lineend) -- lineend moves on as pseudo head local start = getnext(head) setlink(head,r) + if not glue_break then + local rs = new_rightskip(unpack(rightskip)) + setattributelist(rs,lineend) + start, lineend = insert_node_after(start,lineend,rs) + end + local rs = lineend -- insert leftbox (if needed after parindent) local leftbox = current_break.passive_left_box if leftbox then @@ -1342,19 +1525,80 @@ do end end if protrude_chars > 0 then - local p = find_protchar_left(start) - if p and getid(p) == glyph_code then - local w, last_leftmost_char = left_pw(p) - if last_leftmost_char and w ~= 0 then - -- so we inherit attributes, start is pseudo head and moves back - start = insert_node_before(start,start,new_leftmarginkern(copy_node(last_leftmost_char),-w)) + if par.line_break_dir == righttoleft_code then + if protrude_chars > 2 then + local p = find_protchar_left(start) + if p then + local w, last_leftmost_char = right_pw(p) + if last_leftmost_char and w ~= 0 then + local k = new_rightmarginkern(copy_node(last_leftmost_char),-w) + setattributelist(k,p) + start = insert_node_before(start,start,k) + end + end + end + else + local p = find_protchar_left(start) + if p and getid(p) == glyph_code then + local w, last_leftmost_char = left_pw(p) + if last_leftmost_char and w ~= 0 then + -- so we inherit attributes, start is pseudo head and moves back + local k = new_leftmarginkern(copy_node(last_leftmost_char),-w) + setattributelist(k,p) + start = insert_node_before(start,start,k) + end end end end - if leftskip then - local l = new_leftskip(leftskip) - setattributelist(l,start) - start = insert_node_before(start,start,l) + local ls + if leftskip or normalize > 0 then + -- we could check for non zero but we will normalize anyway + ls = new_leftskip(unpack(leftskip)) + setattributelist(ls,start) + start = insert_node_before(start,start,ls) + end + if normalize > 0 then + local localpar = nil + local localdir = nil + local indent = nil + local localpars = nil + local notflocal = 0 + for n, id, subtype in nextnode, start do + if id == hlist_code then + if normalize > 1 and subtype == indentlist_code then + indent = n + end + elseif id == localpar_code then + if start_of_par(n) then --- maybe subtype check instead + localpar = n + elseif noflocals then + noflocals = noflocals + 1 + localpars[noflocals] = n + else + noflocals = 1 + localpars = { n } + end + elseif id == dir_code then + if localpar and not localdir and subtype(n) == cancel_code then + localdir = n + end + end + end + if indent then + local i = new_indentskip(getwidth(indent)) + setattributelist(i,start) + replace_node(indent,i) + end + if localdir then + local d = new_direction((getdirection(localpar))) + setattributelist(d,start) + replace_node(localpar,d) + end + if localpars then + for i=1,noflocals do + start = remove_node(start,localpars[i],true) + end + end end local cur_width, cur_indent if current_line > par.last_special_line then @@ -1368,14 +1612,42 @@ do cur_indent = par.first_indent cur_width = par.first_width end - - if adapt_width then -- extension - local l, r = adapt_width(par,current_line) - cur_indent = cur_indent + l - cur_width = cur_width - l - r + -- extension + -- if adapt_width then + -- local l, r = adapt_width(par,current_line) + -- cur_indent = cur_indent + l + -- cur_width = cur_width - l - r + -- end + -- + if normalize > 2 then + local l = new_lefthangskip() + local r = new_righthangskip() + if cur_width ~= hsize then + cur_indent = hsize - cur_width + end + if cur_indent > 0 then + setwidth(l,cur_indent) + elseif cur_indent < 0 then + setwidth(r,-cur_indent) + end + setattributelist(l,start) + setattributelist(r,start) + if normalize > 3 then + -- makes most sense + start = insert_node_after(start,ls,l) + start = insert_node_before(start,rs,r) + else + start = insert_node_before(start,ls,l) + start = insert_node_after(start,rs,r) + end + cur_width = hsize + cur_indent = 0 end - + -- statistics.noflines = statistics.noflines + 1 + -- + -- here we could cleanup: remove all if we have (zero) skips only + -- local finished_line = nil if adjust_spacing > 0 then statistics.nofadjustedlines = statistics.nofadjustedlines + 1 @@ -1471,11 +1743,12 @@ do setlink(head,next) end end +par.head = head end -- if current_line ~= par.best_line then -- report_parbuilders("line breaking") -- end - local h = par.head + local h = par.head -- hm, head if h then if trace_basic then if getnext(h) then @@ -1517,7 +1790,7 @@ do end end end - -- we have a bunch of glue and and temp nodes not freed + -- This differs from the engine, where the temp node is removed elsewhere. local head = par.head if head and getid(head) == temp_code then local next = getnext(head) @@ -1527,10 +1800,6 @@ do end flush_node(head) end -flush_node(par.left_skip) -flush_node(par.right_skip) -par.left_skip = nil -par.right_skip = nil post_line_break(par) reset_meta(par) register_statistics(par) @@ -1697,7 +1966,7 @@ par.right_skip = nil local tracing_paragraphs = par.tracing_paragraphs -- local par_active = par.active - local adapt_width = par.adapt_width + -- local adapt_width = par.adapt_width local parshape = par.par_shape_ptr @@ -1840,7 +2109,6 @@ par.right_skip = nil passive_left_box_width = prev_break and prev_break.passive_last_left_box_width or par.init_internal_left_box_width, passive_right_box = par.internal_right_box, passive_right_box_width = par.internal_right_box_width, - -- analysis = table.fastcopy(cur_active_width), } par.passive = passive local q = { @@ -1918,10 +2186,10 @@ par.right_skip = nil line_width = par.first_width end end - if adapt_width then - local l, r = adapt_width(par,line_number) - line_width = line_width - l - r - end + -- if adapt_width then + -- local l, r = adapt_width(par,line_number) + -- line_width = line_width - l - r + -- end end local artificial_demerits = false -- has d been forced to zero local shortfall = line_width - cur_active_width.size - par.internal_right_box_width -- used in badness calculations @@ -1930,69 +2198,53 @@ par.right_skip = nil else shortfall = shortfall - (r.break_node.passive_last_left_box_width or 0) end - local pw, lp, rp -- used later on if protrude_chars > 1 then - -- this is quite time consuming - local b = r.break_node - local l = b and b.cur_break or first_p - local o = current and getprev(current) - if current and getid(current) == disc_code then - local pre, _, _, pretail = getdisc(current,true) - if pre then - o = pretail + if par.line_break_dir == righttoleft_code then + -- not now, we need to keep more track + else + -- this is quite time consuming + local b = r.break_node + local l = b and b.cur_break or first_p + local o = current and getprev(current) + if current and getid(current) == disc_code then + local pre, _, _, pretail = getdisc(current,true) + if pre then + o = pretail + else + o = find_protchar_right(l,o) + end else o = find_protchar_right(l,o) end - else - o = find_protchar_right(l,o) - end - if o and getid(o) == glyph_code then - pw, rp = right_pw(o) - shortfall = shortfall + pw - end - local id = getid(l) - if id == glyph_code then - -- ok ? - elseif id == disc_code and getpost(l) then - l = getpost(l) -- TODO: first char could be a disc - else - l = find_protchar_left(l) - end - if l and getid(l) == glyph_code then - pw, lp = left_pw(l) - shortfall = shortfall + pw + if o and getid(o) == glyph_code then + shortfall = shortfall + right_pw(o) + end + local id = getid(l) + if id == glyph_code then + -- ok ? + elseif id == disc_code and getpost(l) then + l = getpost(l) -- TODO: first char could be a disc + else + l = find_protchar_left(l) + end + if l and getid(l) == glyph_code then + shortfall = shortfall + left_pw(l) + end end end if checked_expansion and shortfall ~= 0 then - local margin_kern_stretch = 0 - local margin_kern_shrink = 0 - if protrude_chars > 1 then - if lp then - local char, font = isglyph(lp) - local data = expansions[font][char] - if data then - margin_kern_stretch, margin_kern_shrink = data.glyphstretch, data.glyphshrink - end - end - if rp then - local char, font = isglyph(rp) - local data = expansions[font][char] - if data then - margin_kern_stretch = margin_kern_stretch + data.glyphstretch - margin_kern_shrink = margin_kern_shrink + data.glyphshrink + if shortfall > 0 then + local total = cur_active_width.adjust_stretch + if total > 0 then + if total > shortfall then + shortfall = total / (par.max_stretch_ratio / par.cur_font_step) / 2 + else + shortfall = shortfall - total end end - end - local total = cur_active_width.adjust_stretch + margin_kern_stretch - if shortfall > 0 and total > 0 then - if total > shortfall then - shortfall = total / (par.max_stretch_ratio / par.cur_font_step) / 2 - else - shortfall = shortfall - total - end - else - total = cur_active_width.adjust_shrink + margin_kern_shrink - if shortfall < 0 and total > 0 then + elseif shortfall < 0 then + local total = cur_active_width.adjust_shrink + if total > 0 then if total > - shortfall then shortfall = - total / (par.max_shrink_ratio / par.cur_font_step) / 2 else @@ -2146,8 +2398,9 @@ par.right_skip = nil local disc_width = par.disc_width local background = par.background local tracing_paragraphs = par.tracing_paragraphs + local dirstack = { n = 0 } - local dirstack = new_dir_stack() + par.dirstack = dirstack if tracing_paragraphs then diagnostics.start() @@ -2187,13 +2440,12 @@ par.right_skip = nil par.passive = nil -- = 0 par.printed_node = temp_head -- only when tracing, shared par.pass_number = 0 - -- par.auto_breaking = true + -- par.auto_breaking = true setnext(temp_head,head) local current = head local first_p = current - local auto_breaking = true par.font_in_short_display = 0 @@ -2255,27 +2507,7 @@ par.right_skip = nil elseif id == hlist_code or id == vlist_code then active_width.size = active_width.size + getwidth(current) elseif id == glue_code then - if auto_breaking then - local prev_p = getprev(current) - if prev_p and prev_p ~= temp_head then - local id = getid(prev_p) - -- we need to check this with the latest patches to the tex kernel - if (id == glyph_code) or (id < math_code) then - p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) - elseif id == kern_code then - local s = getsubtype(prev_p) - if s ~= userkern_code and s ~= italickern_code then - p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) - end - end - end - end - check_shrinkage(par,current) - local width, stretch, shrink, stretch_order = getglue(current) - local order = fillcodes[stretch_order] - active_width.size = active_width.size + width - active_width[order] = active_width[order] + stretch - active_width.shrink = active_width.shrink + shrink + goto glue elseif id == disc_code then local subtype = getsubtype(current) if subtype ~= seconddisc_code then @@ -2318,16 +2550,7 @@ par.right_skip = nil disc_width.adjust_shrink = disc_width.adjust_shrink + adjust_shrink end p_active, n_active = try_break(actual_pen, hyphenated_code, par, first_p, cur_p_next, checked_expansion) - -- - -- I will look into this some day ... comment in linebreak.w says that this fails, - -- maybe this is what Taco means with his comment in the luatex manual. - -- - -- do_one_seven_eight(sub_disc_width_from_active_width); - -- do_one_seven_eight(reset_disc_width); - -- s = vlink_no_break(vlink(current)); - -- add_to_widths(s, line_break_dir, adjust_spacing,disc_width); - -- ext_try_break(...,first_p,vlink(current)); - -- + -- there is a comment about something messy here in the source else report_parbuilders("unsupported disc at location %a",2) end @@ -2376,18 +2599,22 @@ par.right_skip = nil end elseif id == math_code then auto_breaking = getsubtype(current) == endmath_code - local v = getnext(current) - if auto_breaking and getid(v) == glue_code then - p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) + if is_zero_glue(current) or ignore_math_skip(current) then + local v = getnext(current) + if auto_breaking and getid(v) == glue_code then + p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) + end + local active_width = par.active_width + active_width.size = active_width.size + getkern(current) + getwidth(current) + else + goto glue end - local active_width = par.active_width - active_width.size = active_width.size + getkern(current) + getwidth(current) elseif id == rule_code then active_width.size = active_width.size + getwidth(current) elseif id == penalty_code then p_active, n_active = try_break(getpenalty(current), unhyphenated_code, par, first_p, current, checked_expansion) elseif id == dir_code then - par.line_break_dir = checked_line_dir(dirstack) or par.line_break_dir + par.line_break_dir = checked_line_dir(dirstack,current) or par.line_break_dir elseif id == localpar_code then par.internal_pen_inter = getfield(current,"pen_inter") par.internal_pen_broken = getfield(current,"pen_broken") @@ -2402,6 +2629,35 @@ par.right_skip = nil report_parbuilders("node of type %a found in paragraph",type(id)) end end + goto done + ::glue:: + do + if auto_breaking then + local prev_p = getprev(current) + if prev_p and prev_p ~= temp_head then + local id = getid(prev_p) + -- we need to check this with the latest patches to the tex kernel + if (id == glyph_code) or (id < math_code) then + p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) + elseif id == kern_code then + local s = getsubtype(prev_p) + if s ~= userkern_code and s ~= italickern_code then + p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) + end + end + end + end + local width, stretch, shrink, stretch_order, shrink_order = getglue(current) + if shrink_order ~= 0 and shrink ~= 0 then + infinite_shrinkage_error(par) + shrink_order = 0 + end + local order = fillcodes[stretch_order] + active_width.size = active_width.size + width + active_width[order] = active_width[order] + stretch + active_width.shrink = active_width.shrink + shrink + end + ::done:: current = getnext(current) end if not current then @@ -2471,6 +2727,12 @@ end do + local tonumber = tonumber + local utfchar = utf.char + local write = texio.write + local write_nl = texio.write_nl + local formatters = string.formatters + local function write_esc(cs) local esc = texget("escapechar") if esc then @@ -2548,13 +2810,13 @@ do local passive = par.passive local typ_ind = break_type == hyphenated_code and '-' or "" if par.do_last_line_fit then - local s = number.toscaled(q.active_short) - local g = number.toscaled(q.active_glue) + local s = q.active_short + local g = q.active_glue if current then - write_nl("log",formatters["@@%d: line %d.%d%s t=%s s=%s g=%s"]( + write_nl("log",formatters["@@%d: line %d.%d%s t=%s s=%p g=%p"]( passive.serial or 0,q.line_number-1,fit_class,typ_ind,q.total_demerits,s,g)) else - write_nl("log",formatters["@@%d: line %d.%d%s t=%s s=%s a=%s"]( + write_nl("log",formatters["@@%d: line %d.%d%s t=%s s=%p a=%p"]( passive.serial or 0,q.line_number-1,fit_class,typ_ind,q.total_demerits,s,g)) end else @@ -2641,7 +2903,7 @@ do end function diagnostics.overfull_hbox(hlist,line,d) - common_message(hlist,line,formatters["Overfull \\hbox (%spt too wide)"](number.toscaled(d))) + common_message(hlist,line,formatters["Overfull \\hbox (%p too wide)"](d)) end function diagnostics.bad_hbox(hlist,line,b) @@ -2656,15 +2918,15 @@ do common_message(hlist,line,formatters["Loose \\hbox (badness %i)"](b)) end -end + -- reporting -- --- reporting -- + statistics.register("alternative parbuilders", function() + if nofpars > 0 then + return formatters["%s paragraphs, %s lines (%s protruded, %s adjusted)"](nofpars,noflines,nofprotrudedlines,nofadjustedlines) + end + end) -statistics.register("alternative parbuilders", function() - if nofpars > 0 then - return formatters["%s paragraphs, %s lines (%s protruded, %s adjusted)"](nofpars,noflines,nofprotrudedlines,nofadjustedlines) - end -end) +end do @@ -2682,126 +2944,6 @@ do local setnodecolor = nodes.tracers.colors.set - -- local function xpack(head,width,method,direction,analysis) - -- - -- -- inspect(analysis) - -- - -- local expansion = method == "cal_expand_ratio" - -- local natural = analysis.size - -- local font_stretch = analysis.adjust_stretch - -- local font_shrink = analysis.adjust_shrink - -- local font_expand_ratio = 0 - -- local delta = width - natural - -- - -- local hlist = new_hlist() - -- - -- setlist(hlist,head) - -- setdirection(hlist,direction or tex.textdirection) - -- setwhd(hlist,width,height,depth) - -- - -- if delta == 0 then - -- - -- setfield(hlist,"glue_sign",0) - -- setfield(hlist,"glue_order",0) - -- setfield(hlist,"glue_set",0) - -- - -- else - -- - -- local order = analysis.filll ~= 0 and fillcodes.filll or - -- analysis.fill ~= 0 and fillcodes.fill or - -- analysis.fil ~= 0 and fillcodes.fil or - -- analysis.fi ~= 0 and fillcodes.fi or 0 - -- - -- if delta > 0 then - -- - -- if expansion and order == 0 and font_stretch > 0 then - -- font_expand_ratio = (delta/font_stretch) * 1000 - -- else - -- local stretch = analysis.stretch - -- if stretch ~= 0 then - -- setfield(hlist,"glue_sign",1) -- stretch - -- setfield(hlist,"glue_order",order) - -- setfield(hlist,"glue_set",delta/stretch) - -- else - -- setfield(hlist,"glue_sign",0) -- nothing - -- setfield(hlist,"glue_order",order) - -- setfield(hlist,"glue_set",0) - -- end - -- end - -- - -- else - -- - -- if expansion and order == 0 and font_shrink > 0 then - -- font_expand_ratio = (delta/font_shrink) * 1000 - -- else - -- local shrink = analysis.shrink - -- if shrink ~= 0 then - -- setfield(hlist,"glue_sign",2) -- shrink - -- setfield(hlist,"glue_order",order) - -- setfield(hlist,"glue_set",-delta/stretch) - -- else - -- setfield(hlist,"glue_sign",0) -- nothing - -- setfield(hlist,"glue_order",order) - -- setfield(hlist,"glue_set",0) - -- end - -- end - -- - -- end - -- - -- end - -- - -- if not expansion or font_expand_ratio == 0 then - -- -- nothing - -- elseif font_expand_ratio > 0 then - -- if font_expand_ratio > 1000 then - -- font_expand_ratio = 1000 - -- end - -- local current = head - -- while current do - -- local id = getid(current) - -- if id == glyph_code then - -- local stretch, shrink = char_stretch_shrink(current) -- get only one - -- if stretch then - -- if trace_expansion then - -- setnodecolor(g,"hz:positive") - -- end - -- current.expansion_factor = font_expand_ratio * stretch - -- end - -- elseif id == kern_code then - -- local kern = getkern(current) - -- if kern ~= 0 and getsubtype(current) == fontkern_code then - -- setkern(current,font_expand_ratio * kern) - -- end - -- end - -- current = getnext(current) - -- end - -- elseif font_expand_ratio < 0 then - -- if font_expand_ratio < -1000 then - -- font_expand_ratio = -1000 - -- end - -- local current = head - -- while current do - -- local id = getid(current) - -- if id == glyph_code then - -- local stretch, shrink = char_stretch_shrink(current) -- get only one - -- if shrink then - -- if trace_expansion then - -- setnodecolor(g,"hz:negative") - -- end - -- current.expansion_factor = font_expand_ratio * shrink - -- end - -- elseif id == kern_code then - -- local kern = getkern(current) - -- if kern ~= 0 and getsubtype(current) == fontkern_code then - -- setkern(current,font_expand_ratio * kern) - -- end - -- end - -- current = getnext(current) - -- end - -- end - -- return hlist, 0 - -- end - local function hpack(head,width,method,direction,firstline,line) -- fast version when head = nil -- we can pass the adjust_width and adjust_height so that we don't need to recalculate them but @@ -2810,6 +2952,7 @@ do local hlist = new_hlist() setdirection(hlist,direction) + setattributelist(hlist,head) if head == nil then setwidth(hlist,width) @@ -2852,10 +2995,11 @@ do -- this one also needs to check the font, so in the end indeed we might end up with two variants + -- we now have fast loops so maybe no longer a need for an expansion stack + local fontexps, lastfont local function process(current) -- called nested in disc replace - while current do local char, id = isglyph(current) if char then @@ -2875,20 +3019,19 @@ do end end end - -- use inline local wd, ht, dp = getwhd(current) - natural = natural + wd if ht > height then height = ht end if dp > depth then depth = dp end + natural = natural + wd elseif id == kern_code then local kern = getkern(current) if kern == 0 then -- no kern - elseif getsubtype(current) == fontkern_code then -- check getkern(p) + elseif getsubtype(current) == fontkern_code then if cal_expand_ratio then local stretch, shrink = kern_stretch_shrink(current,kern) font_stretch = font_stretch + stretch @@ -2911,12 +3054,11 @@ do end elseif id == glue_code then local wd, stretch, shrink, stretch_order, shrink_order = getglue(current) - natural = natural + wd total_stretch[stretch_order] = total_stretch[stretch_order] + stretch total_shrink [shrink_order] = total_shrink[shrink_order] + shrink if getsubtype(current) >= leaders_code then + local wd, ht, dp = getwhd(leader) local leader = getleader(current) - local wd, ht, dp = getwhd(leader) -- can become getwhd(current) after 1.003 if ht > height then height = ht end @@ -2924,39 +3066,36 @@ do depth = dp end end + natural = natural + wd elseif id == hlist_code or id == vlist_code then - local sh = getshift(current) local wd, ht, dp = getwhd(current) - local hs, ds = ht - sh, dp + sh - natural = natural + wd + local sh = getshift(current) + local hs = ht - sh + local ds = dp + sh if hs > height then height = hs end if ds > depth then depth = ds end - elseif id == rule_code then - local wd, ht, dp = getwhd(current) natural = natural + wd + elseif id == rule_code or id == unset_code then + local wd, ht, dp = getwhd(current) if ht > height then height = ht end if dp > depth then depth = dp end - elseif id == math_code then - natural = natural + getkern(current) + getwidth(current) - elseif id == unset_code then - local wd, ht, dp = getwhd(current) - local sh = getshift(current) - local hs = ht - sh - local ds = dp + sh natural = natural + wd - if hs > height then - height = hs - end - if ds > depth then - depth = ds + elseif id == math_code then + if is_zero_glue(current) or ignore_math_skip(current) then + natural = natural + getkern(current) + else + local wd, stretch, shrink, stretch_order, shrink_order = getglue(current) + total_stretch[stretch_order] = total_stretch[stretch_order] + stretch + total_shrink [shrink_order] = total_shrink[shrink_order] + shrink + natural = natural + wd end elseif id == ins_code or id == mark_code then local prev, next = getboth(current) @@ -2981,17 +3120,7 @@ do elseif id == dir_code then -- no need to deal with directions here (as we only support two) elseif id == marginkern_code then - local width = getwidth(current) - if cal_expand_ratio then - -- is this ok? - local glyph = getfield(current,"glyph") - local char_pw = getsubtype(current) == leftmargin_code and left_pw or right_pw - font_stretch = font_stretch - width - char_pw(glyph) - font_shrink = font_shrink - width - char_pw(glyph) - expansion_index = expansion_index + 1 - expansion_stack[expansion_index] = glyph - end - natural = natural + width + natural = natural + getwidth(current) end current = getnext(current) end @@ -3009,23 +3138,21 @@ do if method == "additional" then width = width + natural end - setwhd(hlist,width,height,depth) - local delta = width - natural if delta == 0 then setglue(hlist,0,0,0) -- set order sign elseif delta > 0 then -- natural width smaller than requested width - local order = (total_stretch[4] ~= 0 and 4 or total_stretch[3] ~= 0 and 3) or - (total_stretch[2] ~= 0 and 2 or total_stretch[1] ~= 0 and 1) or 0 + local order = (total_stretch[4] ~= 0 and 4) or (total_stretch[3] ~= 0 and 3) or + (total_stretch[2] ~= 0 and 2) or (total_stretch[1] ~= 0 and 1) or 0 if cal_expand_ratio and order == 0 and font_stretch > 0 then -- check sign of font_stretch font_expand_ratio = delta/font_stretch - if font_expand_ratio > 1 then font_expand_ratio = 1 + elseif font_expand_ratio < -1 then + font_expand_ratio = -1 end - local fontexps, lastfont for i=1,expansion_index do local g = expansion_stack[i] @@ -3037,17 +3164,21 @@ do lastfont = font end local data = fontexps[char] - if trace_expansion then - setnodecolor(g,"hz:positive") + if data then + if trace_expansion then + setnodecolor(g,"hz:positive") + end + e = font_expand_ratio * data.glyphstretch end - e = font_expand_ratio * data.glyphstretch / 1000 else local kern = getkern(g) local stretch, shrink = kern_stretch_shrink(g,kern) - e = font_expand_ratio * stretch / 1000 + e = font_expand_ratio * stretch end setexpansion(g,e) end + font_stretch = font_expand_ratio * font_stretch + delta = delta - font_stretch end local tso = total_stretch[order] if tso ~= 0 then @@ -3069,15 +3200,15 @@ do end else -- natural width larger than requested width - local order = total_shrink[4] ~= 0 and 4 or total_shrink[3] ~= 0 and 3 - or total_shrink[2] ~= 0 and 2 or total_shrink[1] ~= 0 and 1 or 0 + local order = (total_shrink[4] ~= 0 and 4) or (total_shrink[3] ~= 0 and 3) + or (total_shrink[2] ~= 0 and 2) or (total_shrink[1] ~= 0 and 1) or 0 if cal_expand_ratio and order == 0 and font_shrink > 0 then -- check sign of font_shrink font_expand_ratio = delta/font_shrink - - if font_expand_ratio < 1 then + if font_expand_ratio > 1 then + font_expand_ratio = 1 + elseif font_expand_ratio < -1 then font_expand_ratio = -1 end - local fontexps, lastfont for i=1,expansion_index do local g = expansion_stack[i] @@ -3089,17 +3220,21 @@ do lastfont = font end local data = fontexps[char] - if trace_expansion then - setnodecolor(g,"hz:negative") + if data then + if trace_expansion then + setnodecolor(g,"hz:negative") + end + e = font_expand_ratio * data.glyphshrink end - e = font_expand_ratio * data.glyphshrink / 1000 else local kern = getkern(g) local stretch, shrink = kern_stretch_shrink(g,kern) - e = font_expand_ratio * shrink / 1000 + e = font_expand_ratio * shrink end setexpansion(g,e) end + font_shrink = font_expand_ratio * font_shrink + delta = delta - font_shrink end local tso = total_shrink[order] if tso ~= 0 then @@ -3109,10 +3244,10 @@ do end if font_expand_ratio ~= 0 then -- todo - elseif tso < -delta and order == 0 then -- and getlist(hlist) then + elseif tso < -delta and order == 0 then last_badness = 1000000 setfield(hlist,"glue_set",1) - local fuzz = - delta - total_shrink[0] + local fuzz = - delta - tso local hfuzz = texget("hfuzz") if fuzz > hfuzz or texget("hbadness") < 100 then local overfullrule = texget("overfullrule") @@ -3120,7 +3255,25 @@ do -- weird, is always called and no rules shows up setnext(find_tail(list),new_rule(overfullrule,nil,nil,getdirection(hlist))) end - diagnostics.overfull_hbox(hlist,line,-delta) + diagnostics.overfull_hbox(hlist,line,fuzz) + if head and getnormalizeline() > 4 then + -- we need to get rid of this one when we unpack a box but on the + -- other hand, we only do this when a specific width is set so + -- probably we have a fixed box then + local h = getnext(head) + if h then + local found = find_node(glue_code,rightskip_code) + if found then + local p = getprev(found) + local g = new_correctionskip(-fuzz) + setattributelist(g,found) + if p and getid(p) == marginkern_code then + found = p + end + insert_node_before(head,found,g) + end + end + end end elseif order == 0 and getlist(hlist) and last_badness > texget("hbadness") then diagnostics.bad_hbox(hlist,line,last_badness) diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index b0a1e1c65..4347fad47 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -183,6 +183,10 @@ local lineskip = register_nut(new_nut(glue_code,gluecodes.lineskip)) local baselineskip = register_nut(new_nut(glue_code,gluecodes.baselineskip)) local leftskip = register_nut(new_nut(glue_code,gluecodes.leftskip)) local rightskip = register_nut(new_nut(glue_code,gluecodes.rightskip)) +local lefthangskip = register_nut(new_nut(glue_code,gluecodes.lefthangskip)) +local righthangskip = register_nut(new_nut(glue_code,gluecodes.righthangskip)) +local indentskip = register_nut(new_nut(glue_code,gluecodes.indentskip)) +local correctionskip = register_nut(new_nut(glue_code,gluecodes.correctionskip)) local temp = register_nut(new_nut(nodecodes.temp,0)) @@ -319,6 +323,18 @@ function nutpool.rightskip(width,stretch,shrink,stretch_order,shrink_order) return someskip(rightskip,width,stretch,shrink,stretch_order,shrink_order) end +function nutpool.lefthangskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(lefthangskip,width,stretch,shrink,stretch_order,shrink_order) +end + +function nutpool.righthangskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(righthangskip,width,stretch,shrink,stretch_order,shrink_order) +end + +function nutpool.indentskip(width,stretch,shrink,stretch_order,shrink_order) + return someskip(indentskip,width,stretch,shrink,stretch_order,shrink_order) +end + function nutpool.lineskip(width,stretch,shrink,stretch_order,shrink_order) return someskip(lineskip,width,stretch,shrink,stretch_order,shrink_order) end @@ -335,14 +351,6 @@ function nutpool.disc(pre,post,replace) return d end -function nutpool.textdir(dir) -- obsolete ! - local t = copy_nut(textdir) - if dir then - setdirection(t,dir) - end - return t -end - function nutpool.direction(dir,swap) local t = copy_nut(textdir) if not dir then diff --git a/tex/context/base/mkiv/page-txt.mklx b/tex/context/base/mkiv/page-txt.mklx index 10c051422..b8184e443 100644 --- a/tex/context/base/mkiv/page-txt.mklx +++ b/tex/context/base/mkiv/page-txt.mklx @@ -500,13 +500,13 @@ \def\page_layouts_left_edge_element_indeed#text#style#color#width% {\letfromlayoutelementparameter\p_text#text% - \ifx\p_text\empty\else + \ifx\p_text\empty + \kern\leftedgewidth + \else \hbox to \leftedgewidth\bgroup \hss \page_layouts_process_element_indeed#style#color#width% \egroup - \else - \kern\leftedgewidth \fi} \def\page_layouts_left_edge_element#text#style#color#width% @@ -517,13 +517,13 @@ \def\page_layouts_right_edge_element_indeed#text#style#color#width% {\letfromlayoutelementparameter\p_text#text% - \ifx\p_text\empty\else + \ifx\p_text\empty + \kern\rightedgewidth + \else \hbox to \rightedgewidth\bgroup \page_layouts_process_element_indeed#style#color#width% \hss \egroup - \else - \kern\rightedgewidth \fi} \def\page_layouts_right_edge_element#text#style#color#width% @@ -601,7 +601,7 @@ \else \hbox to \makeupwidth\bgroup \page_layouts_place_extra_text_left - \page_layouts_process_element_indeed\c!leftstyle\c!leftcolor\c!leftwidth% + \page_layouts_process_element_indeed\c!leftstyle\c!leftcolor\c!leftwidth \hss \egroup \kern-\makeupwidth @@ -610,7 +610,7 @@ \ifx\p_text\empty\else \hbox to \makeupwidth\bgroup \hss - \page_layouts_process_element_indeed\c!middlestyle\c!middlecolor\c!middlewidth% + \page_layouts_process_element_indeed\c!middlestyle\c!middlecolor\c!middlewidth \hss \egroup \kern-\makeupwidth @@ -621,7 +621,7 @@ \else \hbox to \makeupwidth\bgroup \hss - \page_layouts_process_element_indeed\c!rightstyle\c!rightcolor\c!rightwidth% + \page_layouts_process_element_indeed\c!rightstyle\c!rightcolor\c!rightwidth \egroup \fi} @@ -629,7 +629,7 @@ {\letfromlayoutelementparameter\p_text\c!righttext \ifx\p_text\empty\else \hbox to \makeupwidth\bgroup - \page_layouts_process_element_indeed\c!rightstyle\c!rightcolor\c!rightwidth% + \page_layouts_process_element_indeed\c!rightstyle\c!rightcolor\c!rightwidth \hss \egroup \kern-\makeupwidth @@ -638,7 +638,7 @@ \ifx\p_text\empty\else \hbox to \makeupwidth\bgroup \hss - \page_layouts_process_element_indeed\c!middlestyle\c!middlecolor\c!middlewidth% + \page_layouts_process_element_indeed\c!middlestyle\c!middlecolor\c!middlewidth \hss \egroup \kern-\makeupwidth @@ -656,7 +656,7 @@ \else \hbox to \makeupwidth\bgroup \hss - \page_layouts_process_element_indeed\c!leftstyle\c!leftcolor\c!leftwidth% + \page_layouts_process_element_indeed\c!leftstyle\c!leftcolor\c!leftwidth \page_layouts_place_extra_text_right \egroup \fi} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 42fe96dea..6cb5363b9 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 40037aac1..d8065f6bf 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/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index 48fff2e1a..aa88576e0 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -10,7 +10,7 @@ local node, nodes, attributes, fonts, tex = node, nodes, attributes, fonts, tex local type, tonumber, next = type, tonumber, next local gmatch = string.gmatch local formatters = string.formatters -local compactfloat = number.compactfloat +local round = math.round -- This module started out in the early days of mkiv and luatex with visualizing -- kerns related to fonts. In the process of cleaning up the visual debugger code it @@ -388,11 +388,12 @@ local c_skip_b = "trace:m" local c_glyph = "trace:o" local c_ligature = "trace:s" local c_white = "trace:w" -local c_math = "trace:r" +local c_math = "trace:s" local c_origin = "trace:o" local c_discretionary = "trace:d" local c_expansion = "trace:o" local c_depth = "trace:o" +local c_indent = "trace:s" local c_positive_d = "trace:db" local c_negative_d = "trace:dr" @@ -514,7 +515,7 @@ local glyphexpansion do extra = extra / 1000 local info = f_cache[extra] if not info then - local text = hpack_string(compactfloat(extra,"%.1f"),usedfont) + local text = hpack_string(round(extra),usedfont) local rule = new_rule(emwidth/fraction,exheight,2*exheight) local list = getlist(text) if extra > 0 then @@ -548,7 +549,7 @@ local kernexpansion do extra = extra / 1000 local info = f_cache[extra] if not info then - local text = hpack_string(compactfloat(extra,"%.1f"),usedfont) + local text = hpack_string(round(extra),usedfont) local rule = new_rule(emwidth/fraction,exheight,4*exheight) local list = getlist(text) if extra > 0 then @@ -858,22 +859,25 @@ end local ruledglue do - local gluecodes = nodes.gluecodes - local leadercodes = nodes.gluecodes + local gluecodes = nodes.gluecodes + local leadercodes = nodes.gluecodes - local userskip_code = gluecodes.userskip - local spaceskip_code = gluecodes.spaceskip - local xspaceskip_code = gluecodes.xspaceskip - local leftskip_code = gluecodes.leftskip - local rightskip_code = gluecodes.rightskip + local userskip_code = gluecodes.userskip + local spaceskip_code = gluecodes.spaceskip + local xspaceskip_code = gluecodes.xspaceskip + local leftskip_code = gluecodes.leftskip + local rightskip_code = gluecodes.rightskip + local parfillskip_code = gluecodes.parfillskip + local indentskip_code = gluecodes.indentskip + local correctionskip_code = gluecodes.correctionskip - local cleaders_code = leadercodes.cleaders + local cleaders_code = leadercodes.cleaders local g_cache_v = caches["vglue"] local g_cache_h = caches["hglue"] local tags = { - -- [gluecodes.userskip] = "US", + -- [userskip_code] = "US", [gluecodes.lineskip] = "LS", [gluecodes.baselineskip] = "BS", [gluecodes.parskip] = "PS", @@ -881,15 +885,9 @@ local ruledglue do [gluecodes.belowdisplayskip] = "DB", [gluecodes.abovedisplayshortskip] = "SA", [gluecodes.belowdisplayshortskip] = "SB", - [gluecodes.leftskip] = "LS", - [gluecodes.rightskip] = "RS", [gluecodes.topskip] = "TS", [gluecodes.splittopskip] = "ST", [gluecodes.tabskip] = "AS", - [gluecodes.spaceskip] = "SP", - [gluecodes.xspaceskip] = "XS", - [gluecodes.parfillskip] = "PF", - [gluecodes.indentskip] = "IN", [gluecodes.lefthangskip] = "LH", [gluecodes.righthangskip] = "RH", [gluecodes.thinmuskip] = "MS", @@ -901,6 +899,13 @@ local ruledglue do [leadercodes.gleaders] = "GL", -- true = "VS", -- false = "HS", + [leftskip_code] = "LS", + [rightskip_code] = "RS", + [spaceskip_code] = "SP", + [xspaceskip_code] = "XS", + [parfillskip_code] = "PF", + [indentskip_code] = "IN", + [correctionskip_code] = "CS", } -- we sometimes pass previous as we can have issues in math (not watertight for all) @@ -917,6 +922,8 @@ local ruledglue do info = sometext(amount,l_glue,c_space) elseif subtype == leftskip_code or subtype == rightskip_code then info = sometext(amount,l_glue,c_skip_a) + elseif subtype == parfillskip_code or subtype == indentskip_code or subtype == correctionskip_code then + info = sometext(amount,l_glue,c_indent) elseif subtype == userskip_code then if width > 0 then info = sometext(amount,l_glue,c_positive) diff --git a/tex/context/base/mkiv/typo-cap.lua b/tex/context/base/mkiv/typo-cap.lua index 64bb66dab..c1666a9f1 100644 --- a/tex/context/base/mkiv/typo-cap.lua +++ b/tex/context/base/mkiv/typo-cap.lua @@ -315,8 +315,8 @@ register(variables.camel, camel) -- 10 register(variables.cap, variables.capital) -- clone register(variables.Cap, variables.Capital) -- clone --- this can be more clever: when we unset we can actually --- use the same attr ref if needed +-- This can be more clever: when we unset we can actually use the same attr ref if +-- needed. Using properties to block further usage is not faster. function cases.handler(head) -- not real fast but also not used on much data local start = head diff --git a/tex/context/base/mkiv/util-sbx.lua b/tex/context/base/mkiv/util-sbx.lua index c3df27122..cd282009e 100644 --- a/tex/context/base/mkiv/util-sbx.lua +++ b/tex/context/base/mkiv/util-sbx.lua @@ -322,6 +322,7 @@ local reported = { } local function validcommand(name,program,template,checkers,defaults,variables,reporter,strict) if validbinaries ~= false and (validbinaries == true or validbinaries[program]) then + local binpath = nil if variables then for variable, value in next, variables do local chktype = checkers[variable] @@ -363,8 +364,8 @@ local function validcommand(name,program,template,checkers,defaults,variables,re end end end + binpath = variables.binarypath end - local binpath = variables.binarypath if type(binpath) == "string" and binpath ~= "" then -- this works on the console but not from e.g. scite -- program = '"' .. binpath .. "/" .. program .. '"' diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml index b1984f72c..7ae291cf0 100644 --- a/tex/context/interface/mkii/keys-it.xml +++ b/tex/context/interface/mkii/keys-it.xml @@ -1051,6 +1051,7 @@ + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index d57e3f0e4..6e498dc8e 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index ed1635f00..6a784061e 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1a11fc13b..47ee5769c 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 : 11/25/19 17:28:15 +-- merge date : 11/29/19 21:47:35 do -- begin closure to overcome local limits and interference @@ -8763,6 +8763,7 @@ constructors.cache=containers.define("fonts","constructors",constructors.version constructors.privateoffset=fonts.privateoffsets.textbase or 0xF0000 constructors.cacheintex=true constructors.addtounicode=true +constructors.fixprotrusion=true local designsizes=allocate() constructors.designsizes=designsizes local loadedfonts=allocate() @@ -9155,7 +9156,7 @@ function constructors.scale(tfmdata,specification) targetparameters.descender=delta*descender end constructors.enhanceparameters(targetparameters) - local protrusionfactor=(targetquad~=0 and 1000/targetquad) or 0 + local protrusionfactor=constructors.fixprotrusion and ((targetquad~=0 and 1000/targetquad) or 1) or 1 local scaledwidth=defaultwidth*hdelta local scaledheight=defaultheight*vdelta local scaleddepth=defaultdepth*vdelta -- cgit v1.2.3