From d20586353aef444da0d16bb6cdbb118b8f461c21 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 13 Oct 2010 16:45:29 +0300 Subject: beta 2010.10.13 14:39 --- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/lpdf-wid.lua | 6 ++- tex/context/base/mult-de.tex | 1 + tex/context/base/mult-def.lua | 4 ++ tex/context/base/mult-en.tex | 1 + tex/context/base/mult-fr.tex | 1 + tex/context/base/mult-it.tex | 1 + tex/context/base/mult-nl.tex | 1 + tex/context/base/mult-ro.tex | 1 + tex/context/base/node-fnt.lua | 73 +++++++++++++++++++---------- tex/context/base/strc-not.mkiv | 16 +++---- tex/context/interface/keys-cs.xml | 1 + tex/context/interface/keys-de.xml | 1 + tex/context/interface/keys-en.xml | 1 + tex/context/interface/keys-fr.xml | 1 + tex/context/interface/keys-it.xml | 1 + tex/context/interface/keys-nl.xml | 1 + tex/context/interface/keys-pe.xml | 1 + tex/context/interface/keys-ro.xml | 1 + tex/generic/context/luatex-fonts-merged.lua | 2 +- 21 files changed, 82 insertions(+), 37 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index fff5c1c4e..716dcf694 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.10.13 00:33} +\newcontextversion{2010.10.13 14:39} %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/context.tex b/tex/context/base/context.tex index a2798b45d..aa609e378 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.10.13 00:33} +\edef\contextversion{2010.10.13 14:39} %D For those who want to use this: diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua index a948fcedc..3a2d1338e 100644 --- a/tex/context/base/lpdf-wid.lua +++ b/tex/context/base/lpdf-wid.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { local format, gmatch, gsub, find = string.format, string.gmatch, string.gsub, string.find local texsprint, ctxcatcodes, texbox, texcount = tex.sprint, tex.ctxcatcodes, tex.box, tex.count local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash local report_media = logs.new("media") @@ -160,6 +161,8 @@ end local nofattachments, attachments, filestreams = 0, { }, { } +-- todo: hash and embed once + function codeinjections.embedfile(filename) local r = filestreams[filename] if r == false then @@ -317,6 +320,7 @@ end local function insertrendering(specification) local label = specification.label + local options = utilities.parsers.settings_to_hash(specification.options) if not mf[label] then local filename = specification.filename local isurl = find(filename,"://") @@ -354,7 +358,7 @@ local function insertrendering(specification) } if isurl then descriptor.FS = pdfconstant("URL") - elseif specification.embed then + elseif options[variables.embed] then descriptor.EF = codeinjections.embedfile(filename) end local clip = pdfdictionary { diff --git a/tex/context/base/mult-de.tex b/tex/context/base/mult-de.tex index a06c6c633..0f47cc406 100644 --- a/tex/context/base/mult-de.tex +++ b/tex/context/base/mult-de.tex @@ -142,6 +142,7 @@ \setinterfacevariable{down}{down} \setinterfacevariable{each}{jede} \setinterfacevariable{edge}{kante} +\setinterfacevariable{embed}{embed} \setinterfacevariable{empty}{leer} \setinterfacevariable{end}{end} \setinterfacevariable{endnote}{endnote} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index ec10d39e2..436e22f51 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -11148,6 +11148,10 @@ return { }, }, ["variables"]={ + ["embed"]={ + ["en"]="embed", + ["nl"]="sluitin", + }, ["end"]={ ["en"]="end", ["nl"]="eind", diff --git a/tex/context/base/mult-en.tex b/tex/context/base/mult-en.tex index c8d0d3b28..ea48f0c16 100644 --- a/tex/context/base/mult-en.tex +++ b/tex/context/base/mult-en.tex @@ -142,6 +142,7 @@ \setinterfacevariable{down}{down} \setinterfacevariable{each}{each} \setinterfacevariable{edge}{edge} +\setinterfacevariable{embed}{embed} \setinterfacevariable{empty}{empty} \setinterfacevariable{end}{end} \setinterfacevariable{endnote}{endnote} diff --git a/tex/context/base/mult-fr.tex b/tex/context/base/mult-fr.tex index cbe16592f..14cad19c3 100644 --- a/tex/context/base/mult-fr.tex +++ b/tex/context/base/mult-fr.tex @@ -142,6 +142,7 @@ \setinterfacevariable{down}{down} \setinterfacevariable{each}{chaque} \setinterfacevariable{edge}{bord} +\setinterfacevariable{embed}{embed} \setinterfacevariable{empty}{vide} \setinterfacevariable{end}{end} \setinterfacevariable{endnote}{notefin} diff --git a/tex/context/base/mult-it.tex b/tex/context/base/mult-it.tex index 8351025cc..5dc791b24 100644 --- a/tex/context/base/mult-it.tex +++ b/tex/context/base/mult-it.tex @@ -142,6 +142,7 @@ \setinterfacevariable{down}{down} \setinterfacevariable{each}{ogni} \setinterfacevariable{edge}{bordo} +\setinterfacevariable{embed}{embed} \setinterfacevariable{empty}{vuoto} \setinterfacevariable{end}{end} \setinterfacevariable{endnote}{endnote} diff --git a/tex/context/base/mult-nl.tex b/tex/context/base/mult-nl.tex index 2a3758254..9e1a4aa5f 100644 --- a/tex/context/base/mult-nl.tex +++ b/tex/context/base/mult-nl.tex @@ -142,6 +142,7 @@ \setinterfacevariable{down}{omlaag} \setinterfacevariable{each}{elk} \setinterfacevariable{edge}{rand} +\setinterfacevariable{embed}{sluitin} \setinterfacevariable{empty}{leeg} \setinterfacevariable{end}{eind} \setinterfacevariable{endnote}{eindnoot} diff --git a/tex/context/base/mult-ro.tex b/tex/context/base/mult-ro.tex index 072e513ec..137e09408 100644 --- a/tex/context/base/mult-ro.tex +++ b/tex/context/base/mult-ro.tex @@ -142,6 +142,7 @@ \setinterfacevariable{down}{down} \setinterfacevariable{each}{fiecare} \setinterfacevariable{edge}{bordura} +\setinterfacevariable{embed}{embed} \setinterfacevariable{empty}{gol} \setinterfacevariable{end}{end} \setinterfacevariable{endnote}{endnote} diff --git a/tex/context/base/node-fnt.lua b/tex/context/base/node-fnt.lua index c35a42840..7e8fa3694 100644 --- a/tex/context/base/node-fnt.lua +++ b/tex/context/base/node-fnt.lua @@ -9,8 +9,12 @@ if not modules then modules = { } end modules ['node-fnt'] = { if not context then os.exit() end -- generic function in node-dum local next, type = next, type +local concat = table.concat local trace_characters = false trackers.register("nodes.characters", function(v) trace_characters = v end) +local trace_fontrun = false trackers.register("nodes.fontrun", function(v) trace_fontrun = v end) + +local report_fontrun = logs.new("font run") local nodes, node = nodes, node @@ -23,10 +27,11 @@ local has_attribute = node.has_attribute local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming local nodecodes = nodes.nodecodes -local glyph = nodecodes.glyph local fontdata = fonts.ids local handlers = nodes.handlers +local glyph_code = nodecodes.glyph + -- some tests with using an array of dynamics[id] and processes[id] demonstrated -- that there was nothing to gain (unless we also optimize other parts) -- @@ -37,15 +42,33 @@ local handlers = nodes.handlers -- happen often; we could consider processing sublists but that might need mor -- checking later on; the current approach also permits variants +local run = 0 + function handlers.characters(head) -- either next or not, but definitely no already processed list starttiming(nodes) local usedfonts, attrfonts, done = { }, { }, false local a, u, prevfont, prevattr = 0, 0, nil, 0 - for n in traverse_id(glyph,head) do - local font, attr = n.font, has_attribute(n,0) -- zero attribute is reserved for fonts in context - if attr and attr > 0 then - if font ~= prevfont or attr ~= prevattr then + if trace_fontrun then + run = run + 1 + report_fontrun("") + report_fontrun("node mode run %s",run) + report_fontrun("") + local n = head + while n do + if n.id == glyph_code then + local font, attr = n.font, has_attribute(n,0) or 0 + report_run("font %03i dynamic %03i glyph %s",font,attr,utf.char(n.char)) + else + report_run("[%s]",node.type(n.id)) + end + n = n.next + end + end + for n in traverse_id(glyph_code,head) do + local font, attr = n.font, has_attribute(n,0) or 0 -- zero attribute is reserved for fonts in context + if font ~= prevfont or attr ~= prevattr then + if attr > 0 then local used = attrfonts[font] if not used then used = { } @@ -66,31 +89,33 @@ function handlers.characters(head) end end end - prevfont, prevattr = font, attr - end - elseif font ~= prevfont then - prevfont, prevattr = font, 0 - local used = usedfonts[font] - if not used then - local tfmdata = fontdata[font] - if tfmdata then - local shared = tfmdata.shared -- we need to check shared, only when same features - if shared then - local processors = shared.processes - if processors and #processors > 0 then - usedfonts[font] = processors - u = u + 1 + else + local used = usedfonts[font] + if not used then + local tfmdata = fontdata[font] + if tfmdata then + local shared = tfmdata.shared -- we need to check shared, only when same features + if shared then + local processors = shared.processes + if processors and #processors > 0 then + usedfonts[font] = processors + u = u + 1 + end end + else + -- probably nullfont end - else - -- probably nullfont end end - else - prevattr = attr + prevfont, prevattr = font, attr end end - + if trace_fontrun then + report_fontrun("") + report_fontrun("statics : %s",(u > 0 and concat(table.keys(usedfonts)," ")) or "none") + report_fontrun("dynamics: %s",(a > 0 and concat(table.keys(attrfonts)," ")) or "none") + report_fontrun("") + end -- we could combine these and just make the attribute nil if u == 1 then local font, processors = next(usedfonts) diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index 7d75340a5..02434c637 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -229,13 +229,13 @@ [\c!location=\@@defaultnotedefloc, \c!distance=\@@defaultnotedefdis, \c!width=\v!fit, - \c!headstyle=\noteparameter\c!style, % hm - \c!headcolor=\noteparameter\c!color, % hm + \c!headstyle=\noteparameter\c!style, + \c!headcolor=\noteparameter\c!color, \s!handler=\v!note, \c!text=, \c!before=, \c!after=]% - \doredefinenotecommands\currentnote + \doredefinenotecommands \setupenumerations [\currentnote] [\s!parent=\??vn\currentnote, @@ -245,8 +245,6 @@ \getparameters [\??vn\currentnote] [\s!parent=\??vn,#2]% -% \definestructurecounter -% [\currentnote]% \ctxlua{structures.notes.define("\currentnote","insert",\number\csname\??vn:\currentnote\endcsname)}% \the\everysetupnote \dochecknote} @@ -265,13 +263,13 @@ {\begingroup \doenumerationinit{#1}{#2}{#3}% \@@notemakedescription[##1]{}{##2}% - \endgroup}} + \expandafter\endgroup\noteparameter\c!next}} % WS: added \noteparameter\c!next -\def\doredefinenotecommands#1% - {\normalexpanded{\noexpand\dodoredefinenotecommands{#1}{1}{}}% +\def\doredefinenotecommands + {\normalexpanded{\noexpand\dodoredefinenotecommands{\currentnote}{1}{}}% \let\@@subslevel\empty \dostepwiserecurse{2}{\descriptionparameter\c!levels}{1} - {\normalexpanded{\noexpand\dodoredefinenotecommands{#1}{\recurselevel}{\@@subslevel\v!sub}}% + {\normalexpanded{\noexpand\dodoredefinenotecommands{\currentnote}{\recurselevel}{\@@subslevel\v!sub}}% \edef\@@subslevel{\@@subslevel\v!sub}}} \let\setupnotedefinition\setupenumerations diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 4de09d222..fec038251 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 8b0b17c7b..c1e8a989e 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index dd3932d8b..fc148cfbb 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index d21a28e73..78a4ebb4c 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 680ac0a0c..12ecd566d 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 9aa4efa2d..df1f277b9 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index fabb5c821..cd3c6c101 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -145,6 +145,7 @@ + diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index e71ddff85..99ca40a16 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -145,6 +145,7 @@ + diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 673f7e682..7af0079f7 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 10/13/10 00:33:49 +-- merge date : 10/13/10 14:39:16 do -- begin closure to overcome local limits and interference -- cgit v1.2.3