diff options
Diffstat (limited to 'tex')
24 files changed, 465 insertions, 148 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 1d505a4c9..d5ddbb215 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index b12247546..82142910b 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -38,7 +38,7 @@ local sub, gsub = string.sub, string.gsub local validstring = string.valid local lpegmatch = lpeg.match local utfchar, utfvalues = utf.char, utf.values -local concat, insert, remove, merge = table.concat, table.insert, table.remove, table.merge +local concat, insert, remove, merge, sort = table.concat, table.insert, table.remove, table.merge, table.sort local sortedhash = table.sortedhash local formatters = string.formatters local todimen = number.todimen @@ -71,6 +71,8 @@ local v_hidden = variables.hidden local implement = interfaces.implement +local included = backends.included + local settings_to_array = utilities.parsers.settings_to_array local setmetatableindex = table.setmetatableindex @@ -604,7 +606,9 @@ do setattribute(di,"language",languagenames[texgetcount("mainlanguagenumber")]) if not less_state then setattribute(di,"file",tex.jobname) - setattribute(di,"date",os.date()) + if included.date then + setattribute(di,"date",backends.timestamp()) + end setattribute(di,"context",environment.version) setattribute(di,"version",exportversion) setattribute(di,"xmlns:m",mathmlns) @@ -771,7 +775,7 @@ do function finalizers.descriptions(tree) local n = 0 - for id, tag in next, descriptions do + for id, tag in sortedhash(descriptions) do local sym = symbols[id] if sym then n = n + 1 @@ -1858,16 +1862,26 @@ do local f_metadata = formatters["%w<metavariable name=%q>%s</metavariable>\n"] local f_metadata_end = formatters["%w</metadata>\n"] - --- we could share the r tables ... but it's fast enough anyway - local function attributes(a) - local r = { } -- can be shared + local r = { } local n = 0 for k, v in next, a do n = n + 1 r[n] = f_attribute(k,v) -- lpegmatch(p_escaped,v) end - return concat(r,"",1,n) + sort(r) + return concat(r,"") + end + + local function properties(a) + local r = { } + local n = 0 + for k, v in next, a do + n = n + 1 + r[n] = f_property(exportproperties,k,v) + end + sort(r) + return concat(r,"") end local depth = 0 @@ -1959,23 +1973,15 @@ do if not p then -- skip elseif exportproperties == v_yes then - for k, v in next, p do - n = n + 1 - r[n] = f_attribute(k,v) - end + r[n] = attributes(p) else - for k, v in next, p do - n = n + 1 - r[n] = f_property(exportproperties,k,v) - end + r[n] = properties(p) end end local a = di.attributes if a then - for k, v in next, a do - n = n + 1 - r[n] = f_attribute(k,v) - end + n = n + 1 + r[n] = attributes(a) end if n == 0 then if nature == "inline" or inline > 0 then @@ -2227,7 +2233,7 @@ do for i=2,#trees do local currenttree = trees[i] local currentdata = currenttree.data - local currentpar = currenttree.parnumber + local currentpar = currenttree.parnumber local previouspar = trees[i-1].parnumber currenttree.collapsed = true -- is the next ok? @@ -2905,7 +2911,7 @@ local xmlpreamble = [[ return replacetemplate(xmlpreamble, { standalone = standalone and "yes" or "no", filename = tex.jobname, - date = os.date(), + date = included.date and backends.timestamp(), contextversion = environment.version, exportversion = exportversion, }) @@ -3156,40 +3162,50 @@ local htmltemplate = [[ end) local function makeclass(tg,at) - local detail = at.detail - local chain = at.chain - local result - at.detail = nil - at.chain = nil + local detail = at.detail + local chain = at.chain + local extra = nil + local classes = { } + local nofclasses = 0 + at.detail = nil + at.chain = nil + for k, v in next, at do + if not private[k] then + nofclasses = nofclasses + 1 + classes[nofclasses] = k .. "-" .. v + end + end if detail and detail ~= "" then if chain and chain ~= "" then if chain ~= detail then - result = { classes[tg .. " " .. chain .. " " .. detail] } -- we need to remove duplicates + extra = classes[tg .. " " .. chain .. " " .. detail] elseif tg ~= detail then - result = { tg, detail } - else - result = { tg } + extra = detail end elseif tg ~= detail then - result = { tg, detail } - else - result = { tg } + extra = detail end elseif chain and chain ~= "" then if tg ~= chain then - result = { tg, chain } + extra = chain + end + end + -- in this order + if nofclasses > 0 then + sort(classes) + classes = concat(classes," ") + if extra then + return tg .. " " .. extra .. " " .. classes else - result = { tg } + return tg .. " " .. classes end else - result = { tg } - end - for k, v in next, at do - if not private[k] then - result[#result+1] = k .. "-" .. v + if extra then + return tg .. " " .. extra + else + return tg end end - return concat(result, " ") end local function remap(specification,source,target) diff --git a/tex/context/base/mkiv/back-ini.lua b/tex/context/base/mkiv/back-ini.lua index e8af4d9d9..fc0074540 100644 --- a/tex/context/base/mkiv/back-ini.lua +++ b/tex/context/base/mkiv/back-ini.lua @@ -120,3 +120,22 @@ interfaces.implement { nodes.tasks.setaction("shipouts","nodes.handlers.accessibility",v == interfaces.variables.yes) end } + +-- moved to here + +local included = table.setmetatableindex( { + context = true, + id = true, + metadata = true, + date = true, + id = true, + pdf = true, +}, function(t,k) + return true +end) + +backends.included = included + +function backends.timestamp() + return os.date("%Y-%m-%dT%X") .. os.timezone(true) +end diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua index c1b04abfa..3e0d02bc1 100644 --- a/tex/context/base/mkiv/char-tex.lua +++ b/tex/context/base/mkiv/char-tex.lua @@ -591,7 +591,8 @@ if not csletters then elseif is_mark[category] then texsetlccode(u,u,u) -- for hyphenation end - elseif isletter and u >= 32 and u <= 65536 then + -- elseif isletter and u >= 32 and u <= 65536 then + elseif isletter then csletters[utfchar(u)] = u -- local lc, uc = chr.lccode, chr.uccode diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 92a4ad6e8..7a4ffd2d3 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.09.09 08:21} +\newcontextversion{2016.09.12 08:13} %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 67664a557..c2a273351 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.09.09 08:21} +\edef\contextversion{2016.09.12 08:13} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 1c81e5e22..cd2816893 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -1933,7 +1933,7 @@ function readers.gdef(f,fontdata,specification) end end -- mark sets : todo: just make the same as class sets above - if marksetsoffset then + if marksetsoffset and marksetsoffset > tableoffset then -- zero offset means no table setposition(f,marksetsoffset) local format = readushort(f) if format == 1 then @@ -1942,7 +1942,6 @@ function readers.gdef(f,fontdata,specification) for i=1,nofsets do sets[i] = readulong(f) end - -- somehow this fails on e.g. notosansethiopic-bold.ttf for i=1,nofsets do local offset = sets[i] if offset ~= 0 then diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index a9910e0c9..f12625c46 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -249,7 +249,7 @@ % liga=yes, % makes no sense % tlig=yes, % makes no sense % trep=yes, % makes no sense - mathnolimitsmode={0,750}, % this looks okay on the average font + mathnolimitsmode={0,800}, % this looks okay on the average font mathalternates=yes, mathitalics=yes, % we pass them % mathgaps=yes, diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index f395a32f9..18d29774b 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -1018,7 +1018,7 @@ end do - local timestamp = os.date("%Y-%m-%dT%X") .. os.timezone(true) + local timestamp = backends.timestamp() function lpdf.timestamp() return timestamp @@ -1029,7 +1029,7 @@ do n = converters.totime(n) if n then converters.settime(n) - timestamp = os.date("%Y-%m-%dT%X",os.time(n)) .. os.timezone(true) + timestamp = backends.timestamp() end end return timestamp diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua index c8b86d384..4dd2e72f2 100644 --- a/tex/context/base/mkiv/lpdf-xmp.lua +++ b/tex/context/base/mkiv/lpdf-xmp.lua @@ -94,16 +94,7 @@ pdf.setsuppressoptionalinfo( -- + 512 -- pdfnoid ) -local included = table.setmetatableindex( { - context = true, - id = true, - metadata = true, - date = true, - id = true, - pdf = true, -}, function(t,k) - return true -end) +local included = backends.included function lpdf.settrailerid(v) if v then diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv index b77af6383..d57a0b955 100644 --- a/tex/context/base/mkiv/math-ali.mkiv +++ b/tex/context/base/mkiv/math-ali.mkiv @@ -230,12 +230,9 @@ \def\math_handle_eqalign_no_l_aligned{\math_both_eqalign_no_aligned\math_prepare_l_eqalign_no} \def\math_finish_eqalign_no {\crcr\egroup} -\let \reqalignno \math_handle_eqalign_no_r_normal -\let \leqalignno \math_handle_eqalign_no_l_normal -\let\alignreqalignno \math_handle_eqalign_no_r_aligned -\let\alignleqalignno \math_handle_eqalign_no_l_aligned -\let \eqalignno \math_handle_eqalign_no_r_normal -\let \aligneqalignno \math_handle_eqalign_no_r_aligned +\let\reqalignno\relax +\let\leqalignno\relax +\let\eqalignno \relax %D Here we implement the user interface part. We start with basic math alignments: @@ -245,8 +242,7 @@ \def\math_alignment_NC_first#1\NR {\glet\math_alignment_NC\math_alignment_NC_rest - %\scratchtoks{\math_number_left_of_eqalign\aligntab#1\NR}% - \scratchtoks{\aligntab#1\NR}% + \scratchtoks{\math_number_left_of_eqalign\aligntab#1\NR}% \math_number_left_of_eqalign not used yet \dodoubleempty\math_alignment_NC_first_indeed} \def\math_alignment_NC_first_indeed[#1][#2]% @@ -395,19 +391,27 @@ \ifcase\lastnamedcs \or \hfill \or \relax \or \hfill \fi \fi} +\newconditional\c_math_alignment_local_number % not used but when true puts in front (todo) + \def\math_number_right_of_eqalign {\ifcase\wd\b_strc_formulas_number\else - \ifcase\c_strc_math_number_location\or\or + \ifconditional\c_math_alignment_local_number + \ifcase\c_strc_math_number_location\or\or + \box\b_strc_formulas_number + \fi + \else \box\b_strc_formulas_number \fi \fi} -% \def\math_number_left_of_eqalign -% {\ifcase\wd\b_strc_formulas_number\else -% \ifcase\c_strc_math_number_location\or -% \box\b_strc_formulas_number -% \fi -% \fi} +\def\math_number_left_of_eqalign + {\ifcase\wd\b_strc_formulas_number\else + \ifconditional\c_math_alignment_local_number + \ifcase\c_strc_math_number_location\or + \box\b_strc_formulas_number + \fi + \fi + \fi} \def\math_eqalign_set_column#1% we could just add to the preamble (as with other alignments) {\expandafter\let\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\endcsname diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua index 19abe1bcd..299bcc0dd 100644 --- a/tex/context/base/mkiv/mult-fun.lua +++ b/tex/context/base/mkiv/mult-fun.lua @@ -94,7 +94,7 @@ return { -- "pushcurrentpicture", "popcurrentpicture", -- - "arrowpath", + "arrowpath", "resetarrows", -- "colorlike", "dowithpath", "rangepath", "straightpath", "addbackground", -- "cleanstring", "asciistring", "setunstringed", "getunstringed", "unstringed", -- "showgrid", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 422b93537..ab7944b82 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 726f5ef16..a490ae3e4 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/typo-krn.lua b/tex/context/base/mkiv/typo-krn.lua index 5a42caeca..6a2aed9a2 100644 --- a/tex/context/base/mkiv/typo-krn.lua +++ b/tex/context/base/mkiv/typo-krn.lua @@ -102,7 +102,8 @@ typesetters.kerns = typesetters.kerns or { } local kerns = typesetters.kerns local report = logs.reporter("kerns") -local trace_ligatures = false trackers.register("typesetters.kerns.ligatures",function(v) trace_ligatures = v end) +local trace_ligatures = false trackers.register("typesetters.kerns.ligatures", function(v) trace_ligatures = v end) +local trace_ligatures_d = false trackers.register("typesetters.kerns.ligatures.detail",function(v) trace_ligatures_d = v end) -- use_advance is just an experiment: it makes copying glyphs (instead of new_glyph) dangerous @@ -144,18 +145,24 @@ function kerns.keepligature(n) -- might become default local c = getchar(n) local d = fontdescriptions[f][c].name if a > 0 and contextsetups[a].keepligatures == v_auto then - report("font %!font:name!, glyph %a, slot %X -> ligature %s, by %s feature %a",f,d,c,"kept","dynamic","keepligatures") + if trace_ligatures_d then + report("font %!font:name!, glyph %a, slot %X -> ligature %s, by %s feature %a",f,d,c,"kept","dynamic","keepligatures") + end setcolor(n,"darkred") return true end local k = fontfeatures[f].keepligatures if k == v_auto then - report("font %!font:name!, glyph %a, slot %X -> ligature %s, by %s feature %a",f,d,c,"kept","static","keepligatures") + if trace_ligatures_d then + report("font %!font:name!, glyph %a, slot %X -> ligature %s, by %s feature %a",f,d,c,"kept","static","keepligatures") + end setcolor(n,"darkgreen") return true end if not k then - report("font %!font:name!, glyph %a, slot %X -> ligature %s, by %s feature %a",f,d,c,"split","static","keepligatures") + if trace_ligatures_d then + report("font %!font:name!, glyph %a, slot %X -> ligature %s, by %s feature %a",f,d,c,"split","static","keepligatures") + end resetcolor(n) return false end diff --git a/tex/context/interface/mkiv/i-chart.xml b/tex/context/interface/mkiv/i-chart.xml new file mode 100644 index 000000000..06c356041 --- /dev/null +++ b/tex/context/interface/mkiv/i-chart.xml @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?context-directive job ctxfile x-setups.ctx ?> + +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands"> + + <?context-directive job ctxfile x-setups.ctx ?> + + <!-- still incomplete --> + + <cd:command name="setupFLOWcharts" file="m-chart.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name-list-optional"/> + <cd:assignments list="yes"> + <cd:parameter name="width"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="height"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="offset"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="dx"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="dy"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="nx"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="ny"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="x"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="y"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="labeloffset"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="commentoffset"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="exitoffset"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="split"> + <cd:constant type="yes"/> + <cd:constant type="no" default="yes"/> + </cd:parameter> + <cd:parameter name="bodyfont"> + <cd:inherit name="setupbodyfont"/> + </cd:parameter> + <cd:parameter name="option"> + <cd:constant type="test"/> + </cd:parameter> + <!-- dot: private option --> + <cd:parameter name="focus"> + <cd:constant type="cd:text"/> + </cd:parameter> + <cd:parameter name="autofocus"> + <cd:constant type="yes"/> + <cd:constant type="no" default="yes"/> + </cd:parameter> + <cd:parameter name="autofocus"> + <cd:constant type="yes"/> + <cd:constant type="no" default="yes"/> + </cd:parameter> + <cd:parameter name="background"> + <cd:resolve name="value-background"/> + </cd:parameter> + <cd:parameter name="framecolor"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="backgroundcolor"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="rulethickness"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="frame"> + <cd:constant type="on" default="yes"/> + <cd:constant type="off"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + + <cd:command name="setupFLOWlines" file="m-chart.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name-list-optional"/> + <cd:assignments list="yes"> + <cd:parameter name="color"> + <cd:constant name="round"/> + <cd:constant name="normal" default="yes"/> + </cd:parameter> + <cd:parameter name="arrow"> + <cd:constant name="yes" default="yes"/> + <cd:constant name="no"/> + </cd:parameter> + <cd:parameter name="dash"> + <cd:constant name="yes"/> + <cd:constant name="no" default="yes"/> + </cd:parameter> + <cd:parameter name="radius"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="color"> + <cd:constant name="cd:color"/> + </cd:parameter> + <cd:parameter name="rulethickness"> + <cd:constant name="cd:dimension"/> + </cd:parameter> + <cd:parameter name="offset"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + + <cd:command name="setupFLOWshapes" file="m-chart.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name-list-optional"/> + <cd:assignments list="yes"> + <cd:parameter name="default"> + <cd:resolve name="cd:name"/> + </cd:parameter> + <cd:parameter name="framecolor"> + <cd:constant name="cd:color"/> + </cd:parameter> + <cd:parameter name="background"> + <cd:resolve name="value-background"/> + </cd:parameter> + <cd:parameter name="backgroundcolor"> + <cd:constant name="cd:color"/> + </cd:parameter> + <cd:parameter name="rulethickness"> + <cd:constant name="cd:dimension"/> + </cd:parameter> + <cd:parameter name="offset"> + <cd:constant type="none"/> + <cd:constant type="overlay"/> + <cd:constant type="standard"/> + <cd:constant type="cd:dimension"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + + <cd:command name="setupFLOWfocus" file="m-chart.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name-list-optional"/> + <cd:assignments list="yes"> + <cd:parameter name="color"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="background"> + <cd:inherit name="setupFLOWshape"/> + </cd:parameter> + <cd:parameter name="backgroundcolor"> + <cd:inherit name="setupFLOWshape"/> + </cd:parameter> + <cd:parameter name="rulethickness"> + <cd:inherit name="setupFLOWshape"/> + </cd:parameter> + <cd:parameter name="offset"> + <cd:inherit name="setupFLOWshape"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + + <cd:command name="setupFLOWsplit" file="m-chart.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name-list-optional"/> + <cd:assignments list="yes"> + <cd:parameter name="dx"> + <cd:constant name="cd:number"/> + </cd:parameter> + <cd:parameter name="dy"> + <cd:constant name="cd:number"/> + </cd:parameter> + <cd:parameter name="nx"> + <cd:constant name="cd:number"/> + </cd:parameter> + <cd:parameter name="ny"> + <cd:constant name="cd:number"/> + </cd:parameter> + <cd:parameter name="command"> + <cd:constant name="cd:command"/> + </cd:parameter> + <cd:parameter name="before"> + <cd:constant name="cd:command"/> + </cd:parameter> + <cd:parameter name="after"> + <cd:constant name="cd:command"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + + <!-- + + startFLOWchart [name] + FLOWchart [name] + startFLOWcell [key=value] + includeFLOWchart + + name shape destination focus overlay location text label comment exit + connection include figure connect locate + --> + +</cd:interface> diff --git a/tex/context/interface/mkiv/i-chemical.xml b/tex/context/interface/mkiv/i-chemical.xml index d300f9008..1a81b82fc 100644 --- a/tex/context/interface/mkiv/i-chemical.xml +++ b/tex/context/interface/mkiv/i-chemical.xml @@ -252,4 +252,4 @@ </cd:arguments> </cd:command> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-common-value.xml b/tex/context/interface/mkiv/i-common-value.xml index 42c9e11d8..5b068570b 100644 --- a/tex/context/interface/mkiv/i-common-value.xml +++ b/tex/context/interface/mkiv/i-common-value.xml @@ -4,6 +4,15 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands"> + <!-- backgrounds--> + + <cd:define name="value-background"> + <cd:parameter name="background"> + <cd:constant type="foreground"/> + <cd:constant type="color"/> + <cd:constant type="cd:name"/> + </cd:define> + <!-- style = ... --> <cd:define name="value-style"> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 16ce0cdb9..bf6123331 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-framed.xml b/tex/context/interface/mkiv/i-framed.xml index 07bdd5de4..b87e498e5 100644 --- a/tex/context/interface/mkiv/i-framed.xml +++ b/tex/context/interface/mkiv/i-framed.xml @@ -93,9 +93,7 @@ <cd:constant type="none"/> </cd:parameter> <cd:parameter name="background"> - <cd:constant type="foreground"/> - <cd:constant type="color"/> - <cd:constant type="cd:name"/> + <cd:resolve name="value-background"/> </cd:parameter> <cd:parameter name="backgroundoffset"> <cd:constant type="frame"/> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex a36861d6c..3154dfdd2 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua index f1e7f4cb9..66f2b4c5f 100644 --- a/tex/context/modules/mkiv/m-chart.lua +++ b/tex/context/modules/mkiv/m-chart.lua @@ -10,24 +10,28 @@ if not modules then modules = { } end modules ['x-flow'] = { -- use metapost.graphic(....) directly -- todo: labels +-- todo: named colors -moduledata.charts = moduledata.charts or { } +local type, tonumber, rawget, next = type, tonumber, rawget, next +local gsub, find, lower = string.gsub, string.find, string.lower +local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match -local gsub, match, find, format, lower = string.gsub, string.match, string.find, string.format, string.lower +local formatters = string.formatters local setmetatableindex = table.setmetatableindex -local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match -local report_chart = logs.reporter("chart") +moduledata.charts = moduledata.charts or { } + +local report_chart = logs.reporter("chart") -local variables = interfaces.variables +local variables = interfaces.variables -local v_yes = variables.yes -local v_no = variables.no -local v_none = variables.none -local v_standard = variables.standard -local v_overlay = variables.overlay -local v_round = variables.round -local v_test = variables.test +local v_yes = variables.yes +local v_no = variables.no +local v_none = variables.none +local v_standard = variables.standard +local v_overlay = variables.overlay +local v_round = variables.round +local v_test = variables.test local defaults = { chart = { @@ -252,8 +256,8 @@ end function commands.flow_set_text(align,str) temp.texts[#temp.texts+1] = { - location = align, - text = str, + align = align, + text = str, } end @@ -504,7 +508,7 @@ local function process_cells(chart,xoffset,yoffset) if shapedata.kind == "line" then local linesettings = settings.line context("flow_shape_line_color := \\MPcolor{%s} ;", linesettings.color) - context("flow_shape_fill_color := \\MPcolor{%s} ;", linesettings.backgroundcolor) + context("flow_shape_fill_color := black ;") context("flow_shape_line_width := %p ; ", linesettings.rulethickness) elseif focus[cell.focus] or focus[cell.name] then local focussettings = settings.focus @@ -597,9 +601,17 @@ local function process_connections(chart,xoffset,yoffset) end end -local texttemplate = "\\setvariables[flowcell:text][x=%s,y=%s,text={%s},align={%s},figure={%s},destination={%s}]" +local f_texttemplate_t = formatters["\\setvariables[flowcell:text][x=%s,y=%s,n=%i,align={%s},figure={%s},overlay={%s},destination={%s}]"] +local f_texttemplate_l = formatters["\\doFLOWlabel{%i}{%i}{%i}"] -local splitter = lpeg.splitat(":") +local splitter = lpeg.splitat(":") +local charttexts = { } -- permits " etc in mp + +function commands.flow_get_text(n) + if n > 0 then + context(charttexts[n]) + end +end local function process_texts(chart,xoffset,yoffset) local data = chart.data @@ -607,41 +619,59 @@ local function process_texts(chart,xoffset,yoffset) if not data then return end + charttexts = { } for i=1,#data do local cell = visible(chart,data[i]) if cell then - local x = cell.x or 1 - local y = cell.y or 1 - local texts = cell.texts - for i=1,#texts do - local text = texts[i] - local data = text.text - local align = validlabellocations[text.align or ""] or text.align or "" - local figure = i == 1 and cell.figure or "" - local destination = i == 1 and cell.destination or "" - context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,format(texttemplate,x,y,data,align,figure,destination)) + local x = cell.x or 1 + local y = cell.y or 1 + local figure = cell.figure or "" + local overlay = cell.overlay or "" + local destination = cell.destination or "" + local texts = cell.texts + local noftexts = #texts + if noftexts > 0 then + for i=1,noftexts do + local text = texts[i] + local data = text.text + local align = text.align or "" + local align = validlabellocations[align] or align + charttexts[#charttexts+1] = data + context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,#charttexts,align,figure,overlay,destination)) + if i == 1 then + figure = "" + overlay = "" + destination = "" + end + end + elseif figure ~= "" or overlay ~= "" or destination ~= "" then + context('flow_chart_draw_text(%s,%s,textext("%s")) ;',x,y,f_texttemplate_t(x,y,0,"",figure,overlay,destination)) end local labels = cell.labels for i=1,#labels do - local label = labels[i] - local text = label.text - local location = validlabellocations[label.location or ""] or label.location or "" - if text and location then - context('flow_chart_draw_label(%s,%s,"%s",textext("\\strut %s")) ;',x,y,location,text) + local label = labels[i] + local text = label.text + local location = label.location or "" + local location = validlabellocations[location] or location + if text and text ~= "" then + charttexts[#charttexts+1] = text + context('flow_chart_draw_label(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) end end local exits = cell.exits for i=1,#exits do - local exit = exits[i] - local text = exit.text - local location = validlabellocations[exit.location or ""] - if text and location then + local exit = exits[i] + local text = exit.text + local location = exit.location or "" + local location = validlabellocations[location] or location + if text ~= "" then -- maybe make autoexit an option if location == "l" and x == chart.from_x + 1 or location == "r" and x == chart.to_x - 1 or location == "t" and y == chart.to_y - 1 or location == "b" and y == chart.from_y + 1 then - context('flow_chart_draw_exit(%s,%s,"%s",textext("\\strut %s")) ;',x,y,location,text) + charttexts[#charttexts+1] = text + context('flow_chart_draw_exit(%s,%s,"%s",textext("%s")) ;',x,y,location,f_texttemplate_l(x,y,#charttexts)) end end end @@ -649,10 +679,10 @@ local function process_texts(chart,xoffset,yoffset) for i=1,#connections do local comments = connections[i].comments for j=1,#comments do - local comment = comments[j] - local text = comment.text + local comment = comments[j] + local text = comment.text local location = comment.location or "" - local length = 0 + local length = 0 -- "tl" "tl:*" "tl:0.5" local loc, len = lpegmatch(splitter,location) -- do the following in lpeg if len == "*" then @@ -664,12 +694,13 @@ local function process_texts(chart,xoffset,yoffset) end elseif loc then location = validcommentlocations[loc] or "*" - length = tonumber(len) or 0 + length = tonumber(len) or 0 else location = validcommentlocations[location] or "" end - if text and location then - context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("\\strut %s")) ;',x,y,i,location,length,text) + if text and text ~= "" then + charttexts[#charttexts+1] = text + context('flow_chart_draw_comment(%s,%s,%s,"%s",%s,textext("%s")) ;',x,y,i,location,length,f_texttemplate_l(x,y,#charttexts)) end end end @@ -837,6 +868,9 @@ local function makechart(chart) context("flow_chart_offset := %p ;",offset) -- context("flow_reverse_y := true ;") +if chartsettings.option == v_test then + context("flow_draw_test_shapes ;") +end process_cells(chart,0,0) process_connections(chart,0,0) process_texts(chart,0,0) diff --git a/tex/context/modules/mkiv/m-chart.mkvi b/tex/context/modules/mkiv/m-chart.mkvi index a0c8b2244..a1def7065 100644 --- a/tex/context/modules/mkiv/m-chart.mkvi +++ b/tex/context/modules/mkiv/m-chart.mkvi @@ -15,7 +15,6 @@ % flowsets % autoscaling (bodyfontsteps) % comment -% overlay % % todo: % \useFLOWchart[name][parent][setting,setting][additional settings] @@ -63,8 +62,6 @@ \c!commentoffset=.5\bodyfontsize, \c!exitoffset=\zeropoint, % \c!split=\v!no, - % \c!maxwidth=, - % \c!maxheight=, % \c!option=, % \c!bodyfont=, % \c!dot=, % private option @@ -307,7 +304,7 @@ \unexpanded\def\module_charts_FLOW_include [#name][#settings]{% \begingroup - \getparameters[FLOWi][x=1,y=1,#settings]% + \getparameters[FLOWi][\c!x=1,\c!y=1,#settings]% \ctxcommand{flow_set_include("#name",\number\FLOWix,\number\FLOWiy,\!!bs\detokenize{#settings}\!!es)}% \endgroup \ignorespaces @@ -315,7 +312,8 @@ \setvariables [flowcell:text] - [x=1, + [n=0, + x=1, y=1, text=, align=, @@ -324,8 +322,6 @@ \def\FLOWx{\getvariable{flowcell:text}{x}} % compatibility (for Willi) \def\FLOWy{\getvariable{flowcell:text}{y}} % compatibility (for Willi) -% \c!background={\@@FLOWbackground,\FLOWoverlay}, - \defineoverlay [flowcell:figure] [\overlayfigure{\getvariable{flowcell:text}{figure}}] @@ -335,13 +331,15 @@ \iftrialtypesetting \directsetup{flowcell:text:place:indeed} \else \iflocation - \doifelsenothing {\getvariable{flowcell:text}{destination}} { + \edef\flowcelldestination{\getvariable{flowcell:text}{destination}}% + \ifx\flowcelldestination\empty \directsetup{flowcell:text:place:indeed} - } { + \else % tricky: scaling and moving around is not taken into account - \setupinteraction[\c!color=,\c!contrastcolor=] - \gotobox{\directsetup{flowcell:text:place:indeed}}[\getvariable{flowcell:text}{destination}] - } + \letinteractionparameter\c!color\empty + \letinteractionparameter\c!contrastcolor\empty + \gotobox{\directsetup{flowcell:text:place:indeed}}[\flowcelldestination] + \fi \else \directsetup{flowcell:text:place:indeed} \fi \fi @@ -351,17 +349,41 @@ \startsetups flowcell:text:place:indeed \begingroup \directsetup{flowcell:text:user} - \doifelsenothing {\getvariable{flowcell:text}{figure}} { - \expandcheckedcsname{flowcell:}{\getvariable{flowcell:text}{align}}\empty - {\getvariable{flowcell:text}{text}} - } { - \expandcheckedcsname{flowcell:}{\getvariable{flowcell:text}{align}}\empty - [\c!background=flowcell:figure] - {\getvariable{flowcell:text}{text}} - } + \edef\flowcellfigure {\getvariable{flowcell:text}{figure}}% + \edef\flowcelloverlay{\getvariable{flowcell:text}{overlay}}% + \edef\flowcellalign {\getvariable{flowcell:text}{align}}% + \edef\flowcellindex {\getvariable{flowcell:text}{n}}% + \ifx\flowcellfigure\empty + \ifx\flowcelloverlay\empty + \expandcheckedcsname{flowcell:}\flowcellalign\empty + % {\getvariable{flowcell:text}{text}} + {\getFLOWtext\flowcellindex} + \else + \expandcheckedcsname{flowcell:}\flowcellalign\empty + [\c!background={\flowcelloverlay}] + % {\getvariable{flowcell:text}{text}} + {\getFLOWtext\flowcellindex} + \fi + \else + \expandcheckedcsname{flowcell:}\flowcellalign\empty + [\c!background=flowcell:figure] + % {\getvariable{flowcell:text}{text}} + {\getFLOWtext\flowcellindex} + \fi \endgroup \stopsetups +\unexpanded\def\doFLOWlabel#1#2#3% + {\begingroup + \def\FLOWx{#1}% + \def\FLOWy{#2}% + \strut + \getFLOWtext{#3}% + \endgroup} + +\unexpanded\def\getFLOWtext#1% + {\ifcase#1\else\ctxcommand{flow_get_text(#1)}\fi} + \defineframed % to be discussed: shape or global [flowcell:base] [\c!offset=\v!overlay, % no strut ? diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 00da9a536..0d8938137 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 : 09/09/16 08:21:36 +-- merge date : 09/12/16 08:13:34 do -- begin closure to overcome local limits and interference @@ -12841,7 +12841,7 @@ function readers.gdef(f,fontdata,specification) end end end - if marksetsoffset then + if marksetsoffset and marksetsoffset>tableoffset then setposition(f,marksetsoffset) local format=readushort(f) if format==1 then |