From dd8e1bab358884db6ba3f2373f515fbcc991e5ee Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 28 Mar 2020 15:51:51 +0100 Subject: 2020-03-28 14:35:00 --- doc/context/documents/general/manuals/luatex.pdf | Bin 1542992 -> 1540615 bytes .../manuals/luametatex/luametatex-nodes.tex | 4 +- .../general/manuals/luametatex/luametatex-tex.tex | 8 +-- .../general/manuals/luatex/luatex-nodes.tex | 4 +- .../sources/general/manuals/luatex/luatex.tex | 7 +++ tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- 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/font-otj.lua | 59 ++++++++++++++++---- tex/context/base/mkiv/lpdf-mis.lua | 9 ++-- tex/context/base/mkiv/status-files.pdf | Bin 28096 -> 28099 bytes tex/context/base/mkiv/status-lua.pdf | Bin 269645 -> 269645 bytes tex/context/base/mkiv/trac-vis.lua | 60 ++++++++++++--------- tex/generic/context/luatex/luatex-fonts-merged.lua | 59 ++++++++++++++++---- 16 files changed, 156 insertions(+), 64 deletions(-) diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf index 553b1613d..f01b77711 100644 Binary files a/doc/context/documents/general/manuals/luatex.pdf and b/doc/context/documents/general/manuals/luatex.pdf differ diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex index 63386ed02..c7eb9013d 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex @@ -1436,8 +1436,8 @@ This helper returns the location of the first match at or after node \type {n}: \libindex {setglue} -You can set the properties of a glue in one go. If you pass no values, the glue -will become a zero glue. +You can set the five properties of a glue in one go. If a non|-|numeric value is +passed the property becomes zero. \startfunctioncall node.setglue( n) diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex index 737f3b960..09c4233a0 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex @@ -734,10 +734,10 @@ We have similar setters for \type {count}, \type {dimen}, \type {muskip}, and nodes, and toks by strings. Again the glue variants are not using the \nod {glue-spec} userdata nodes. The -\type {setglue} function accepts upto 5 arguments: width, stretch, shrink, -stretch order and shrink order and the \type {getglue} function reports them, -unless the second argument is \type {false} in which case only the width is -returned. +\type {setglue} function accepts upto five arguments: width, stretch, shrink, +stretch order and shrink order. Non|-|numeric values set the property to zero. +The \type {getglue} function reports all five properties, unless the second +argument is \type {false} in which case only the width is returned. Here is an example using a threesome: diff --git a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index 21e8a2808..a379b7b0a 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -1935,8 +1935,8 @@ character protrusion is active, this node can be skipped. \libindex {setglue} -You can set the properties of a glue in one go. If you pass no values, the glue -will become a zero glue. +You can set the five properties of a glue in one go. Non|-|numeric values are +equivalent to zero and reset a property. \startfunctioncall node.setglue( n) diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex index 5a98f2243..24fcf979b 100644 --- a/doc/context/sources/general/manuals/luatex/luatex.tex +++ b/doc/context/sources/general/manuals/luatex/luatex.tex @@ -23,6 +23,13 @@ % comment : Some (parts of) chapters might have been published in TugBoat, the NTG Maps, the % ConTeXt Group journal or otherwise. Thanks to the editors for corrections. Also % thanks to users for testing, feedback and corrections. +% +% comment : Of course specific distribution can add to the manual, but that is of course not +% our responsibility. The official (latest) version of this manual is part of the +% ConTeXt distribution, including a pdf file that is produced with the current +% version of ConTeXt. So, in case of doubt use that one as reference. Some of the +% improvements in the LuaMetaTeX manual that apply to LuaTeX might get retrofitted +% in LuaTeX manual in due time. % \tex vs \type vs \syntax vs. \luatex % \em \it \/ diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 437048dc3..4696ef82d 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{2020.03.26 21:46} +\newcontextversion{2020.03.28 14:31} %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 49cb4a154..67825f040 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{2020.03.26 21:46} +\edef\contextversion{2020.03.28 14:31} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ce1e83666..1a9e445f8 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{2020.03.26 21:46} +\newcontextversion{2020.03.28 14:31} %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 bdc605cbe..81451a832 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{2020.03.26 21:46} +\edef\contextversion{2020.03.28 14:31} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 42b3d63ba..9bfa4f862 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{2020.03.26 21:46} +\edef\contextversion{2020.03.28 14:31} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 2e7878d3d..bb333755d 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -110,7 +110,7 @@ local properties = nodes.properties.data local fontkern = nuts.pool and nuts.pool.fontkern -- context local italickern = nuts.pool and nuts.pool.italickern -- context -local useitalickerns = false +local useitalickerns = false -- context only directives.register("fonts.injections.useitalics", function(v) if v then @@ -119,7 +119,7 @@ directives.register("fonts.injections.useitalics", function(v) useitalickerns = v end) -do if not fontkern then -- generic +if not fontkern then -- generic local thekern = nuts.new("kern",0) -- fontkern local setkern = nuts.setkern @@ -131,9 +131,9 @@ do if not fontkern then -- generic return n end -end end +end -do if not italickern then -- generic +if not italickern then -- generic local thekern = nuts.new("kern",3) -- italiccorrection local setkern = nuts.setkern @@ -145,7 +145,7 @@ do if not italickern then -- generic return n end -end end +end function injections.installnewkern() end -- obsolete @@ -664,7 +664,15 @@ local function inject_kerns_only(head,where) -- left|glyph|right local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - head = insert_node_before(head,current,fontkern(leftkern)) + if prev and getid(prev) == glue_code then + if useitalickerns then + head = insert_node_before(head,current,italickern(leftkern)) + else + setwidth(prev, getwidth(prev) + leftkern) + end + else + head = insert_node_before(head,current,fontkern(leftkern)) + end end end if prevdisc then @@ -819,12 +827,26 @@ local function inject_positions_only(head,where) if rightkern and leftkern == -rightkern then setoffsets(current,leftkern,false) rightkern = 0 + elseif prev and getid(prev) == glue_code then + if useitalickerns then + head = insert_node_before(head,current,italickern(leftkern)) + else + setwidth(prev, getwidth(prev) + leftkern) + end else head = insert_node_before(head,current,fontkern(leftkern)) end end if rightkern and rightkern ~= 0 then - insert_node_after(head,current,fontkern(rightkern)) + if next and getid(next) == glue_code then + if useitalickerns then + insert_node_after(head,current,italickern(rightkern)) + else + setwidth(next, getwidth(next) + rightkern) + end + else + insert_node_after(head,current,fontkern(rightkern)) + end end else local i = p.emptyinjections @@ -1270,12 +1292,26 @@ local function inject_everything(head,where) if rightkern and leftkern == -rightkern then setoffsets(current,leftkern,false) rightkern = 0 + elseif prev and getid(prev) == glue_code then + if useitalickerns then + head = insert_node_before(head,current,italickern(leftkern)) + else + setwidth(prev, getwidth(prev) + leftkern) + end else head = insert_node_before(head,current,fontkern(leftkern)) end end if rightkern and rightkern ~= 0 then - insert_node_after(head,current,fontkern(rightkern)) + if next and getid(next) == glue_code then + if useitalickerns then + insert_node_after(head,current,italickern(rightkern)) + else + setwidth(next, getwidth(next) + rightkern) + end + else + insert_node_after(head,current,fontkern(rightkern)) + end end end else @@ -1707,16 +1743,18 @@ local function injectspaces(head) if useitalickerns then local new = rightkern * factor if trace_spaces then - report_spaces("%C [%p + %p]",nextchar,old,new) + report_spaces("[%p + %p] %C",old,new,nextchar) end insert_node_after(head,n,italickern(new)) else local new = old + rightkern * factor if trace_spaces then - report_spaces("[%p -> %p] %C",nextchar,old,new) + report_spaces("[%p -> %p] %C",old,new,nextchar) end setwidth(n,new) end + else + -- message end rightkern = false end @@ -1753,3 +1791,4 @@ function injections.handler(head,where) return head end end + diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua index 7227f9dba..a3f9789c8 100644 --- a/tex/context/base/mkiv/lpdf-mis.lua +++ b/tex/context/base/mkiv/lpdf-mis.lua @@ -17,7 +17,8 @@ if not modules then modules = { } end modules ['lpdf-mis'] = { local next, tostring, type = next, tostring, type local format, gsub, formatters = string.format, string.gsub, string.formatters -local flattened = table.flattened +local concat, flattened = table.concat, table.flattened +local settings_to_array = utilities.parsers.settings_to_array local backends, lpdf, nodes = backends, lpdf, nodes @@ -236,8 +237,8 @@ local function setupidentity() end local keywords = identity.keywords or "" if keywords ~= "" then - keywords = gsub(keywords, "[%s,]+", " ") - addtoinfo("Keywords",pdfunicode(keywords), keywords) + keywords = concat(settings_to_array(keywords), " ") + addtoinfo("Keywords", pdfunicode(keywords), keywords) end local id = lpdf.id() addtoinfo("ID", pdfstring(id), id) -- needed for pdf/x @@ -451,7 +452,7 @@ local function documentspecification() if not pagespec or pagespec == "" then pagespec = v_default end - local settings = utilities.parsers.settings_to_array(pagespec) + local settings = settings_to_array(pagespec) -- so the first one detemines the defaults local first = settings[1] local defaults = pagespecs[first] diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 0da4c936e..1705970ae 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 f96735f78..3e12e0677 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 0ca50899b..34c60f1c9 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -1248,6 +1248,7 @@ do while current do local id = getid(current) local a = forced or getattr(current,a_visual) or unsetvalue + local subtype if a ~= attr then prev_trace_fontkern = trace_fontkern prev_trace_italic = trace_italic @@ -1276,7 +1277,11 @@ do trace_space = false trace_depth = false trace_marginkern = false - goto list + if id == kern_code then + goto kern + else + goto list + end else -- dead slow: -- cache[a]() trace_hbox = band(a,0x000001) ~= 0 @@ -1329,31 +1334,7 @@ do end setdisc(current,pre,post,replace) elseif id == kern_code then - local subtype = getsubtype(current) - if subtype == fontkern_code then - if trace_fontkern or prev_trace_fontkern then - head, current = fontkern(head,current) - end - if trace_expansion or prev_trace_expansion then - head, current = kernexpansion(head,current) - end - elseif subtype == italickern_code then - if trace_italic or prev_trace_italic then - head, current = italickern(head,current) - elseif trace_kern then - head, current = ruleditalic(head,current) - end - elseif subtype == leftmarginkern_code or subtype == rightmarginkern_code then - if trace_marginkern or prev_trace_marginkern then - head, current = marginkern(head,current) - elseif trace_kern then - head, current = ruledmarginkern(head,current) - end - else - if trace_kern then - head, current = ruledkern(head,current,vertical) - end - end + goto kern elseif id == glue_code then local content = getleader(current) if content then @@ -1387,6 +1368,33 @@ do end end goto next + ::kern:: + subtype = getsubtype(current) + if subtype == fontkern_code then + if trace_fontkern or prev_trace_fontkern then + head, current = fontkern(head,current) + end + if trace_expansion or prev_trace_expansion then + head, current = kernexpansion(head,current) + end + elseif subtype == italickern_code then + if trace_italic or prev_trace_italic then + head, current = italickern(head,current) + elseif trace_kern then + head, current = ruleditalic(head,current) + end + elseif subtype == leftmarginkern_code or subtype == rightmarginkern_code then + if trace_marginkern or prev_trace_marginkern then + head, current = marginkern(head,current) + elseif trace_kern then + head, current = ruledmarginkern(head,current) + end + else + if trace_kern then + head, current = ruledkern(head,current,vertical) + end + end + goto next; ::list:: if id == hlist_code then local content = getlist(current) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d6a8b66da..59f0dd066 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 : 2020-03-26 21:46 +-- merge date : 2020-03-28 14:31 do -- begin closure to overcome local limits and interference @@ -24564,14 +24564,14 @@ local insert_node_after=nuts.insert_after local properties=nodes.properties.data local fontkern=nuts.pool and nuts.pool.fontkern local italickern=nuts.pool and nuts.pool.italickern -local useitalickerns=false +local useitalickerns=false directives.register("fonts.injections.useitalics",function(v) if v then report_injections("using italics for space kerns (tracing only)") end useitalickerns=v end) -do if not fontkern then +if not fontkern then local thekern=nuts.new("kern",0) local setkern=nuts.setkern local copy_node=nuts.copy_node @@ -24580,8 +24580,8 @@ do if not fontkern then setkern(n,k) return n end -end end -do if not italickern then +end +if not italickern then local thekern=nuts.new("kern",3) local setkern=nuts.setkern local copy_node=nuts.copy_node @@ -24590,7 +24590,7 @@ do if not italickern then setkern(n,k) return n end -end end +end function injections.installnewkern() end local nofregisteredkerns=0 local nofregisteredpositions=0 @@ -25043,7 +25043,15 @@ local function inject_kerns_only(head,where) if i then local leftkern=i.leftkern if leftkern and leftkern~=0 then - head=insert_node_before(head,current,fontkern(leftkern)) + if prev and getid(prev)==glue_code then + if useitalickerns then + head=insert_node_before(head,current,italickern(leftkern)) + else + setwidth(prev,getwidth(prev)+leftkern) + end + else + head=insert_node_before(head,current,fontkern(leftkern)) + end end end if prevdisc then @@ -25186,12 +25194,26 @@ local function inject_positions_only(head,where) if rightkern and leftkern==-rightkern then setoffsets(current,leftkern,false) rightkern=0 + elseif prev and getid(prev)==glue_code then + if useitalickerns then + head=insert_node_before(head,current,italickern(leftkern)) + else + setwidth(prev,getwidth(prev)+leftkern) + end else head=insert_node_before(head,current,fontkern(leftkern)) end end if rightkern and rightkern~=0 then - insert_node_after(head,current,fontkern(rightkern)) + if next and getid(next)==glue_code then + if useitalickerns then + insert_node_after(head,current,italickern(rightkern)) + else + setwidth(next,getwidth(next)+rightkern) + end + else + insert_node_after(head,current,fontkern(rightkern)) + end end else local i=p.emptyinjections @@ -25539,12 +25561,26 @@ local function inject_everything(head,where) if rightkern and leftkern==-rightkern then setoffsets(current,leftkern,false) rightkern=0 + elseif prev and getid(prev)==glue_code then + if useitalickerns then + head=insert_node_before(head,current,italickern(leftkern)) + else + setwidth(prev,getwidth(prev)+leftkern) + end else head=insert_node_before(head,current,fontkern(leftkern)) end end if rightkern and rightkern~=0 then - insert_node_after(head,current,fontkern(rightkern)) + if next and getid(next)==glue_code then + if useitalickerns then + insert_node_after(head,current,italickern(rightkern)) + else + setwidth(next,getwidth(next)+rightkern) + end + else + insert_node_after(head,current,fontkern(rightkern)) + end end end else @@ -25910,16 +25946,17 @@ local function injectspaces(head) if useitalickerns then local new=rightkern*factor if trace_spaces then - report_spaces("%C [%p + %p]",nextchar,old,new) + report_spaces("[%p + %p] %C",old,new,nextchar) end insert_node_after(head,n,italickern(new)) else local new=old+rightkern*factor if trace_spaces then - report_spaces("[%p -> %p] %C",nextchar,old,new) + report_spaces("[%p -> %p] %C",old,new,nextchar) end setwidth(n,new) end + else end rightkern=false end -- cgit v1.2.3