From 47878599fddea4d4e259e3371def1afadc62e03b Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sat, 6 Feb 2016 15:15:07 +0100 Subject: 2016-02-06 14:08:00 --- doc/context/documents/general/manuals/luatex.pdf | Bin 1019915 -> 1009576 bytes .../general/manuals/luatex/luatex-nodes.tex | 5 +- .../sources/general/manuals/luatex/luatex.tex | 2 +- tex/context/base/context-version.pdf | Bin 4175 -> 4168 bytes tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/grph-fil.lua | 19 +- tex/context/base/mkiv/lang-hyp.lua | 2 +- tex/context/base/mkiv/lang-ini.lua | 6 +- tex/context/base/mkiv/mult-aux.mkiv | 3 + tex/context/base/mkiv/node-ini.lua | 4 +- tex/context/base/mkiv/node-ltp.lua | 33 ++- tex/context/base/mkiv/node-res.lua | 7 + tex/context/base/mkiv/page-com.mkiv | 4 +- tex/context/base/mkiv/page-lay.mkiv | 8 +- tex/context/base/mkiv/page-set.mkiv | 1 - tex/context/base/mkiv/scrn-pag.mkvi | 6 + tex/context/base/mkiv/status-files.pdf | Bin 8965 -> 8957 bytes tex/context/base/mkiv/status-lua.pdf | Bin 270287 -> 265373 bytes tex/context/base/mkiv/syst-ini.mkiv | 12 +- tex/context/base/mkiv/typo-brk.lua | 253 +++++++++++++++------ tex/context/base/mkiv/typo-brk.mkiv | 6 +- tex/context/base/mkiv/typo-itc.lua | 2 +- tex/context/base/mkiv/typo-lin.lua | 12 +- tex/context/base/mkiv/typo-mar.lua | 5 +- tex/context/modules/mkiv/m-visual.mkiv | 76 +++---- tex/context/modules/mkiv/x-set-11.mkiv | 54 ++++- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 28 files changed, 362 insertions(+), 164 deletions(-) diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf index 12e0e4e24..ba3599e63 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/luatex/luatex-nodes.tex b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex index ad0a74b30..8ffa9507b 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-nodes.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-nodes.tex @@ -384,8 +384,9 @@ Id: \showid{kern} \starttabulate[|lT|l|p|] \NC \ssbf field \NC \bf type \NC \bf explanation \NC \NR \NC subtype \NC number \NC \type {0} = from font, - \type {1} = from \type {\kern} or \type {\/}, - \type {2} = from \type {\accent} \NC \NR + \type {1} = from \type {\kern}, + \type {2} = from \type {\accent}, + \type {3} = from \type {\/} \NC \NR \NC attr \NC \syntax{} \NC \NC \NR \NC kern \NC number \NC \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/luatex/luatex.tex b/doc/context/sources/general/manuals/luatex/luatex.tex index ca257e6ea..6640e126e 100644 --- a/doc/context/sources/general/manuals/luatex/luatex.tex +++ b/doc/context/sources/general/manuals/luatex/luatex.tex @@ -14,7 +14,7 @@ \dontcomplain \startdocument - [beta=0.87.1] + [beta=0.89.0] \component luatex-titlepage diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 8851c4e67..48565f03e 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/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 5cbe2a231..a44827b34 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2016.02.01 13:26} +\newcontextversion{2016.02.06 14:06} %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 8eee2b8d0..98756bd0a 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.02.01 13:26} +\edef\contextversion{2016.02.06 14:06} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua index 04b44e667..e774d097e 100644 --- a/tex/context/base/mkiv/grph-fil.lua +++ b/tex/context/base/mkiv/grph-fil.lua @@ -11,6 +11,11 @@ local type = type local trace_run = false trackers.register("graphic.runfile",function(v) trace_run = v end) local report_run = logs.reporter("graphics","run") +local isfile = lfs.isfile +local replacesuffix = file.replacesuffix +local addsuffix = file.addsuffix +local checksum = file.checksum + -- Historically running files is part of graphics processing, so this is why it -- sits here but is part of the job namespace. @@ -27,6 +32,9 @@ local jobfiles = { job.files = jobfiles +local inputsuffix = "tex" +local resultsuffix = "pdf" + local function initializer() tobesaved = jobfiles.tobesaved collected = jobfiles.collected @@ -35,10 +43,11 @@ end job.register('job.files.collected', tobesaved, initializer) function jobfiles.run(name,action) - file.addsuffix(name,"tex") -- we assume tex if not set - local oldchecksum = collected[name] - local newchecksum = file.checksum(name) - if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum then + local usedname = addsuffix(name,inputsuffix) -- we assume tex if not set + local oldchecksum = collected[usedname] + local newchecksum = checksum(usedname) + local resultfile = replacesuffix(usedname,resultsuffix) + if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum or not isfile(resultfile) then if trace_run then report_run("processing file, changes in %a, processing forced",name) end @@ -68,7 +77,7 @@ function jobfiles.context(name,options) end return result else - local result = file.replacesuffix(name,"pdf") + local result = replacesuffix(name,resultsuffix) if not done[result] then jobfiles.run(name,"context ".. (options or "") .. " " .. name) done[result] = true diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index d1260b8b4..dad0f5232 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -224,7 +224,7 @@ local function show_log() local w = #steps[1][1] for i=1,#steps do local s = steps[i] - report("%s%w%S %S",s[1],w - #s[1] + 3,s[2],s[3]) + report("%s%w%S %S",s[1],w - #s[1] + 3,s[2],s[3] or "") end report() end diff --git a/tex/context/base/mkiv/lang-ini.lua b/tex/context/base/mkiv/lang-ini.lua index 46ccdec35..eb7e32b89 100644 --- a/tex/context/base/mkiv/lang-ini.lua +++ b/tex/context/base/mkiv/lang-ini.lua @@ -22,7 +22,7 @@ local type, tonumber = type, tonumber local utfbyte = utf.byte local format, gsub = string.format, string.gsub local concat, sortedkeys, sortedpairs = table.concat, table.sortedkeys, table.sortedpairs -local utfbytes = string.utfvalues +local utfbytes, strip = string.utfvalues, string.strip local context = context local commands = commands @@ -193,10 +193,8 @@ local function loaddefinitions(tag,specification) local loaded = table.load(fullname,gzipped and gzip.load) if loaded then -- todo: version test ok, nofloaded = true, nofloaded + 1 -if sethjcodes then -- for now sethjcodes(instance,loaded,"patterns") sethjcodes(instance,loaded,"exceptions") -end instance:patterns (validdata(loaded,"patterns", tag) or "") instance:hyphenation(validdata(loaded,"exceptions",tag) or "") resources[#resources+1] = loaded -- so we can use them otherwise @@ -367,7 +365,7 @@ end function languages.setexceptions(tag,str) local data, instance = resolve(tag) if data then - instance:hyphenation(string.strip(str)) -- we need to strip leading spaces + instance:hyphenation(strip(str)) -- we need to strip leading spaces end end diff --git a/tex/context/base/mkiv/mult-aux.mkiv b/tex/context/base/mkiv/mult-aux.mkiv index 693edc90e..d44c0242e 100644 --- a/tex/context/base/mkiv/mult-aux.mkiv +++ b/tex/context/base/mkiv/mult-aux.mkiv @@ -713,6 +713,9 @@ \unexpanded\def\relateparameterhandlers#1#2#3#4% {from} {instance} {to} {instance} {\expandafter\edef\csname\csname#1namespace\endcsname#2:\s!parent\endcsname{\csname#3namespace\endcsname#4}} +\unexpanded\def\relateparameterhandlersbyns#1#2#3#4% {from} {instance} {to} {instance} + {\expandafter\edef\csname#1#2:\s!parent\endcsname{#3#4}} + %D Here is another experiment: \unexpanded\def\installactionhandler#1% diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index aac3b3284..c705e2c05 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -168,6 +168,7 @@ table.setmetatableindex(penaltycodes,function(t,k) return "userpenalty" end) -- -- [0] = "fontkern", -- [1] = "userkern", -- [2] = "accentkern", +-- [3] = "italiccorrection", -- } local kerncodes = mark(getsubtypes("kern")) @@ -286,9 +287,10 @@ nodes.leadercodes = leadercodes listcodes.row = listcodes.alignment listcodes.column = listcodes.alignment -kerncodes.italiccorrection = kerncodes.userkern kerncodes.kerning = kerncodes.fontkern +kerncodes.italiccorrection = kerncodes.italiccorrection or 1 -- new + nodes.codes = allocate { -- mostly for listing glue = skipcodes, noad = noadcodes, diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua index fe7261aa2..5b5cc5c08 100644 --- a/tex/context/base/mkiv/node-ltp.lua +++ b/tex/context/base/mkiv/node-ltp.lua @@ -20,6 +20,7 @@ if not modules then modules = { } end modules ['node-par'] = { -- todo: fix line numbers (cur_list.pg_field needed) -- todo: check and improve protrusion -- todo: arabic etc (we could use pretty large scales there) .. marks and cursive +-- todo: see: we need to check this with the latest patches to the tex kernel -- todo: optimize a bit more (less par.*) @@ -263,6 +264,7 @@ local localpar_code = nodecodes.localpar local kerning_code = kerncodes.kerning -- font kern local userkern_code = kerncodes.userkern +local italickern_code = kerncodes.italiccorrection local ligature_code = glyphcodes.ligature @@ -785,7 +787,8 @@ local function compute_break_width(par,break_type,p) -- split in two elseif id == penalty_code then -- do nothing elseif id == kern_code then - if getsubtype(p) == userkern_code then + local s = getsubtype(p) + if s == userkern_code or s == italickern_code then break_width.size = break_width.size - getfield(p,"kern") else return @@ -1419,7 +1422,7 @@ local function post_line_break(par) -- keep the math node setfield(next,"surround",0) break - elseif id == kern_code and (subtype ~= userkern_code and not getattr(next,a_fontkern)) then + elseif id == kern_code and (subtype ~= userkern_code and subtype ~= italickern_code and not getattr(next,a_fontkern)) then -- fontkerns and accent kerns as well as otf injections break end @@ -2209,10 +2212,14 @@ function constructors.methods.basic(head,d) local prev_p = getprev(current) if prev_p and prev_p ~= temp_head then local id = getid(prev_p) - if (id == glyph_code) or -- dir_code is < math - (id < math_code) or -- was: precedes_break(prev_p) - (id == kern_code and getsubtype(prev_p) ~= userkern_code) then + -- 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 @@ -2301,7 +2308,8 @@ function constructors.methods.basic(head,d) end end elseif id == kern_code then - if getsubtype(current) == userkern_code then + local s = getsubtype(current) + if s == userkern_code or s == italickern_code then local v = getnext(current) -- if par.auto_breaking and getid(v) == glue_code then if auto_breaking and getid(v) == glue_code then @@ -2468,11 +2476,16 @@ local function short_display(target,a,font_in_short_display) if getfield(getfield(a,"spec"),"writable") then write(target," ") end - elseif id == kern_code and (getsubtype(a) == userkern_code or getattr(a,a_fontkern)) then - if verbose then - write(target,"[|]") + elseif id == kern_code then + local s = getsubtype(a) + if s == userkern_code or s == italickern_code or getattr(a,a_fontkern) then + if verbose then + write(target,"[|]") + -- else + -- write(target,"") + end else - write(target,"") + write(target,"[]") end elseif id == math_code then write(target,"$") diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua index eec7f0c07..7aac2a166 100644 --- a/tex/context/base/mkiv/node-res.lua +++ b/tex/context/base/mkiv/node-res.lua @@ -138,6 +138,7 @@ nutpool.register = register_node -- could be register_nut local disc = register_nut(new_nut("disc")) local kern = register_nut(new_nut("kern",kerncodes.userkern)) local fontkern = register_nut(new_nut("kern",kerncodes.fontkern)) +local italickern = register_nut(new_nut("kern",kerncodes.italiccorrection)) local penalty = register_nut(new_nut("penalty")) local glue = register_nut(new_nut("glue")) -- glue.spec = nil local glue_spec = register_nut(new_nut("glue_spec")) @@ -205,6 +206,12 @@ function nutpool.fontkern(k) return n end +function nutpool.italickern(k) + local n = copy_nut(italickern) + setfield(n,"kern",k) + return n +end + function nutpool.gluespec(width,stretch,shrink,stretch_order,shrink_order) local s = copy_nut(glue_spec) if width and width ~= 0 then diff --git a/tex/context/base/mkiv/page-com.mkiv b/tex/context/base/mkiv/page-com.mkiv index b051b3db9..dfec3e25d 100644 --- a/tex/context/base/mkiv/page-com.mkiv +++ b/tex/context/base/mkiv/page-com.mkiv @@ -54,7 +54,7 @@ \expandnamespacemacro\??pagecommentstates\p_page_commands_state\v!none \to \everysetuppagecomment -\ifdefined\scrn_canvas_synchronize_simple +% \ifdefined\scrn_canvas_synchronize_simple \appendtoks \ifx\p_page_commands_state\v!start @@ -64,7 +64,7 @@ \fi \to \everyshipout -\fi +% \fi \setvalue{\??pagecommentstates\v!start}% {\d_page_comments_offset \directpagecommentparameter\c!offset \relax diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index f1aec4e3d..bc7c9f4bc 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -584,7 +584,13 @@ \endgroup \fi %\writestatus{layout target}{(\the\paperwidth,\the\paperheight) -> (\the\printpaperwidth,\the\printpaperheight)}% - \page_layouts_synchronize} + \page_layouts_synchronize + % new but we assume \setuplayout + \scrn_canvas_synchronize_only} + +\ifdefined\scrn_canvas_synchronize_only \else + \let\scrn_canvas_synchronize_only\relax +\fi \ifdefined\page_paper_set_offsets \else diff --git a/tex/context/base/mkiv/page-set.mkiv b/tex/context/base/mkiv/page-set.mkiv index 0099c5189..6e6759208 100644 --- a/tex/context/base/mkiv/page-set.mkiv +++ b/tex/context/base/mkiv/page-set.mkiv @@ -2348,7 +2348,6 @@ %\c!bottomoffset=\columntextareaparameter\c!clipoffset,% %\c!leftoffset=\columntextareaparameter\c!clipoffset,% \c!offset=\columntextareaparameter\c!clipoffset,% - \c!offset=\columntextareaparameter\c!clipoffset,% \c!rightoffset=\columntextareaparameter\c!rightoffset,% \c!width=\!!widthb,% \c!height=\!!heighta]% diff --git a/tex/context/base/mkiv/scrn-pag.mkvi b/tex/context/base/mkiv/scrn-pag.mkvi index 3a01271ce..5624b9045 100644 --- a/tex/context/base/mkiv/scrn-pag.mkvi +++ b/tex/context/base/mkiv/scrn-pag.mkvi @@ -197,6 +197,12 @@ \global\let\scrn_canvas_synchronize_complex\scrn_canvas_synchronize_complex_indeed \to \everysetuplayouttarget +\def\scrn_canvas_synchronize_only + {\clf_setupcanvas + paperwidth \printpaperwidth + paperheight \printpaperheight + \relax} + \def\scrn_canvas_synchronize_simple_indeed {\clf_setupcanvas paperwidth \printpaperwidth diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 1e21f36f0..b213b43d2 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 a5ac3a260..3473f5915 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/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index a99f6f0da..12ceba15e 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -1002,7 +1002,7 @@ \edef\pdfcompresslevel {\pdfvariable compresslevel} \pdfcompresslevel \plusnine \edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} \pdfobjcompresslevel \plusone -\edef\pdfdecimaldigits {\pdfvariable decimaldigits} \pdfdecimaldigits \plussix +\edef\pdfdecimaldigits {\pdfvariable decimaldigits} \pdfdecimaldigits \plusfive \edef\pdfgamma {\pdfvariable gamma} \pdfgamma \plusthousand \edef\pdfimageresolution {\pdfvariable imageresolution} \pdfimageresolution 300 \edef\pdfimageapplygamma {\pdfvariable imageapplygamma} \pdfimageapplygamma \zerocount @@ -1022,14 +1022,8 @@ \edef\pdfdestmargin {\pdfvariable destmargin} \pdfdestmargin \zeropoint \edef\pdfthreadmargin {\pdfvariable threadmargin} \pdfthreadmargin \zeropoint \edef\pdfxformmargin {\pdfvariable xformmargin} \pdfxformmargin \zeropoint - -\ifnum\luatexversion>88 - \edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi} \pdfpkfixeddpi \plusone - \edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages} \pdfignoreunknownimages \zerocount -\else - \newcount\pdfpkfixeddpi - \newcount\pdfignoreunknownimages -\fi +\edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi} \pdfpkfixeddpi \plusone +\edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages} \pdfignoreunknownimages \zerocount \edef\pdfpagesattr {\pdfvariable pagesattr} \edef\pdfpageattr {\pdfvariable pageattr} diff --git a/tex/context/base/mkiv/typo-brk.lua b/tex/context/base/mkiv/typo-brk.lua index 146694494..cf9d40312 100644 --- a/tex/context/base/mkiv/typo-brk.lua +++ b/tex/context/base/mkiv/typo-brk.lua @@ -40,6 +40,7 @@ local setattr = nuts.setattr local setlink = nuts.setlink local setchar = nuts.setchar local setdisc = nuts.setdisc +local setsubtype = nuts.setsubtype local copy_node = nuts.copy local copy_nodelist = nuts.copy_list @@ -47,6 +48,7 @@ local free_node = nuts.free local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after local remove_node = nuts.remove +local traverse_id = nuts.traverse_id local tonodes = nuts.tonodes @@ -70,7 +72,9 @@ local kerncodes = nodes.kerncodes local glyph_code = nodecodes.glyph local kern_code = nodecodes.kern -local kerning_code = kerncodes.kerning +local fontkern_code = kerncodes.fontkern +local userkern_code = kerncodes.userkern +local italickern_code = kerncodes.italiccorrection local typesetters = typesetters @@ -95,17 +99,19 @@ for i=1,#mapping do numbers[m.name] = m end -local function insert_break(head,start,before,after) - insert_node_before(head,start,new_penalty(before)) - insert_node_before(head,start,new_glue(0)) +local function insert_break(head,start,before,after,kern) + if not kern then + insert_node_before(head,start,new_penalty(before)) + insert_node_before(head,start,new_glue(0)) + end insert_node_after(head,start,new_glue(0)) insert_node_after(head,start,new_penalty(after)) end -methods[1] = function(head,start) +methods[1] = function(head,start,_,kern) local p, n = getboth(start) if p and n then - insert_break(head,start,10000,0) + insert_break(head,start,10000,0,kern) end return head, start end @@ -191,75 +197,190 @@ methods[5] = function(head,start,settings) -- x => p q r return head, start end +-- function breakpoints.handler(head) +-- head = tonut(head) +-- local done, numbers = false, languages.numbers +-- local start, n = head, 0 +-- while start do +-- local id = getid(start) +-- if id == glyph_code then +-- local attr = getattr(start,a_breakpoints) +-- if attr and attr > 0 then +-- setattr(start,a_breakpoints,unsetvalue) -- maybe test for subtype > 256 (faster) +-- -- look ahead and back n chars +-- local data = mapping[attr] +-- if data then +-- local map = data.characters +-- local cmap = map[getchar(start)] +-- if cmap then +-- local lang = getfield(start,"lang") +-- -- we do a sanity check for language +-- local smap = lang and lang >= 0 and lang < 0x7FFF and (cmap[numbers[lang]] or cmap[""]) +-- if smap then +-- if n >= smap.nleft then +-- local m = smap.nright +-- local next = getnext(start) +-- while next do -- gamble on same attribute (not that important actually) +-- local id = getid(next) +-- if id == glyph_code then -- gamble on same attribute (not that important actually) +-- if map[getchar(next)] then +-- break +-- elseif m == 1 then +-- local method = methods[smap.type] +-- if method then +-- head, start = method(head,start,smap) +-- done = true +-- end +-- break +-- else +-- m = m - 1 +-- next = getnext(next) +-- end +-- elseif id == kern_code and getsubtype(next) == fontkern_code then +-- next = getnext(next) +-- -- ignore intercharacter kerning, will go way +-- else +-- -- we can do clever and set n and jump ahead but ... not now +-- break +-- end +-- end +-- end +-- n = 0 +-- else +-- n = n + 1 +-- end +-- else +-- n = n + 1 +-- end +-- else +-- n = 0 +-- end +-- else +-- -- n = n + 1 -- if we want single char handling (|-|) then we will use grouping and then we need this +-- end +-- elseif id == kern_code and getsubtype(start) == fontkern_code then +-- -- ignore intercharacter kerning, will go way +-- else +-- n = 0 +-- end +-- start = getnext(start) +-- end +-- return tonode(head), done +-- end + +-- we know we have a limited set +-- what if characters are replaced by the font handler +-- do we need to go into disc nodes (or do it as first step but then we need a pre/post font handler) + function breakpoints.handler(head) - head = tonut(head) - local done, numbers = false, languages.numbers - local start, n = head, 0 - while start do - local id = getid(start) - if id == glyph_code then - local attr = getattr(start,a_breakpoints) - if attr and attr > 0 then - setattr(start,a_breakpoints,unsetvalue) -- maybe test for subtype > 256 (faster) - -- look ahead and back n chars - local data = mapping[attr] + local done = false + local nead = tonut(head) + local attr = nil + local map = nil + for n in traverse_id(glyph_code,nead) do -- could be a traverse_chars at some point + local a = getattr(n,a_breakpoints) + if a and a > 0 then + if a ~= attr then + local data = mapping[a] if data then - local map = data.characters - local cmap = map[getchar(start)] - if cmap then - local lang = getfield(start,"lang") - -- we do a sanity check for language - local smap = lang and lang >= 0 and lang < 0x7FFF and (cmap[numbers[lang]] or cmap[""]) - if smap then - if n >= smap.nleft then - local m = smap.nright - local next = getnext(start) - while next do -- gamble on same attribute (not that important actually) - local id = getid(next) - if id == glyph_code then -- gamble on same attribute (not that important actually) - if map[getchar(next)] then - break - elseif m == 1 then - local method = methods[smap.type] - if method then - head, start = method(head,start,smap) - done = true - end - break - else - m = m - 1 - next = getnext(next) - end - elseif id == kern_code and getsubtype(next) == kerning_code then - next = getnext(next) - -- ignore intercharacter kerning, will go way - else - -- we can do clever and set n and jump ahead but ... not now - break - end - end - end - n = 0 + map = data.characters + else + map = nil + end + attr = a + end + if map then + local cmap = map[getchar(n)] + if cmap then + -- for now we collect but when found ok we can move the handler here + -- although it saves nothing in terms of performance + local d = { n, cmap } + if done then + done[#done+1] = d + else + done = { d } + end + setattr(n,a_breakpoints,unsetvalue) + end + end + end + end + if not done then + return head, false + end + -- we have hits + local numbers = languages.numbers + for i=1,#done do + local data = done[i] + local current = data[1] + local cmap = data[2] + local lang = getfield(current,"lang") + -- we do a sanity check for language + local smap = lang and lang >= 0 and lang < 0x7FFF and (cmap[numbers[lang]] or cmap[""]) + if smap then + local nleft = smap.nleft + local cleft = 0 + local prev = getprev(current) + local kern = nil + while prev and nleft ~= cleft do + local id = getid(prev) + if id == glyph_code then + cleft = cleft + 1 + prev = getprev(prev) + elseif id == kern_code then + local s = getsubtype(prev) + if s == fontkern_code or s == italickern_code then + if cleft == 0 then + kern = prev + prev = getprev(prev) else - n = n + 1 + break end else - n = n + 1 + break end else - n = 0 + break + end + end + if nleft == cleft then + local nright = smap.nright + local cright = 0 + local next = getnext(current) + while next and nright ~= cright do + local id = getid(next) + if id == glyph_code then + if cright == 1 and cmap[getchar(next)] then + -- let's not make it too messy + break + end + cright = cright + 1 + next = getnext(next) + elseif id == kern_code then + local s = getsubtype(next) + if s == fontkern_code or s == italickern_code then + if cleft == 0 then + next = getnext(next) + else + break + end + else + break + end + else + break + end + end + if nright == cright then + local method = methods[smap.type] + if method then + nead, start = method(nead,current,smap,kern) + end end - else - -- n = n + 1 -- if we want single char handling (|-|) then we will use grouping and then we need this end - elseif id == kern_code and getsubtype(start) == kerning_code then - -- ignore intercharacter kerning, will go way - else - n = 0 end - start = getnext(start) end - return tonode(head), done + return tonode(nead), true end local enabled = false @@ -343,8 +464,8 @@ implement { "string", { { "type", "integer" }, - { "nleft" }, - { "nright" }, + { "nleft", "integer" }, + { "nright", "integer" }, { "right" }, { "left" }, { "middle" }, diff --git a/tex/context/base/mkiv/typo-brk.mkiv b/tex/context/base/mkiv/typo-brk.mkiv index 3b463c06f..55f4d8466 100644 --- a/tex/context/base/mkiv/typo-brk.mkiv +++ b/tex/context/base/mkiv/typo-brk.mkiv @@ -38,15 +38,15 @@ \def\typo_breakpoints_define_character[#1][#2][#3]% name char settings {\begingroup - \getdummyparameters[\c!type=1,\c!nleft=3,\c!nright=3,\s!language=,\c!left=,\c!right=,\c!middle=,#3]% + \getdummyparameters[\c!type=\plusone,\c!nleft=\plusthree,\c!nright=\plusthree,\s!language=,\c!left=,\c!right=,\c!middle=,#3]% \clf_definebreakpoint {#1}% {#2}% {\reallanguagetag{\directdummyparameter\s!language}}% {% maybe deal with #3 at the lua end type \directdummyparameter\c!type - nleft {\directdummyparameter\c!nleft}% - nright {\directdummyparameter\c!nright}% + nleft \directdummyparameter\c!nleft + nright \directdummyparameter\c!nright right {\directdummyparameter\c!right}% left {\directdummyparameter\c!left}% middle {\directdummyparameter\c!middle}% diff --git a/tex/context/base/mkiv/typo-itc.lua b/tex/context/base/mkiv/typo-itc.lua index 47783be49..62fea3e2e 100644 --- a/tex/context/base/mkiv/typo-itc.lua +++ b/tex/context/base/mkiv/typo-itc.lua @@ -53,7 +53,7 @@ local a_mathitalics = attributes.private("mathitalics") local unsetvalue = attributes.unsetvalue -local new_correction_kern = nodepool.fontkern +local new_correction_kern = nodepool.italickern local new_correction_glue = nodepool.glue local fonthashes = fonts.hashes diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua index 001bc94cf..b94fbf2bf 100644 --- a/tex/context/base/mkiv/typo-lin.lua +++ b/tex/context/base/mkiv/typo-lin.lua @@ -78,9 +78,7 @@ local traverse_id = nuts.traverse_id local insert_before = nuts.insert_before local insert_after = nuts.insert_after local find_tail = nuts.tail -local remove_node = nuts.remove -local hpack_nodes = nuts.hpack -local copy_list = nuts.copy_list +----- remove_node = nuts.remove local getsubtype = nuts.getsubtype local getlist = nuts.getlist @@ -187,10 +185,10 @@ local function normalize(line,islocal) -- assumes prestine lines, nothing pre/ap current = getnext(head) id = getid(current) end --- no: --- if id == localpar_code then --- head = remove_node(head,head,true) --- end + -- no: + -- if id == localpar_code then + -- head = remove_node(head,head,true) + -- end local tail = find_tail(head) local current = tail local id = getid(current) diff --git a/tex/context/base/mkiv/typo-mar.lua b/tex/context/base/mkiv/typo-mar.lua index 37732f066..cdb4d544c 100644 --- a/tex/context/base/mkiv/typo-mar.lua +++ b/tex/context/base/mkiv/typo-mar.lua @@ -535,7 +535,10 @@ local function markovershoot(current) -- todo: alleen als offset > line v_anchors = v_anchors + 1 cache[v_anchors] = stacked local anchor = setanchor(v_anchors) - local list = hpack_nodes(linked_nodes(anchor,getlist(current))) + -- local list = hpack_nodes(linked_nodes(anchor,getlist(current))) -- not ok, we need to retain width + local list = hpack_nodes(linked_nodes(anchor,getlist(current)),getfield(current,"width"),"exactly")-- + -- why not: + -- local list = linked_nodes(anchor,getlist(current)) setlist(current,list) end diff --git a/tex/context/modules/mkiv/m-visual.mkiv b/tex/context/modules/mkiv/m-visual.mkiv index d50215966..553625204 100644 --- a/tex/context/modules/mkiv/m-visual.mkiv +++ b/tex/context/modules/mkiv/m-visual.mkiv @@ -31,11 +31,11 @@ \begingroup \directcolored[fakerulecolor]% \iffakebaseline - \vrule\s!height1.25ex\s!depth-.05ex\s!width#1% + \vrule\s!height1.25\exheight\s!depth-.05\exheight\s!width#1% \kern-#1% - \vrule\s!height-.05ex\s!depth .25ex\s!width#1% + \vrule\s!height-.05\exheight\s!depth .25\exheight\s!width#1% \else - \vrule\s!height1.25ex\s!depth .25ex\s!width#1% + \vrule\s!height1.25\exheight\s!depth .25\exheight\s!width#1% \fi \endgroup \allowbreak} @@ -134,8 +134,8 @@ \unexpanded\def\fakedroppedcaps#1% {\ifnum#1>0 \def\dofakedroppedcaps - {\setbox\scratchbox\hbox - {\setbox\scratchbox\hbox{W}% + {\setbox\scratchbox\hpack + {\setbox\scratchbox\hpack{W}% \scratchdimen#1\lineheight \advance\scratchdimen -\lineheight \advance\scratchdimen \dp\strutbox @@ -209,25 +209,25 @@ \def\dosmashedgrid[#1]% {\hsmashed - {\setbox\scratchbox=\hbox + {\setbox\scratchbox=\hpack {\basegrid [\c!nx=10,\c!ny=10,\c!dx=1,\c!dy=1, \c!unit=\bodyfontsize,#1]}% - \hbox to \zeropoint + \hpack to \zeropoint {\hss\lower.5\ht\scratchbox\box\scratchbox\hss}% - \hbox to \zeropoint + \hpack to \zeropoint {\hss \black\vrule\s!width6\linewidth\s!height3\linewidth\s!depth3\linewidth \hss}}} \unexpanded\def\bodyfontgrid - {\hbox + {\hpack {{\linewidth.1pt\yellow\smashedgrid[\c!nx=30,\c!ny=30,\c!scale=.3333]}% {\linewidth.2pt\green \smashedgrid[\c!nx=20,\c!ny=20,\c!scale=.5]}% {\linewidth.3pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!scale=1]}}} \unexpanded\def\emexgrid - {\hbox + {\hpack {{\linewidth.15pt\green\smashedgrid[\c!nx=20,\c!ny=20,\c!unit=ex]}% {\linewidth.15pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!unit=em]}}} @@ -484,7 +484,7 @@ {\fastcolored[#1]{\hrule\s!width3em\s!height\scratchdimen\s!depth\zeropoint}} \def\docolorrangeA#1 #2 % - {\vbox + {\vpack {\hsize3em % \scratchdimen \ifcase#1\or \dodocolorrangeA{c=#2}\or @@ -495,12 +495,12 @@ \dodocolorrangeA{c=#2,m=#2}\fi \ifdim\scratchdimen>1ex \vskip-\scratchdimen - \vbox to \scratchdimen - {\vss\hbox to 3em{\hss#2\hss}\vss}% + \vpack to \scratchdimen + {\vss\hpack to 3em{\hss#2\hss}\vss}% \fi}} \def\colorrangeA#1% - {\vbox + {\vpack {\startcolor[\s!white]% \scratchdimen\dimexpr(-\colormarklength*4+\tractempheight+\tractempdepth)/21\relax \offinterlineskip @@ -517,12 +517,12 @@ {\vrule\s!width\scratchdimen\s!height\colormarklength\s!depth\zeropoint}% \ifdim\scratchdimen>2em \hskip-\scratchdimen - \vbox to \colormarklength - {\vss\hbox to \scratchdimen{\hss#1\hss}\vss}% + \vpack to \colormarklength + {\vss\hpack to \scratchdimen{\hss#1\hss}\vss}% \fi} \def\colorrangeB - {\hbox + {\hpack {\startcolor[\s!white]% \scratchdimen\dimexpr(-\colormarklength*\plustwo+\tractempwidth)/11\relax \docolorrangeB .5~C .5 0 0 0 @@ -544,12 +544,12 @@ {\vrule\s!width\scratchdimen\s!height\colormarklength\s!depth\zeropoint}% \ifdim\scratchdimen>2em \hskip-\scratchdimen - \vbox to \colormarklength - {\vss\hbox to \scratchdimen{\hss#1\hss}\vss}% + \vpack to \colormarklength + {\vss\hpack to \scratchdimen{\hss#1\hss}\vss}% \fi} \def\colorrangeC - {\hbox + {\hpack {\startcolor[\s!white]% \scratchdimen\dimexpr(-\colormarklength*2+\tractempwidth)/14\relax \docolorrangeC 1 \docolorrangeC .95 @@ -569,36 +569,36 @@ {\tractempheight\ht#2% \tractempdepth \dp#2% \tractempwidth \wd#2% - \setbox#2\hbox + \setbox#2\hpack {\scratchdimen\dimexpr\colormarklength/2\relax \forgetall \ssxx - \setbox\scratchbox\vbox + \setbox\scratchbox\vpack {\offinterlineskip \vskip\dimexpr-\colormarkoffset\scratchdimen-2\scratchdimen\relax \ifcase#1\relax \vskip\dimexpr\colormarklength+\scratchdimen+\tractempheight\relax \else - \hbox to \tractempwidth{\hss\hbox{\colorrangeB}\hss}% + \hpack to \tractempwidth{\hss\hpack{\colorrangeB}\hss}% \vskip\colormarkoffset\scratchdimen - \vbox to \tractempheight + \vpack to \tractempheight {\vss - \hbox to \tractempwidth + \hpack to \tractempwidth {\llap{\colorrangeA1\hskip\colormarkoffset\scratchdimen}\hfill \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA4}}% \vss - \hbox to \tractempwidth + \hpack to \tractempwidth {\llap{\colorrangeA2\hskip\colormarkoffset\scratchdimen}\hfill \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA5}}% \vss - \hbox to \tractempwidth + \hpack to \tractempwidth {\llap{\colorrangeA3\hskip\colormarkoffset\scratchdimen}\hfill \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA6}}% \vss}% \fi \vskip\colormarkoffset\scratchdimen - \hbox to \tractempwidth - {\hss\lower\tractempdepth\hbox{\colorrangeC}\hss}}% + \hpack to \tractempwidth + {\hss\lower\tractempdepth\hpack{\colorrangeC}\hss}}% \ht\scratchbox\tractempheight \dp\scratchbox\tractempdepth \wd\scratchbox\zeropoint @@ -668,13 +668,13 @@ \dontshowwhatsits \ttx \ifvmode\donetrue\else\donefalse\fi - \setbox\scratchbox\hbox + \setbox\scratchbox\hpack {\ifdone \colored[r=#1,g=#2,b=#3]{#5}% temp hack \else \colored[s=0]{#5}% temp hack \fi}% - \setbox\scratchbox\hbox + \setbox\scratchbox\hpack {\ifdone \colored[r=#1,g=#2,b=#3]{\vrule\s!width\wd\scratchbox}% temp hack \else @@ -682,7 +682,7 @@ \fi \hskip-\wd\scratchbox\box\scratchbox}% \scratchdimen1ex - \setbox\scratchbox\hbox + \setbox\scratchbox\hpack {\ifdone\hskip\else\raise#4\fi\scratchdimen\box\scratchbox}% \smashbox\scratchbox \ifdone\nointerlineskip\fi @@ -735,7 +735,7 @@ \def\dodotagbox#1#2#3% can be reimplemented {\def\next##1##2##3##4% - {\vbox to \ht#2{##3\hbox to \wd#2{##1#3##2}##4}}% + {\vpack to \ht#2{##3\hpack to \wd#2{##1#3##2}##4}}% \processaction [#1] [ l=>\next\relax\hfill\vfill\vfill, @@ -757,7 +757,7 @@ {\bgroup \dowithnextbox {\setbox\scratchbox\flushnextbox - \setbox\nextbox\ifhbox\nextbox\hbox\else\vbox\fi + \setbox\nextbox\ifhbox\nextbox\hpack\else\vpack\fi \bgroup \startoverlay {\copy\scratchbox} @@ -786,16 +786,16 @@ \definecolor[strutcolor] [r=.5,g=.25,b=.25] \unexpanded\def\coloredbox#1% - {\dowithnextbox{#1{\hbox + {\dowithnextbox{#1{\hpack {\blackrule[\c!width=\nextboxwd,\c!height=\nextboxht,\c!depth=\zeropoint,\c!color=boxcolor:ht]% \hskip-\nextboxwd \blackrule[\c!width=\nextboxwd,\c!height=\zeropoint,\c!depth=\nextboxdp,\c!color=boxcolor:dp]% \hskip-\nextboxwd \box\nextbox}}}#1} -\unexpanded\def\coloredhbox{\coloredbox\hbox} -\unexpanded\def\coloredvbox{\coloredbox\vbox} -\unexpanded\def\coloredvtop{\coloredbox\vtop} +\unexpanded\def\coloredhbox{\coloredbox\hpack} +\unexpanded\def\coloredvbox{\coloredbox\vpack} +\unexpanded\def\coloredvtop{\coloredbox\tpack} \unexpanded\def\coloredstrut {\color[strutcolor]{\def\strutwidth{2\points}\setstrut\strut}} diff --git a/tex/context/modules/mkiv/x-set-11.mkiv b/tex/context/modules/mkiv/x-set-11.mkiv index e2de3e9b8..056a57c67 100644 --- a/tex/context/modules/mkiv/x-set-11.mkiv +++ b/tex/context/modules/mkiv/x-set-11.mkiv @@ -628,9 +628,23 @@ \stopluacode +% +% +% +% +% +% +% +% + +\startxmlsetups xml:setups:interfacefile + \loadsetups[\xmlatt{#1}{filename}] +\stopxmlsetups + \startxmlsetups xml:setups:basics - \xmlinclude{#1}{include}{filename}% - \xmlsetsetup {#1} {*} {xml:setups:*} + \xmlinclude {#1}{include}{filename} + \xmlcommand {#1}{/interface/interfacefile}{xml:setups:interfacefile} + \xmlsetsetup{#1}{*}{xml:setups:*} \xmlfunction{#1}{setups_define} \stopxmlsetups @@ -647,11 +661,13 @@ {\doifsomething{#1} {\doonlyonce{setups:#1} {\doglobal\prependtocommalist{setups:#1}\loadedsetups % last overloads first -% \setupxml -% [\c!default=\v!hidden, % ignore elements that are not defined -% \c!compress=\v!yes] + % \setupxml + % [\c!default=\v!hidden, % ignore elements that are not defined + % \c!compress=\v!yes] \xmlloadonly{setups:#1}{#1}{setups}% - \xmlfilter{setups:#1}{/interface/command/command(xml:setups:register)}}}} % qualified path saves > 50% runtime + % qualified path saves > 50% runtime + \xmlfilter{setups:#1}{/interface//command/command(xml:setups:register)}% + }}} \newconstant\kindofsetup @@ -1158,8 +1174,10 @@ % assignments -\xmlmapvalue {setups:assignment} {braces} {\showSETUPassignmentbraces} -\xmlmapvalue {setups:assignment} {brackets} {\showSETUPassignmentbrackets} +\xmlmapvalue {setups:assignment} {braces} {\showSETUPassignmentbraces} +\xmlmapvalue {setups:assignment} {brackets} {\showSETUPassignmentbrackets} +\xmlmapvalue {setups:keyword} {parentheses} {\showSETUPkeywordparentheses} +\xmlmapvalue {setups:keyword} {none} {\showSETUPkeywordnone} \starttexdefinition unexpanded showSETUPassignmentbraces #1 \ifcase\kindofsetup @@ -1181,6 +1199,26 @@ \fi \stoptexdefinition +\starttexdefinition unexpanded showSETUPkeywordparentheses #1 + \ifcase\kindofsetup + \showSETUPline{(...)} + \else + \showSETUP{#1} + {(...)} + {(...,...)} + \fi +\stoptexdefinition + +\starttexdefinition unexpanded showSETUPkeywordnone #1 + \ifcase\kindofsetup + \showSETUPline{...} + \else + \showSETUP{#1} + {...} + {.. ... ..} + \fi +\stoptexdefinition + \starttexdefinition unexpanded showSETUPassignment #1 \xmlvalue {setups:assignment} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4099dfc6b..6d3ae6cc6 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 : 02/01/16 13:26:19 +-- merge date : 02/06/16 14:06:23 do -- begin closure to overcome local limits and interference -- cgit v1.2.3