From f408f9a871902f881d5a102cdfd940e9143e8110 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sat, 13 Apr 2013 13:24:00 +0200 Subject: beta 2013.04.13 13:24 --- scripts/context/lua/mtxrun.lua | 8 +- scripts/context/stubs/mswin/mtxrun.lua | 8 +- scripts/context/stubs/unix/mtxrun | 8 +- tex/context/base/context-version.pdf | Bin 4131 -> 4133 bytes tex/context/base/context-version.png | Bin 40176 -> 40480 bytes tex/context/base/data-res.lua | 33 +++++--- tex/context/base/font-hsh.lua | 44 +++++++++++ tex/context/base/pack-rul.lua | 85 +++++---------------- tex/context/base/s-map-10.mkiv | 5 -- tex/context/base/scrp-cjk.lua | 32 +++++++- tex/context/base/status-files.pdf | Bin 24744 -> 24721 bytes tex/context/base/status-lua.pdf | Bin 211772 -> 211776 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 13 files changed, 129 insertions(+), 96 deletions(-) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 8c144f2c6..62b1fe1a9 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -12656,7 +12656,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 61105, stripped down to: 42866 +-- original size: 61601, stripped down to: 42865 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -12883,7 +12883,7 @@ local function identify_configuration_files() for i=1,#cnfpaths do local filepath=cnfpaths[i] local filename=collapsepath(filejoin(filepath,luacnfname)) - local realname=resolvers.resolve(filename) + local realname=resolvers.resolve(filename) if trace_locating then local fullpath=gsub(resolvers.resolve(collapsepath(filepath)),"//","/") local weirdpath=find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c") @@ -15851,8 +15851,8 @@ end -- of closure -- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 661961 --- stripped bytes : 242696 +-- original bytes : 662457 +-- stripped bytes : 243193 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 8c144f2c6..62b1fe1a9 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -12656,7 +12656,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 61105, stripped down to: 42866 +-- original size: 61601, stripped down to: 42865 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -12883,7 +12883,7 @@ local function identify_configuration_files() for i=1,#cnfpaths do local filepath=cnfpaths[i] local filename=collapsepath(filejoin(filepath,luacnfname)) - local realname=resolvers.resolve(filename) + local realname=resolvers.resolve(filename) if trace_locating then local fullpath=gsub(resolvers.resolve(collapsepath(filepath)),"//","/") local weirdpath=find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c") @@ -15851,8 +15851,8 @@ end -- of closure -- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 661961 --- stripped bytes : 242696 +-- original bytes : 662457 +-- stripped bytes : 243193 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 8c144f2c6..62b1fe1a9 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -12656,7 +12656,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 61105, stripped down to: 42866 +-- original size: 61601, stripped down to: 42865 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -12883,7 +12883,7 @@ local function identify_configuration_files() for i=1,#cnfpaths do local filepath=cnfpaths[i] local filename=collapsepath(filejoin(filepath,luacnfname)) - local realname=resolvers.resolve(filename) + local realname=resolvers.resolve(filename) if trace_locating then local fullpath=gsub(resolvers.resolve(collapsepath(filepath)),"//","/") local weirdpath=find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c") @@ -15851,8 +15851,8 @@ end -- of closure -- used libraries : l-lua.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-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.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 : 661961 --- stripped bytes : 242696 +-- original bytes : 662457 +-- stripped bytes : 243193 -- end library merge diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 37877f43b..6f147a5dd 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index be0d6de08..5f2043177 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 36e4faecc..caf7fb8b4 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -67,7 +67,7 @@ resolvers.luacnfstate = "unknown" -- -- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- --- but instead use: +-- but instead (for instance) use: -- -- resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c}}' -- @@ -77,16 +77,28 @@ resolvers.luacnfstate = "unknown" -- -- texlive: -- +-- selfautoloc: +-- selfautoloc:/share/texmf-local/web2c +-- selfautoloc:/share/texmf-dist/web2c +-- selfautoloc:/share/texmf/web2c +-- selfautoloc:/texmf-local/web2c +-- selfautoloc:/texmf-dist/web2c +-- selfautoloc:/texmf/web2c -- selfautodir: +-- selfautodir:/share/texmf-local/web2c +-- selfautodir:/share/texmf-dist/web2c +-- selfautodir:/share/texmf/web2c +-- selfautodir:/texmf-local/web2c +-- selfautodir:/texmf-dist/web2c +-- selfautodir:/texmf/web2c +-- selfautoparent:/../texmf-local/web2c -- selfautoparent: --- selfautodir:share/texmf-local/web2c --- selfautodir:share/texmf/web2c --- selfautodir:texmf-local/web2c --- selfautodir:texmf/web2c --- selfautoparent:share/texmf-local/web2c --- selfautoparent:share/texmf/web2c --- selfautoparent:texmf-local/web2c --- selfautoparent:texmf/web2c +-- selfautoparent:/share/texmf-local/web2c +-- selfautoparent:/share/texmf-dist/web2c +-- selfautoparent:/share/texmf/web2c +-- selfautoparent:/texmf-local/web2c +-- selfautoparent:/texmf-dist/web2c +-- selfautoparent:/texmf/web2c -- -- minimals: -- @@ -343,13 +355,14 @@ local function identify_configuration_files() local filepath = cnfpaths[i] local filename = collapsepath(filejoin(filepath,luacnfname)) local realname = resolvers.resolve(filename) -- can still have "//" ... needs checking + -- todo: environment.skipweirdcnfpaths directive if trace_locating then local fullpath = gsub(resolvers.resolve(collapsepath(filepath)),"//","/") local weirdpath = find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c") report_resolving("looking for %a on %s path %a from specification %a",luacnfname,weirdpath and "weird" or "given",fullpath,filepath) end if lfs.isfile(realname) then - specification[#specification+1] = filename -- unresolved ! as we use it in matching, relocatable + specification[#specification+1] = filename -- unresolved as we use it in matching, relocatable if trace_locating then report_resolving("found configuration file %a",realname) end diff --git a/tex/context/base/font-hsh.lua b/tex/context/base/font-hsh.lua index d6c226b7c..f5c80d705 100644 --- a/tex/context/base/font-hsh.lua +++ b/tex/context/base/font-hsh.lua @@ -14,12 +14,16 @@ local fonts = fonts local hashes = fonts.hashes or allocate() fonts.hashes = hashes +-- todo: autoallocate ... just create on the fly .. use constructors.keys (problem: plurals) + local identifiers = hashes.identifiers or allocate() local characters = hashes.characters or allocate() -- chardata local descriptions = hashes.descriptions or allocate() local parameters = hashes.parameters or allocate() local properties = hashes.properties or allocate() local resources = hashes.resources or allocate() +local spacings = hashes.spacings or allocate() +local spaces = hashes.spaces or allocate() local quads = hashes.quads or allocate() -- maybe also spacedata local xheights = hashes.xheights or allocate() local csnames = hashes.csnames or allocate() -- namedata @@ -33,6 +37,8 @@ hashes.descriptions = descriptions hashes.parameters = parameters hashes.properties = properties hashes.resources = resources +hashes.spacings = spacings +hashes.spaces = spaces hashes.quads = quads hashes.emwidths = quads hashes.xheights = xheights hashes.exheights = xheights hashes.csnames = csnames @@ -47,6 +53,16 @@ local nulldata = allocate { descriptions = { }, properties = { }, parameters = { -- lmromanregular @ 12pt + slantperpoint = 0, + spacing = { + width = 256377, + stretch = 128188, + shrink = 85459, + extra = 85459, + }, + quad = 786432, + xheight = 338952, + -- compatibility: slant = 0, -- 1 space = 256377, -- 2 space_stretch = 128188, -- 3 @@ -128,6 +144,34 @@ setmetatableindex(quads, function(t,k) end end) +local nospacing = { + width = 0, + stretch = 0, + shrink = 0, + extra = 0, +} + +setmetatableindex(spacings, function(t,k) + if k == true then + return spacings[currentfont()] + else + local parameters = parameters[k] + local spacing = parameters and parameters.spacing or nospacing + t[k] = spacing + return spacing + end +end) + +setmetatableindex(spaces, function(t,k) + if k == true then + return spaces[currentfont()] + else + local space = spacings[k].width + t[k] = space + return space + end +end) + setmetatableindex(marks, function(t,k) if k == true then return marks[currentfont()] diff --git a/tex/context/base/pack-rul.lua b/tex/context/base/pack-rul.lua index c91dec09c..a990936e7 100644 --- a/tex/context/base/pack-rul.lua +++ b/tex/context/base/pack-rul.lua @@ -15,66 +15,9 @@ local hpack, free, copy, traverse_id = node.hpack, node.free, node.copy_list, no local texdimen, texcount = tex.dimen, tex.count local hlist_code = nodes.nodecodes.hlist +local box_code = nodes.listcodes.box local node_dimensions = node.dimensions --- function commands.doreshapeframedbox(n) --- local box = texbox[n] --- local noflines = 0 --- local firstheight = nil --- local lastdepth = nil --- local lastlinelength = 0 --- local minwidth = 0 --- local maxwidth = 0 --- local totalwidth = 0 --- if box.width ~= 0 then --- local list = box.list --- if list then --- for h in traverse_id(hlist_code,list) do -- no dir etc needed --- if not firstheight then --- firstheight = h.height --- end --- lastdepth = h.depth --- noflines = noflines + 1 --- local l = h.list --- if l then --- local p = hpack(copy(l)) --- lastlinelength = p.width --- if lastlinelength > maxwidth then --- maxwidth = lastlinelength --- end --- if lastlinelength < minwidth or minwidth == 0 then --- minwidth = lastlinelength --- end --- totalwidth = totalwidth + lastlinelength --- free(p) --- end --- end --- if firstheight then --- if maxwidth ~= 0 then --- for h in traverse_id(hlist_code,list) do --- local l = h.list --- if l then --- -- if h.width ~= maxwidth then -- else no display math handling (uses shift) --- h.list = hpack(l,maxwidth,'exactly',h.dir) --- h.shift = 0 -- needed for display math --- h.width = maxwidth --- -- end --- end --- end --- end --- box.width = maxwidth --- end --- end --- end --- -- print("reshape", noflines, firstheight or 0, lastdepth or 0) --- texsetcount("global","framednoflines", noflines) --- texsetdimen("global","framedfirstheight", firstheight or 0) --- texsetdimen("global","framedlastdepth", lastdepth or 0) --- texsetdimen("global","framedminwidth", minwidth) --- texsetdimen("global","framedmaxwidth", maxwidth) --- texsetdimen("global","framedaveragewidth", noflines > 0 and totalwidth/noflines or 0) --- end - function commands.doreshapeframedbox(n) local box = texbox[n] local noflines = 0 @@ -95,7 +38,11 @@ function commands.doreshapeframedbox(n) noflines = noflines + 1 local l = h.list if l then - lastlinelength = node_dimensions(l) + if h.subtype == box_code then -- maybe more + lastlinelength = h.width + else + lastlinelength = node_dimensions(l) -- used to be: hpack(copy(l)).width + end if lastlinelength > maxwidth then maxwidth = lastlinelength end @@ -110,14 +57,18 @@ function commands.doreshapeframedbox(n) for h in traverse_id(hlist_code,list) do local l = h.list if l then - -- if h.width ~= maxwidth then -- else no display math handling (uses shift) - -- challenge: adapt glue_set - -- h.glue_set = h.glue_set * h.width/maxwidth -- interesting ... doesn't matter much - -- h.width = maxwidth - h.list = hpack(l,maxwidth,'exactly',h.dir) - h.shift = 0 -- needed for display math - h.width = maxwidth - -- end + if h.subtype == box_code then + -- explicit box, no 'line' + else + -- if h.width ~= maxwidth then -- else no display math handling (uses shift) + -- challenge: adapt glue_set + -- h.glue_set = h.glue_set * h.width/maxwidth -- interesting ... doesn't matter much + -- h.width = maxwidth + h.list = hpack(l,maxwidth,'exactly',h.dir) + h.shift = 0 -- needed for display math + h.width = maxwidth + -- end + end end end end diff --git a/tex/context/base/s-map-10.mkiv b/tex/context/base/s-map-10.mkiv index 33a372de8..b1218f6e2 100644 --- a/tex/context/base/s-map-10.mkiv +++ b/tex/context/base/s-map-10.mkiv @@ -171,7 +171,6 @@ \def\hfonti{\ssbfa} \def\hfontii{\ssbf} \def\hfontiii{\rm\it} -\def\runin#1#2{#2.} \doifmodeelse{nosubsub}{% \setuphead [section][% @@ -181,7 +180,6 @@ ] \setuphead [subsection][% style=\hfontiii, - command=\runin, alternative=text, distance=6pt, before={\blank[halfline]}% @@ -198,7 +196,6 @@ ] \setuphead [subsubsection][% style=\hfontiii, - command=\runin, distance=6pt, alternative=text, before={\blank[halfline]}% @@ -212,7 +209,6 @@ ] \setuphead [subsubject][% style=\hfontiii, - command=\runin, alternative=text, before={\blank[halfline]}% ]}{% @@ -228,7 +224,6 @@ ] \setuphead [subsubsubject][% style=\hfontiii, - command=\runin, alternative=text, before={\blank[halfline]}% ]} diff --git a/tex/context/base/scrp-cjk.lua b/tex/context/base/scrp-cjk.lua index 5885c9867..487d5a267 100644 --- a/tex/context/base/scrp-cjk.lua +++ b/tex/context/base/scrp-cjk.lua @@ -9,6 +9,11 @@ if not modules then modules = { } end modules ['scrp-cjk'] = { -- We can speed this up by preallocating nodes and copying them but the -- gain is not that large. +-- The input line endings: there is no way to distinguish between +-- inline spaces and endofline turned into spaces (would not make +-- sense either because otherwise a wanted space at the end of a +-- line would have to be a hard coded ones. + local utfchar = utf.char local insert_node_after = node.insert_after @@ -21,7 +26,10 @@ local new_kern = nodepool.kern local new_penalty = nodepool.penalty local nodecodes = nodes.nodecodes +local skipcodes = nodes.skipcodes local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue +local userskip_code = skipcodes.userskip local a_prestat = attributes.private('prestat') local a_preproc = attributes.private('preproc') @@ -34,6 +42,7 @@ local numbertodataset = scripts.numbertodataset local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers local quaddata = fonthashes.quads +local spacedata = fonthashes.spaces local trace_details = false trackers.register("scripts.details", function(v) trace_details = v end) @@ -96,6 +105,12 @@ local function trace_detail(current,what) end end +local function trace_detail_between(p,n,what) + local p_ch = p.char + local n_ch = n.char + report_details("[%C %a] [%s] [%C %a]",p_ch,hash[p_ch],what,n_ch,hash[n_ch]) +end + local function nobreak(head,current) if trace_details then trace_detail(current,"break") @@ -868,8 +883,13 @@ local function process(head,first,last) end end previous = current + +-- elseif id == math_code then +-- upcoming = end_of_math(current).next +-- previous = "start" + else -- glue - local p, n = first.prev, upcoming + local p, n = first.prev, upcoming -- we should remember prev if p and n then local pid, nid = p.id, n.id if pid == glyph_code and nid == glyph_code then @@ -882,7 +902,17 @@ local function process(head,first,last) or pcjk == "half_width_close" or ncjk == "half_width_open" then -- extra compared to korean previous = "start" else -- if head ~= first then +if id == glue_code and first.subtype == userskip_code then -- also prestat check? + -- for the moment no distinction possible between space and userskip + local w = first.spec.width + local s = spacedata[p.font] + if w == s then -- could be option + if trace_details then + trace_detail_between(p,n,"space removed") + end remove_node(head,first,true) + end +end previous = pcjk -- else -- previous = pcjk diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index d2487d071..03cdd253e 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 7c6595276..02f32d3fd 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 94ddd4678..449378d15 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/12/13 17:05:57 +-- merge date : 04/13/13 13:24:36 do -- begin closure to overcome local limits and interference -- cgit v1.2.3