From d9aa299de0f736f75f90b98ab284e5bc73515949 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 26 Mar 2020 22:27:51 +0100 Subject: 2020-03-26 21:49: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/export-example.css | 50 +++++++++++++++++------- tex/context/base/mkiv/font-sel.lua | 54 +++++++++++++------------- tex/context/base/mkiv/lpdf-fld.lua | 30 +++++++-------- tex/context/base/mkiv/lxml-aux.lua | 48 ++++++++++++++++++++--- tex/context/base/mkiv/lxml-lpt.lua | 2 + tex/context/base/mkiv/lxml-tab.lua | 15 +++++++- tex/context/base/mkiv/mlib-lmp.lua | 3 ++ tex/context/base/mkiv/mlib-svg.lua | 63 ++++++++++++++++--------------- tex/context/base/mkiv/mult-prm.lua | 6 +-- tex/context/base/mkiv/node-fnt.lua | 51 ++++--------------------- tex/context/base/mkiv/pack-com.mkiv | 2 +- tex/context/base/mkiv/pack-rul.mkiv | 2 +- tex/context/base/mkiv/pack-rul.mkxl | 4 +- tex/context/base/mkiv/status-files.pdf | Bin 28109 -> 28096 bytes tex/context/base/mkiv/status-lua.pdf | Bin 271171 -> 269645 bytes tex/context/base/mkiv/syst-ini.mkiv | 6 +++ tex/context/base/mkiv/syst-ini.mkxl | 6 +++ tex/context/base/mkiv/tabl-ntb.mkiv | 6 +++ tex/context/base/mkiv/tabl-ntb.mkxl | 3 ++ 24 files changed, 214 insertions(+), 147 deletions(-) (limited to 'tex/context/base') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 5c13c209d..437048dc3 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.10 14:44} +\newcontextversion{2020.03.26 21:46} %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 db1940639..49cb4a154 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.10 14:44} +\edef\contextversion{2020.03.26 21:46} %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 7d76e05de..ce1e83666 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.10 14:44} +\newcontextversion{2020.03.26 21:46} %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 ff4c7f6c6..bdc605cbe 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.10 14:44} +\edef\contextversion{2020.03.26 21:46} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 13e6a100b..42b3d63ba 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.10 14:44} +\edef\contextversion{2020.03.26 21:46} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/export-example.css b/tex/context/base/mkiv/export-example.css index 19a2a071e..096408ee1 100644 --- a/tex/context/base/mkiv/export-example.css +++ b/tex/context/base/mkiv/export-example.css @@ -405,7 +405,7 @@ context|div.item { } itemtag, -context|div.item { +context|div.itemtag { display: none ; } @@ -546,44 +546,61 @@ context|div.registerlocation:after { /* tablerow : display */ /* tablecell : mixed */ +/* we have a few bonus mappings here */ + table, context|div.table { display : table ; } -tablerow, -context|div.tablerow { +tablerow, tr +context|div.tablerow, context|div.tr { display : table-row ; } -tablecell[align="middle"], +tablecell[align="middle"], td[align="middle"], context|div.tablecell.align-middle { display : table-cell ; text-align : center ; padding : .1em ; } -tablecell[align="flushleft"], +tablecell[align="flushleft"], td[align="flushleft"], context|div.tablecell.align-flushleft { display : table-cell ; text-align : left ; padding : .1em ; } -tablecell[align="flushright"], +tablecell[align="flushright"], td[align="flushright"], context|div.tablecell.align-flushright { display : table-cell ; text-align : right ; padding : .1em ; } -tablecell, -context|div.tablecell { +tablecell, td +context|div.tablecell, context|div.td { display : table-cell ; text-align : left ; padding : .1em ; } +tablehead, +div.thead, div.tableheader { + display : table-header-group ; +} + +tablefoot, +div.tfoot, div.tablefooter { + display : table-footer-group ; +} + +tablebody, +div.tbody, div.tablebody { + display : table-body-group ; +} + /* tabulate : display */ /* tabulaterow : display */ /* tabulatecell : mixed */ @@ -648,6 +665,13 @@ context|div.tabulatecell.kind-equals:before { content : ":" ; } +/* + + A combination needs some processing because it is not a table yet. So, the next + mapping is just one row! The tags are a bit confusing now. + +*/ + /* combination : display */ /* combinationpair : display */ /* combinationcontent : mixed */ @@ -660,8 +684,8 @@ context|div.combination { margin-bottom : 0em ; } -combinationpair, -context|div.combinationpair { +combinationpair, combinationtext, +context|div.combinationpair, context|div.combinationtext { display : table-cell ; padding-right : 1em ; } @@ -727,7 +751,7 @@ context|div.listitem.subsection context|div.listtag { */ listitem[detail="chapter"]>listtag, -context|div.listitem.chapter context|div.listtag { +context|div.listitem.chapter > context|div.listtag { display : inline-block ; margin-left : -5em ; float : left ; @@ -735,7 +759,7 @@ context|div.listitem.chapter context|div.listtag { } listitem[detail="section"]>listtag, -context|div.listitem.section context|div.listtag { +context|div.listitem.section > context|div.listtag { display : inline-block ; margin-left : -5em ; float : left ; @@ -743,7 +767,7 @@ context|div.listitem.section context|div.listtag { } listitem[detail="subsection"]>listtag, -context|div.listitem.subsection context|div.listtag { +context|div.listitem.subsection > context|div.listtag { display : inline-block ; margin-left : -5em ; float : left ; diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua index 15d3838f6..9a611f9fa 100644 --- a/tex/context/base/mkiv/font-sel.lua +++ b/tex/context/base/mkiv/font-sel.lua @@ -96,7 +96,7 @@ extras["features"] = function(data,alternative,features) local e = gsub(gsub(features,"*",d),"{(.*)}","%1") local f = data.features if trace_features then - report_features("Alternative '%s': Saving features '%s'",alternative,e) + report_features("alternative '%s': saving features '%s'",alternative,e) end if not f then f = { } @@ -109,7 +109,7 @@ extras["goodies"] = function(data,alternative,goodies) local e = gsub(goodies,"{(.*)}","%1") local g = data.goodies if trace_goodies then - report_goodies("Alternative '%s': Saving goodies '%s'",alternative,e) + report_goodies("alternative '%s': saving goodies '%s'",alternative,e) end if not g then g = { } @@ -137,7 +137,7 @@ local function selectfont_savefile(data,alternative,bodyfontsize,size,file) end a[bodyfontsize] = { size, n } if trace_files then - report_files("Alternative '%s': Saving file '%s' for size '%s'",alternative,n,size) + report_files("alternative '%s': saving file '%s' for size '%s'",alternative,n,size) end end @@ -145,7 +145,7 @@ methods["name"] = function(data,alternative,name) local family = data.metadata.family local filename = cleanname(gsub(name,"*",family)) if trace_alternatives then - report_selectfont("Alternative '%s': Using method 'name' with argument '%s'",alternative,filename) + report_selectfont("alternative '%s': using method 'name' with argument '%s'",alternative,filename) end local fontname = getlookups{ fontname = filename } local fullname = getlookups{ fullname = filename } @@ -155,7 +155,7 @@ methods["name"] = function(data,alternative,name) selectfont_savefile(data,alternative,0,"default",fullname[1]) else if trace_alternatives then - report_selectfont("Alternative '%s': No font was found for the requested name '%s'",alternative,filename) + report_selectfont("alternative '%s': no font was found for the requested name '%s'",alternative,filename) end end end @@ -164,14 +164,14 @@ methods["file"] = function(data,alternative,file) local family = data.metadata.family local filename = cleanname(gsub(removesuffix(file),"*",family)) if trace_alternatives then - report_selectfont("Alternative '%s': Using method 'file' with argument '%s'",alternative,filename) + report_selectfont("alternative '%s': using method 'file' with argument '%s'",alternative,filename) end local filename = getlookups{ cleanfilename = cleanname(filename) } if #filename > 0 then selectfont_savefile(data,alternative,0,"default",filename[1]) else if trace_alternatives then - report_selectfont("Alternative '%s': No font was found for the requested file '%s'",alternative,cleanname(gsub(removesuffix(file),"*",family))) + report_selectfont("alternative '%s': no font was found for the requested file '%s'",alternative,cleanname(gsub(removesuffix(file),"*",family))) end end end @@ -243,7 +243,7 @@ local function m_style_family(family) return family elseif #fontname > 0 then local fontfamily = fontname[1]["familyname"] - report_selectfont("The name '%s' is not a proper family name, use '%s' instead.",askedname,fontfamily) + report_selectfont("the name '%s' is not a proper family name, use '%s' instead.",askedname,fontfamily) return nil else return nil @@ -353,7 +353,7 @@ local function m_style_size(data,alternative,entries) end else if trace_alternatives then - report_selectfont("Alternative '%s': Multiple files are available for the requested style '%s' from '%s'",alternative,style,family) + report_selectfont("alternative '%s': multiple files are available for the requested style '%s' from '%s'",alternative,style,family) end end end @@ -386,7 +386,7 @@ methods["style"] = function(data,alternative,style) m_style_size(data,alternative,entries) else if trace_alternatives then - report_selectfont("Alternative '%s': No font was found for the requested style '%s' from '%s'",alternative,style,family) + report_selectfont("alternative '%s': no font was found for the requested style '%s' from '%s'",alternative,style,family) end end end @@ -394,21 +394,21 @@ end methods[v_default] = function(data,alternative) local family = data.metadata.family if trace_alternatives then - report_selectfont("Alternative '%s': Using method 'default'",alternative) + report_selectfont("alternative '%s': using method 'default'",alternative) end local result = getlookups{ familyname = cleanname(family) } if #result == 1 and alternative == "tf" then if trace_alternatives then - report_selectfont("Alternative '%s': The family '%s' contains only one font",alternative,family) + report_selectfont("alternative '%s': the family '%s' contains only one font",alternative,family) end selectfont_savefile(data,alternative,0,"default",result[1]) -- if trace_alternatives then - -- report_selectfont("Alternative '%s': Changing method 'default' to method 'style'",alternative) + -- report_selectfont("alternative '%s': changing method 'default' to method 'style'",alternative) -- end -- methods["file"](data,alternative,result[1]["filename"]) else if trace_alternatives then - report_selectfont("Alternative '%s': Changing method 'default' to method 'style'",alternative) + report_selectfont("alternative '%s': changing method 'default' to method 'style'",alternative) end methods["style"](data,alternative,alternative) end @@ -478,7 +478,7 @@ function selectfont.registerfontalternative(alternative) local a = alternatives[alternative] if not a then if trace_register then - report_selectfont("Register alternative '%s'",alternative) + report_selectfont("register alternative '%s'",alternative) end a = true alternatives[alternative] = a @@ -598,23 +598,23 @@ function selectfont.fontsynonym(data,class,style,alternative,index) local fontfallback = formatters["fallback-%s-%s-%s"](fontclass,style,alternative) for _, fontsize in next, fontsizes do -- if trace_typescript then - -- report_typescript("Synonym: '%s', Size: '%s', File: '%s'",fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2]) + -- report_typescript("synonym: '%s', size: '%s', file: '%s'",fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2]) -- end registerdesignsizes(fontfile,fontfiles[fontsize][1],fontfiles[fontsize][2]) end if fallback then -- if trace_typescript then - -- report_typescript("Synonym: '%s', File: '%s', Features: '%s'",fontsynonym,fontfile,fontfeature) + -- report_typescript("synonym: '%s', file: '%s', features: '%s'",fontsynonym,fontfile,fontfeature) -- end ctx_definefontsynonym( { fontsynonym }, { fontfile }, { features = fontfeature } ) else -- if trace_typescript then - -- report_typescript("Synonym: '%s', File: '%s', Features: '%s', Goodies: '%s', Fallbacks: '%s'",fontsynonym,fontfile,fontfeature,fontgoodie,fontfallback) + -- report_typescript("synonym: '%s', file: '%s', features: '%s', goodies: '%s', fallbacks: '%s'",fontsynonym,fontfile,fontfeature,fontgoodie,fontfallback) -- end ctx_definefontsynonym( { fontsynonym }, { fontfile }, { features = fontfeature, goodies = fontgoodie, fallbacks = fontfallback } ) if synonym then -- if trace_typescript then - -- report_typescript("Synonym: '%s', File: '%s'",synonym,fontsynonym) + -- report_typescript("synonym: '%s', file: '%s'",synonym,fontsynonym) -- end ctx_definefontsynonym( { synonym }, { fontsynonym } ) end @@ -628,13 +628,13 @@ function selectfont.fontfallback(data,class,style,alternative,index) local force = data.options.force ~= "" and data.options.force or "" local fontfeature = data.features and data.features[alternative] or data.options.features local fontclass = lower(class) - local fontsynonym = formatters ["synonym-%s-%s-%s-%s"](fontclass,style,alternative,index) - local fontfallback = formatters["fallback-%s-%s-%s"] (fontclass,style,alternative) + local fontsynonym = formatters["synonym-%s-%s-%s-%s"](fontclass,style,alternative,index) + local fontfallback = formatters["fallback-%s-%s-%s"] (fontclass,style,alternative) if index == 1 then ctx_resetfontfallback( { fontfallback } ) end -- if trace_typescript then - -- report_typescript("Fallback: '%s', Synonym: '%s', Range: '%s', Scale: '%s', Check: '%s', Force: '%s'",fontfallback,fontsynonym,range,scale,check,force) + -- report_typescript("fallback: '%s', synonym: '%s', range: '%s', scale: '%s', check: '%s', force: '%s'",fontfallback,fontsynonym,range,scale,check,force) -- end ctx_definefontfallback( { fontfallback }, { fontsynonym }, { range }, { rscale = scale, check = check, force = force } ) end @@ -653,7 +653,7 @@ function selectfont.filefallback(data,class,style,alternative,index) ctx_resetfontfallback( { fontfallback } ) end -- if trace_typescript then - -- report_typescript("Fallback: '%s', File: '%s', Features: '%s', Range: '%s', Scale: '%s', Check: '%s', Force: '%s', Offset: '%s'",fontfallback,fontfile[2],fontfeature,range,scale,check,force,offset) + -- report_typescript("fallback: '%s', file: '%s', features: '%s', range: '%s', scale: '%s', check: '%s', force: '%s', offset: '%s'",fontfallback,fontfile[2],fontfeature,range,scale,check,force,offset) -- end ctx_definefontfallback( { fontfallback }, { formatters["file:%s*%s"](fontfile[2],fontfeature) }, { range }, { rscale = scale, check = check, force = force, offset = offset } ) end @@ -737,7 +737,7 @@ function selectfont.bodyfont(data) fontsynonym = formatters["synonym-%s-%s-%s"](fontclass,fontstyle,alternative) fontlist[#fontlist+1] = formatters["%s=%s sa 1"] (alternative,fontsynonym) -- if trace_typescript then - -- report_typescript("Alternative '%s': Synonym '%s'",alternative,fontsynonym) + -- report_typescript("alternative '%s': synonym '%s'",alternative,fontsynonym) -- end end fontlist = concat(fontlist,",") @@ -760,7 +760,7 @@ function selectfont.typeface(data) local size = data.options.designsize ~= "" and data.options.designsize or "default" local scale = data.options.rscale ~= "" and data.options.rscale or 1 -- if trace_typescript then - -- report_typescript("Class: '%s', Style: '%s', Size: '%s', Scale: '%s'",fontclass,fontstyle,size,scale) + -- report_typescript("class: '%s', style: '%s', size: '%s', scale: '%s'",fontclass,fontstyle,size,scale) -- end ctx_definetypeface( { fontclass }, { fontstyle }, { style }, { "" }, { "default" }, { designsize = size, rscale = scale } ) end @@ -770,7 +770,7 @@ function selectfont.default(data) local fontclass = data.metadata.typeface local fontstyle = data.metadata.style local style = m_style[fontstyle] - report_selectfont("The requested font '%s' has no files for the 'tf' alternative, Latin Modern is used instead.",family) + report_selectfont("the requested font '%s' has no files for the 'tf' alternative, Latin Modern is used instead.",family) ctx_definetypeface( { fontclass }, { fontstyle }, { style }, { "modern" }, { "default" } ) end @@ -799,7 +799,7 @@ function selectfont.definefallbackfamily(index) if fontfiles then selectfont.registerfallback(index) else - report_selectfont("The requested fallback font '%s' for typeface '%s' style '%s' was ignored because no files where found.",family,fontclass,fontstyle) + report_selectfont("the requested fallback font '%s' for typeface '%s' style '%s' was ignored because no files where found.",family,fontclass,fontstyle) end end diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua index e5a95fdab..e14968eb8 100644 --- a/tex/context/base/mkiv/lpdf-fld.lua +++ b/tex/context/base/mkiv/lpdf-fld.lua @@ -1003,17 +1003,17 @@ function nodeinjections.typesetfield(name,specification) end end -local function save_parent(field,specification,d,hasopt) +local function save_parent(field,specification,d) local kidsnum = pdfreserveobject() d.Kids = pdfreference(kidsnum) field.kidsnum = kidsnum field.kids = pdfarray() - if hasopt then - local optnum = pdfreserveobject() - d.Opt = pdfreference(optnum) - field.optnum = optnum - field.opt = pdfarray() - end +-- if d.Opt then +-- local optnum = pdfreserveobject() +-- d.Opt = pdfreference(optnum) +-- field.optnum = optnum +-- field.opt = pdfarray() +-- end local pnum = pdfflushobject(d) field.pobj = pnum collected[#collected+1] = pdfreference(pnum) @@ -1022,12 +1022,12 @@ end local function save_kid(field,specification,d,optname) local kn = pdfreserveobject() field.kids[#field.kids+1] = pdfreference(kn) - if optname then - local opt = field.opt - if opt then - opt[#opt+1] = optname - end - end +-- if optname then +-- local opt = field.opt +-- if opt then +-- opt[#opt+1] = optname +-- end +-- end local width = specification.width or 0 local height = specification.height or 0 local depth = specification.depth or 0 @@ -1243,7 +1243,7 @@ local function makecheckparent(field,specification) FT = pdf_btn, V = fielddefault(field,default), } - save_parent(field,specification,d,true) + save_parent(field,specification,d) end local function makecheckchild(name,specification) @@ -1371,7 +1371,7 @@ local function makeradioparent(field,specification) -- H = pdf_n, V = fielddefault(field), } - save_parent(field,specification,d,true) + save_parent(field,specification,d) end -- local function makeradiochild(name,specification) diff --git a/tex/context/base/mkiv/lxml-aux.lua b/tex/context/base/mkiv/lxml-aux.lua index ed0f03fd8..67ee31c88 100644 --- a/tex/context/base/mkiv/lxml-aux.lua +++ b/tex/context/base/mkiv/lxml-aux.lua @@ -176,7 +176,7 @@ local function xmltoelement(whatever,root) end local element if type(whatever) == "string" then - element = xmlinheritedconvert(whatever,root) -- beware, not really a root + element = xmlinheritedconvert(whatever,root,true) -- beware, not really a root else element = whatever -- we assume a table end @@ -430,10 +430,10 @@ local function include(xmldata,pattern,attribute,recursive,loaddata,level) -- for the moment hard coded epdt[ek.ni] = xml.escaped(data) -- d[k] = xml.escaped(data) else -local settings = xmldata.settings -local savedresource = settings.currentresource -settings.currentresource = name - local xi = xmlinheritedconvert(data,xmldata) + local settings = xmldata.settings + local savedresource = settings.currentresource + settings.currentresource = name + local xi = xmlinheritedconvert(data,xmldata,true) if not xi then epdt[ek.ni] = "" -- xml.empty(d,k) else @@ -443,7 +443,7 @@ settings.currentresource = name local child = xml.body(xi) -- xml.assign(d,k,xi) child.__p__ = ekrt child.__f__ = name -- handy for tracing -child.cf = name + child.cf = name epdt[ek.ni] = child local settings = xmldata.settings local inclusions = settings and settings.inclusions @@ -591,8 +591,44 @@ function xml.strip(root,pattern,nolines,anywhere) -- strips all leading and trai stripelement(collected[i],nolines,anywhere) end end +-- return root end +-- local function compactelement(e) +-- local edt = e.dt +-- if edt then +-- local t = { } +-- local m = 0 +-- for e=1,#edt do +-- local str = edt[e] +-- if type(str) ~= "string" then +-- m = m + 1 +-- t[m] = str +-- elseif str ~= "" and find(str,"%S") then +-- m = m + 1 +-- t[m] = str +-- end +-- end +-- e.dt = t +-- end +-- return e -- convenient +-- end + +local function compactelement(e) + local edt = e.dt + if edt then + for e=1,#edt do + local str = edt[e] + if type(str) == "string" and not find(str,"%S") then + edt[e] = "" + end + end + end + return e -- convenient +end + +xml.compactelement = compactelement + local function renamespace(root, oldspace, newspace) -- fast variant local ndt = #root.dt for i=1,ndt or 0 do diff --git a/tex/context/base/mkiv/lxml-lpt.lua b/tex/context/base/mkiv/lxml-lpt.lua index 5bcdfbabc..dc9964d0f 100644 --- a/tex/context/base/mkiv/lxml-lpt.lua +++ b/tex/context/base/mkiv/lxml-lpt.lua @@ -1317,6 +1317,8 @@ end -- return false -- end +-- could be a hashed hash + expressions.oneof = function(s,...) for i=1,select("#",...) do if s == select(i,...) then diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua index 8f6379f2f..1ef82d74d 100644 --- a/tex/context/base/mkiv/lxml-tab.lua +++ b/tex/context/base/mkiv/lxml-tab.lua @@ -1292,13 +1292,26 @@ end xml.convert = xmlconvert -function xml.inheritedconvert(data,xmldata) -- xmldata is parent +function xml.inheritedconvert(data,xmldata,cleanup) -- xmldata is parent local settings = xmldata.settings if settings then settings.parent_root = xmldata -- to be tested end -- settings.no_root = true local xc = xmlconvert(data,settings) -- hm, we might need to locate settings + if cleanup then + local x = xc.dt + if x then + x = x[1] + if x and x.tg == "@pi@" then + local dt = x.dt + local pi = dt and dt[1] + if type(pi) == "string" and find(pi,"^xml") then + remove(dt,1) + end + end + end + end -- xc.settings = nil -- xc.entities = nil -- xc.special = nil diff --git a/tex/context/base/mkiv/mlib-lmp.lua b/tex/context/base/mkiv/mlib-lmp.lua index f000f4282..cf7862d91 100644 --- a/tex/context/base/mkiv/mlib-lmp.lua +++ b/tex/context/base/mkiv/mlib-lmp.lua @@ -171,6 +171,7 @@ if CONTEXTLMTXMODE > 0 then data = io.loaddata(filename), remap = true, colormap = colormap, + id = filename, } ) else local buffer = metapost.getparameter { "buffer" } @@ -179,6 +180,7 @@ if CONTEXTLMTXMODE > 0 then data = buffers.getcontent(buffer), -- remap = true, colormap = colormap, + id = buffer or "buffer", } ) else local code = metapost.getparameter { "code" } @@ -186,6 +188,7 @@ if CONTEXTLMTXMODE > 0 then mpdirect ( metapost.svgtomp { data = code, colormap = colormap, + id = "code", } ) end end diff --git a/tex/context/base/mkiv/mlib-svg.lua b/tex/context/base/mkiv/mlib-svg.lua index 3d15840a7..9fd1da44e 100644 --- a/tex/context/base/mkiv/mlib-svg.lua +++ b/tex/context/base/mkiv/mlib-svg.lua @@ -80,7 +80,7 @@ local rawget, rawset, type, tonumber, tostring, next, setmetatable = rawget, raw local P, S, R, C, Ct, Cs, Cc, Cp, Cg, Cf, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cg, lpeg.Cf, lpeg.Carg local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns -local sqrt = math.sqrt +local sqrt, abs = math.sqrt, math.abs local concat, setmetatableindex, sortedhash = table.concat, table.setmetatableindex, table.sortedhash local gmatch, gsub, find, match, rep = string.gmatch, string.gsub, string.find, string.match, string.rep local formatters, fullstrip = string.formatters, string.fullstrip @@ -122,6 +122,7 @@ local trace = false trackers.register("metapost.svg", function(v) local trace_text = false trackers.register("metapost.svg.text", function(v) trace_text = v end) local trace_path = false trackers.register("metapost.svg.path", function(v) trace_path = v end) local trace_result = false trackers.register("metapost.svg.result", function(v) trace_result = v end) +local trace_colors = false trackers.register("metapost.svg.colors", function(v) trace_colors = v end) local pathtracer = { ["stroke"] = "darkred", @@ -428,7 +429,7 @@ end -- todo: cache colors per image / remapper -local colorcomponents, withcolor, thecolor do +local colorcomponents, withcolor, thecolor, usedcolors do local svgcolors = { aliceblue = 0xF0F8FF, antiquewhite = 0xFAEBD7, aqua = 0x00FFFF, aquamarine = 0x7FFFD4, @@ -476,7 +477,7 @@ local colorcomponents, withcolor, thecolor do local f_rgba = formatters['withcolor svgcolor(%.3N,%.3N,%.3N) withtransparency (1,%.3N)'] local f_graya = formatters['withcolor svggray(%.3N) withtransparency (1,%.3N)'] local f_name = formatters['withcolor "%s"'] - local f_svgcolor = formatters['svgcolor(%.3N,%.3N,%.3N)'] + local f_svgrgb = formatters['svgcolor(%.3N,%.3N,%.3N)'] local f_svgcmyk = formatters['svgcmyk(%.3N,%.3N,%.3N,%.3N)'] local f_svggray = formatters['svggray(%.3N)'] local f_svgname = formatters['"%s"'] @@ -510,7 +511,7 @@ local colorcomponents, withcolor, thecolor do * p_separator^0 * p_absolute^0 * p_right - local colors = attributes.colors + local colors = attributes.colors local colorvalues = colors.values local colorindex = attributes.list[attributes.private('color')] local hsvtorgb = colors.hsvtorgb @@ -559,7 +560,6 @@ local colorcomponents, withcolor, thecolor do end end - local function registeredcolor(name) local color = colorindex[name] if color then @@ -580,6 +580,9 @@ local colorcomponents, withcolor, thecolor do -- we can have a fast check for #000000 local function validcolor(color) + if usedcolors then + usedcolors[color] = usedcolors[color] + 1 + end if colormap then local c = colormap[color] local t = type(c) @@ -1920,7 +1923,7 @@ do -- -- todo: combine more (offset+scale+rotation) - local function makemarker(where,c,x1,y1,x2,y2,x3,y3) + local function makemarker(where,c,x1,y1,x2,y2,x3,y3,parentat) local at = c.at local refx = rawget(at,"refX") local refy = rawget(at,"refY") @@ -1929,8 +1932,8 @@ do local view = rawget(at,"viewBox") local orient = rawget(at,"orient") -- local ratio = rawget(at,"preserveAspectRatio") - local units = at["markerUnits"] - local height = at["markerHeight"] + local units = asnumber(at["markerUnits"] or parentat["stroke-width"]) or 1 + local angx = 0 local angy = 0 local angle = 0 @@ -1938,38 +1941,33 @@ do if where == "beg" then if orient == "auto" then -- unchecked -- no angle - angx = x2 - x3 - angy = y2 - y3 + angx = abs(x2 - x3) + angy = abs(y2 - y3) elseif orient == "auto-start-reverse" then -- checked -- points to start - angx = x3 - x2 - angy = y3 - y2 + angx = -abs(x2 - x3) + angy = -abs(y2 - y3) elseif orient then -- unchecked angle = asnumber_r(orient) end elseif where == "end" then - if orient == "auto" then -- unchecked - -- no angle ? - angx = x1 - x2 - angy = y1 - y2 - elseif orient == "auto-start-reverse" then -- unchecked - -- points to end - angx = x2 - x1 - angy = y2 - y1 + -- funny standard .. bug turned feature? + if orient == "auto" or orient == "auto-start-reverse" then + angx = abs(x1 - x2) + angy = abs(y1 - y2) elseif orient then -- unchecked angle = asnumber_r(orient) end elseif orient then -- unchecked angle = asnumber_r(orient) end - -- what wins: viewbox or w/h refx = asnumber_x(refx) refy = asnumber_y(refy) - width = width and asnumber_x(width) or 3 -- defaults - height = height and asnumber_y(height) or 3 -- defaults + width = (width and asnumber_x(width) or 3) * units + height = (height and asnumber_y(height) or 3) * units local x = 0 local y = 0 @@ -2058,27 +2056,29 @@ do end - local function addmarkers(list,begmarker,midmarker,endmarker) + -- do we need to metatable the attributes here? + + local function addmarkers(list,begmarker,midmarker,endmarker,at) local n = #list if n > 3 then if begmarker then local m = locate(begmarker) if m then - makemarker("beg",m,false,false,list[1],list[2],list[3],list[4]) + makemarker("beg",m,false,false,list[1],list[2],list[3],list[4],at) end end if midmarker then local m = locate(midmarker) if m then for i=3,n-2,2 do - makemarker("mid",m,list[i-2],list[i-1],list[i],list[i+1],list[i+2],list[i+3]) + makemarker("mid",m,list[i-2],list[i-1],list[i],list[i+1],list[i+2],list[i+3],at) end end end if endmarker then local m = locate(endmarker) if m then - makemarker("end",m,list[n-3],list[n-2],list[n-1],list[n],false,false) + makemarker("end",m,list[n-3],list[n-2],list[n-1],list[n],false,false,at) end end else @@ -2148,7 +2148,7 @@ do r = r + 1 ; result[r] = etransform or ";" -- if list then - addmarkers(list,begmarker,midmarker,endmarker) + addmarkers(list,begmarker,midmarker,endmarker,at) end -- if wrapup then @@ -2285,7 +2285,6 @@ do local btransform, etransform = handletransform(at) local cpath = handleclippath(at) - if cpath then r = r + 1 ; result[r] = s_clip_start end @@ -2380,7 +2379,7 @@ do r = r + 1 ; result[r] = ";" end if list then - addmarkers(list,begmarker,midmarker,endmarker) + addmarkers(list,begmarker,midmarker,endmarker,at) end r = r + 1 ; result[r] = etransform or ") ;" end @@ -2949,6 +2948,7 @@ do tagstyles = { } classstyles = { } colormap = specification.colormap + usedcolors = trace_colors and setmetatableindex("number") or false for s in xmlcollected(c,"style") do -- can also be in a def, so let's play safe handlestyle(c) end @@ -2968,6 +2968,9 @@ do if trace_result then report("result graphic:\n %\n t",result) end + if usedcolors and next(usedcolors) then + report("graphic %a uses colors: %s",specification.id or "unknown",table.sequenced(usedcolors)) + end mps = concat(result," ") root = false result = false diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 279de60e2..e1a37260b 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -179,6 +179,7 @@ return { "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", + "Umathspacingmode", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", @@ -246,6 +247,7 @@ return { "crampedscriptstyle", "crampedtextstyle", "csstring", + "directlua", "efcode", "endlocalcontrol", "etoksapp", @@ -265,6 +267,7 @@ return { "gleaders", "glet", "glyphdatafield", + "glyphdimensionsmode", "gtoksapp", "gtokspre", "hjcode", @@ -295,7 +298,6 @@ return { "internalcodesmode", "lastnamedcs", "lastnodesubtype", - "leftghost", "leftmarginkern", "letcharcode", "letfrozen", @@ -353,7 +355,6 @@ return { "protrusionboundary", "pxdimen", "quitvmode", - "rightghost", "rightmarginkern", "rpcode", "savecatcodetable", @@ -540,7 +541,6 @@ return { "delimitershortfall", "dimen", "dimendef", - "directlua", "discretionary", "displayindent", "displaylimits", diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua index 1b245639b..3b8bf0586 100644 --- a/tex/context/base/mkiv/node-fnt.lua +++ b/tex/context/base/mkiv/node-fnt.lua @@ -45,13 +45,12 @@ local nuts = nodes.nuts local getid = nuts.getid local getsubtype = nuts.getsubtype -local getdisc = nuts.getdisc +local getreplace = nuts.getreplace local getnext = nuts.getnext local getprev = nuts.getprev local getboth = nuts.getboth local getdata = nuts.getdata local getglyphdata = nuts.getglyphdata ------ getdisc = nuts.getdisc local setchar = nuts.setchar local setlink = nuts.setlink @@ -142,34 +141,11 @@ fonts.hashes.processes = fontprocesses -- we need to deal with the basemode fonts here and can only run over ranges as we -- otherwise get luatex craches due to all kind of asserts in the disc/lig builder +-- there is no gain in merging used (dynamic 0) and dynamics apart from a bit less code + local ligaturing = nuts.ligaturing local kerning = nuts.kerning --- -- -- this will go away --- --- local disccodes = nodes.disccodes --- local explicitdisc_code = disccodes.explicit --- local automaticdisc_code = disccodes.automatic --- local expanders = nil --- --- function fonts.setdiscexpansion(v) --- if v == nil or v == true then --- expanders = languages and languages.expanders --- elseif type(v) == "table" then --- expanders = v --- else --- expanders = false --- end --- end --- --- function fonts.getdiscexpansion() --- return expanders and true or false --- end --- --- fonts.setdiscexpansion(true) --- --- -- -- till here - local function start_trace(head) run = run + 1 report_fonts() @@ -193,19 +169,15 @@ local function start_trace(head) end end -local function stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders) +local function stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant) report_fonts() report_fonts("statics : %s",u > 0 and concat(keys(usedfonts)," ") or "none") report_fonts("dynamics: %s",a > 0 and concat(keys(attrfonts)," ") or "none") report_fonts("built-in: %s",b > 0 and b or "none") report_fonts("removed : %s",r > 0 and r or "none") - -- if expanders then - -- report_fonts("expanded: %s",e > 0 and e or "none") - -- end report_fonts() end - do local usedfonts @@ -221,7 +193,7 @@ do local lastproc local lastnone - local a, u, b, r, e + local a, u, b, r local function protectnone() protect_glyphs(firstnone,lastnone) @@ -307,7 +279,7 @@ do lastproc = nil lastnone = nil - a, u, b, r, e = 0, 0, 0, 0, 0 + a, u, b, r = 0, 0, 0, 0 if trace_fontrun then start_trace(head) @@ -425,7 +397,6 @@ do end if force_discrun then - -- basefont is not supported in disc only runs ... it would mean a lot of -- ranges .. we could try to run basemode as a separate processor run but -- not for now (we can consider it when the new node code is tested @@ -433,7 +404,7 @@ do -- we could use first_glyph, only doing replace is good enough because -- pre and post are normally used for hyphens and these come from fonts -- that part of the hyphenated word - local _, _, r = getdisc(d) + local r = getreplace(d) if r then local prevfont = nil local prevattr = nil @@ -465,19 +436,13 @@ do if firstnone then protectnone() end - -- elseif expanders then - -- local subtype = getsubtype(d) - -- if subtype == automaticdisc_code or subtype == explicitdisc_code then - -- expanders[subtype](d) - -- e = e + 1 - -- end end end end if trace_fontrun then - stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders) + stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant) end -- in context we always have at least 2 processors diff --git a/tex/context/base/mkiv/pack-com.mkiv b/tex/context/base/mkiv/pack-com.mkiv index fe622509a..28a3495d4 100644 --- a/tex/context/base/mkiv/pack-com.mkiv +++ b/tex/context/base/mkiv/pack-com.mkiv @@ -360,7 +360,7 @@ \to \everydefinecombination \def\pack_combinations_pickup - {\dostarttagged\t!combinationpair\empty + {\dostarttagged\t!combinationpair\empty % better make this text \dostarttagged\t!combinationcontent\empty \assumelongusagecs\pack_combinations_pickup_content_indeed} diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index 8732c7e6b..ba81a0956 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -1542,7 +1542,7 @@ \d_framed_linewidth \fi \ifconditional\c_framed_has_offset - \advance\d_framed_applied_offset\localoffset + \advance\d_framed_applied_offset\localoffset\relax \fi \ifconditional\c_framed_has_extra_offset \pack_framed_apply_extra_offsets % includes \d_framed_applied_offset diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl index 8fd23fbb1..2bd768bd0 100644 --- a/tex/context/base/mkiv/pack-rul.mkxl +++ b/tex/context/base/mkiv/pack-rul.mkxl @@ -247,7 +247,7 @@ \s!depth \d_framed_target_dp \relax} -\def\pack_framed_filled_box_radius +\def\ntg-context@ntg.nllled_box_radius {\edef\p_framed_backgroundradius{\framedparameter\c!backgroundradius}% \ifzeropt\dimexpr\p_framed_backgroundradius\relax % just in case of .x\bodyfontsize \pack_framed_filled_box_normal @@ -1557,7 +1557,7 @@ \d_framed_linewidth \fi \ifconditional\c_framed_has_offset - \advance\d_framed_applied_offset\localoffset + \advance\d_framed_applied_offset\localoffset\relax \fi \ifconditional\c_framed_has_extra_offset \pack_framed_apply_extra_offsets % includes \d_framed_applied_offset diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 01dde89ff..0da4c936e 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 105405cc4..f96735f78 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 0dd1fe29c..3e71e0893 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -1174,4 +1174,10 @@ \let\eTeXglueshrinkorder \undefined \let\eTeXgluestretchorder\undefined +%D Experiment: + +\ifdefined\glyphdimensionsmode \else \newcount\glyphdimensionsmode \fi + +\glyphdimensionsmode\plusone + \protect \endinput diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl index 9394807c8..3a6deab9a 100644 --- a/tex/context/base/mkiv/syst-ini.mkxl +++ b/tex/context/base/mkiv/syst-ini.mkxl @@ -1113,4 +1113,10 @@ \chardef\eTeXversion 2 \def \eTeXrevision {2} +%D Experiment: + +\ifdefined\glyphdimensionsmode \else \newcount\glyphdimensionsmode \fi + +\glyphdimensionsmode\plusone + \protect \endinput diff --git a/tex/context/base/mkiv/tabl-ntb.mkiv b/tex/context/base/mkiv/tabl-ntb.mkiv index 8ff02330a..836ba5129 100644 --- a/tex/context/base/mkiv/tabl-ntb.mkiv +++ b/tex/context/base/mkiv/tabl-ntb.mkiv @@ -243,12 +243,18 @@ \tabl_ntb_next_level % go to level 1 +%D This is for the special cases where for instance a table is in a header or footer +%D line and we have a split table in progress. (See mail to list from Taco.) + \installcorenamespace{naturaltable} % was tbl \installcorenamespace{naturaltablelocal} % was tbltbl \installdirectcommandhandler \??naturaltable {naturaltable} % \??naturaltable \installsimpleframedcommandhandler \??naturaltablelocal {naturaltablelocal} \??naturaltablelocal +\unexpanded\def\bTABLEnested{\tabl_ntb_next_level\bTABLE} +\unexpanded\def\eTABLEnested{\eTABLE\tabl_ntb_prev_level} + \installcorenamespace{naturaltabletal} \installcorenamespace{naturaltablegal} \installcorenamespace{naturaltablenob} diff --git a/tex/context/base/mkiv/tabl-ntb.mkxl b/tex/context/base/mkiv/tabl-ntb.mkxl index 6b84411b2..adabc3139 100644 --- a/tex/context/base/mkiv/tabl-ntb.mkxl +++ b/tex/context/base/mkiv/tabl-ntb.mkxl @@ -247,6 +247,9 @@ \installdirectcommandhandler \??naturaltable {naturaltable} % \??naturaltable \installsimpleframedcommandhandler \??naturaltablelocal {naturaltablelocal} \??naturaltablelocal +\unexpanded\def\bTABLEnested{\tabl_ntb_next_level\bTABLE} +\unexpanded\def\eTABLEnested{\eTABLE\tabl_ntb_prev_level} + \installcorenamespace{naturaltabletal} \installcorenamespace{naturaltablegal} \installcorenamespace{naturaltablenob} -- cgit v1.2.3