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 --- 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 ++++++++++++++++---- 11 files changed, 141 insertions(+), 56 deletions(-) (limited to 'tex') 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