diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-06-13 09:57:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-06-13 09:57:00 +0200 |
commit | 344c6f506beecab459b438d9864c107a89d3766b (patch) | |
tree | c6364466df099e9c1c9a4d30d5a7b1da9c273d94 /tex | |
parent | b73cc5a5fa57fdadd4fc4644c8a19873ecf0cfb5 (diff) | |
download | context-344c6f506beecab459b438d9864c107a89d3766b.tar.gz |
beta 2012.06.13 09:57
Diffstat (limited to 'tex')
51 files changed, 1569 insertions, 1363 deletions
diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 9e441e224..332d7ea89 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -220,12 +220,12 @@ \newbox\objectbox -\def\dostartobject#1#2#3#4#5% +\unexpanded\def\dostartobject#1#2#3#4#5% needs to be \unexpanded {\bgroup \setbox\objectbox\vbox\bgroup \def\back_object_stop{\egroup\back_object_register{#1}{#2}}} -\def\dostopobject +\unexpanded\def\dostopobject % needs to be \unexpanded {\back_object_stop \egroup} @@ -237,9 +237,6 @@ \immediate\pdfxform resources {\pdfbackendcurrentresources}\objectbox \dosetobjectreference{#1}{#2}{\the\pdflastxform}} -\def\doresetobjects - {} - \let\m_back_object_reference\empty \def\doinsertobject#1#2% diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 484feffbc..f67ff38ef 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.12 09:56} +\newcontextversion{2012.06.13 09:57} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index fcd31610c..59ebd9ad6 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.12 09:56} +\newcontextversion{2012.06.13 09:57} %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-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 0f949075a..c28388200 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex adf4b170f..f8110d973 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index a58242a24..f0f272d16 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.12 09:56} +\edef\contextversion{2012.06.13 09:57} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index dd1f6d058..1551bf94d 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.12 09:56} +\edef\contextversion{2012.06.13 09:57} %D For those who want to use this: @@ -131,7 +131,7 @@ \loadmarkfile{node-fin} \loadmarkfile{node-mig} -\loadmarkfile{node-par} +\loadmarkfile{typo-bld} % par builders %loadmarkfile{node-pag} \loadmarkfile{back-ini} @@ -186,7 +186,7 @@ \loadmarkfile{node-bck} % overloads anch-pgr (experimental and undocumented) -\loadmarkfile{trac-vis} +\loadmarkfile{pack-cut} % leftovers from trac-vis \loadmarkfile{lang-mis} \loadmarkfile{lang-url} @@ -419,7 +419,7 @@ \loadmarkfile{core-fnt} \loadmarkfile{node-rul} -\loadmarkfile{node-spl} +\loadmarkfile{font-sol} % font solutions \loadmkvifile{strc-not} \loadmkvifile{strc-lnt} diff --git a/tex/context/base/data-exp.lua b/tex/context/base/data-exp.lua index 66bbb56cb..550b61689 100644 --- a/tex/context/base/data-exp.lua +++ b/tex/context/base/data-exp.lua @@ -114,12 +114,14 @@ local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpeggi for s in gmatch(str,"[^,]+") do s = validate(s) if s then - n = n + 1 ; t[n] = s + n = n + 1 + t[n] = s end end else for s in gmatch(str,"[^,]+") do - n = n + 1 ; t[n] = s + n = n + 1 + t[n] = s end end if trace_expansions then @@ -133,7 +135,7 @@ end -- We could make the previous one public. local function validate(s) - s = collapsepath(s) -- already keeps the // + s = collapsepath(s) -- already keeps the trailing / and // return s ~= "" and not find(s,"^!*unset/*$") and s end diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 7206c0d78..362cacf58 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -29,6 +29,7 @@ local filejoin = file.join local collapsepath = file.collapsepath local joinpath = file.joinpath local allocate = utilities.storage.allocate +local settings_to_array = utilities.parsers.settings_to_array local setmetatableindex = table.setmetatableindex local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) @@ -52,7 +53,7 @@ resolvers.cacheversion = '1.0.1' resolvers.configbanner = '' resolvers.homedir = environment.homedir resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" } -resolvers.luacnfname = 'texmfcnf.lua' +resolvers.luacnfname = "texmfcnf.lua" resolvers.luacnfstate = "unknown" -- The web2c tex binaries as well as kpse have built in paths for the configuration @@ -332,7 +333,7 @@ end local function identify_configuration_files() local specification = instance.specification if #specification == 0 then - local cnfspec = getenv('TEXMFCNF') + local cnfspec = getenv("TEXMFCNF") if cnfspec == "" then cnfspec = resolvers.luacnfspec resolvers.luacnfstate = "default" @@ -420,7 +421,7 @@ local function load_configuration_files() -- we push the value into the main environment (osenv) so -- that it takes precedence over the default one and therefore -- also over following definitions - resolvers.setenv('TEXMFCNF',cnfspec) -- resolves prefixes + resolvers.setenv("TEXMFCNF",cnfspec) -- resolves prefixes -- we now identify and load the specified configuration files instance.specification = { } identify_configuration_files() @@ -468,10 +469,11 @@ end local function locate_file_databases() -- todo: cache:// and tree:// (runtime) - local texmfpaths = resolvers.expandedpathlist('TEXMF') + local texmfpaths = resolvers.expandedpathlist("TEXMF") if #texmfpaths > 0 then for i=1,#texmfpaths do local path = collapsepath(texmfpaths[i]) + path = gsub(path,"/+$","") -- in case $HOME expands to something with a trailing / local stripped = lpegmatch(inhibitstripper,path) -- the !! thing if stripped ~= "" then local runtime = stripped == path @@ -600,9 +602,9 @@ function resolvers.prependhash(type,name,cache) end function resolvers.extendtexmfvariable(specification) -- crap, we could better prepend the hash - local t = resolvers.splitpath(getenv('TEXMF')) + local t = resolvers.splitpath(getenv("TEXMF")) -- okay? insert(t,1,specification) - local newspec = concat(t,";") + local newspec = concat(t,",") -- not ; if instance.environment["TEXMF"] then instance.environment["TEXMF"] = newspec elseif instance.variables["TEXMF"] then @@ -677,14 +679,19 @@ function resolvers.resetextrapath() end function resolvers.registerextrapath(paths,subpaths) + paths = paths and settings_to_array(paths) + subpaths = subpaths and settings_to_array(subpaths) local ep = instance.extra_paths or { } local oldn = #ep local newn = oldn - if paths and paths ~= "" then - if subpaths and subpaths ~= "" then - for p in gmatch(paths,"[^,]+") do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do + local nofpaths = #paths + local nofsubpaths = #subpaths + if nofpaths > 0 then + if nofsubpaths > 0 then + for i=1,nofpaths do + local p = paths[i] + for j=1,nofsubpaths do + local s = subpaths[j] local ps = p .. "/" .. s if not done[ps] then newn = newn + 1 @@ -694,7 +701,8 @@ function resolvers.registerextrapath(paths,subpaths) end end else - for p in gmatch(paths,"[^,]+") do + for i=1,nofpaths do + local p = paths[i] if not done[p] then newn = newn + 1 ep[newn] = resolvers.cleanpath(p) @@ -702,10 +710,10 @@ function resolvers.registerextrapath(paths,subpaths) end end end - elseif subpaths and subpaths ~= "" then + elseif nofsubpaths > 0 then for i=1,oldn do - -- we gmatch each step again, not that fast, but used seldom - for s in gmatch(subpaths,"[^,]+") do + for j=1,nofsubpaths do + local s = subpaths[j] local ps = ep[i] .. "/" .. s if not done[ps] then newn = newn + 1 @@ -783,11 +791,14 @@ function resolvers.expandedpathlist(str) return { } elseif instance.savelists then str = lpegmatch(dollarstripper,str) - if not instance.lists[str] then -- cached - local lst = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) - instance.lists[str] = expandedpathfromlist(lst) - end - return instance.lists[str] + local lists = instance.lists + local lst = lists[str] + if not lst then + local l = made_list(instance,resolvers.splitpath(resolvers.expansion(str))) + lst = expandedpathfromlist(l) + lists[str] = lst + end + return lst else local lst = resolvers.splitpath(resolvers.expansion(str)) return made_list(instance,expandedpathfromlist(lst)) diff --git a/tex/context/base/node-spl.lua b/tex/context/base/font-sol.lua index 3b208e0e7..08ab533dd 100644 --- a/tex/context/base/node-spl.lua +++ b/tex/context/base/font-sol.lua @@ -1,6 +1,6 @@ -if not modules then modules = { } end modules ['node-spl'] = { +if not modules then modules = { } end modules ['font-sol'] = { -- this was: node-spl version = 1.001, - comment = "companion to node-spl.mkiv", + comment = "companion to font-sol.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" @@ -20,6 +20,7 @@ if not modules then modules = { } end modules ['node-spl'] = { local gmatch, concat, format, remove = string.gmatch, table.concat, string.format, table.remove local next, tostring, tonumber = next, tostring, tonumber +local insert, remove = table.insert, table.remove local utfchar = utf.char local random = math.random @@ -36,6 +37,13 @@ local nodes, node = nodes, node local variables = interfaces.variables +local v_normal = variables.normal +local v_reverse = variables.reverse +local v_preroll = variables.preroll +local v_random = variables.random +local v_less = variables.less +local v_more = variables.more + local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash @@ -84,45 +92,100 @@ local fontdata = fonts.hashes.identifiers local setfontdynamics = fonts.hashes.setdynamics local fontprocesses = fonts.hashes.processes +local texsetattribute = tex.setattribute +local unsetvalue = attributes.unsetvalue + local parbuilders = builders.paragraphs parbuilders.solutions = parbuilders.solutions or { } parbuilders.solutions.splitters = parbuilders.solutions.splitters or { } local splitters = parbuilders.solutions.splitters +local solutions = { } -- attribute sets +local registered = { } -- backmapping + +local a_split = attributes.private('splitter') + local preroll = true +local criterium = 0 +local randomseed = nil +local optimize = nil -- set later + local variant = "normal" -local split = attributes.private('splitter') + local cache = { } -local solutions = { } -- attribute sets local variants = { } local max_less = 0 local max_more = 0 -local criterium = 0 -local randomseed = nil -local optimize = nil -- set later -function splitters.setup(setups) - local method = settings_to_hash(setups.method or "") - if method[variables.preroll] then - preroll = true - else - preroll = false - end +splitters.registered = registered + +local stack = { } + +local dummy = { + attribute = unsetvalue, + randomseed = 0, + criterium = 0, + preroll = false, + optimize = nil, +} + +local function checksettings(r,settings) + local s = r.settings + local method = settings_to_hash(settings.method or "") + local optimize for k, v in next, method do if variants[k] then - optimize = variants[k] + optimize = variants[k] -- last? + end + end + r.randomseed = tonumber(settings.randomseed) or s.randomseed or r.randomseed or 0 + r.criterium = tonumber(settings.criterium ) or s.criterium or r.criterium or 0 + r.preroll = method[v_preroll] and true or false + r.optimize = optimize or s.optimize or r.optimize +end + +local function pushsplitter(name,settings) + local r = name and registered[name] + if r then + if settings then + checksettings(r,settings) end + else + r = dummy end - randomseed = tonumber(setups.randomseed) - criterium = tonumber(setups.criterium) or criterium + insert(stack,r) + -- brr + randomseed = r.randomseed or 0 + criterium = r.criterium or 0 + preroll = r.preroll or false + optimize = r.optimize or nil + -- + texsetattribute(a_split,r.attribute) + return #stack +end + +local function popsplitter() + remove(stack) + local n = #stack + local r = stack[n] or dummy + -- + randomseed = r.randomseed or 0 + criterium = r.criterium or 0 + preroll = r.preroll or false + optimize = r.optimize or nil + -- + texsetattribute(a_split,r.attribute) + return n end local contextsetups = fonts.specifiers.contextsetups local function convert(featuresets,name,set,what) - local list, numbers, nofnumbers = set[what], { }, 0 + local list = set[what] if list then + local numbers = { } + local nofnumbers = 0 for i=1,#list do local feature = list[i] local fs = featuresets[feature] @@ -155,17 +218,19 @@ local function initialize(goodies) report_solutions("checking solutions in '%s'",goodiesname) end for name, set in next, solutions do - set.less = convert(featuresets,name,set,"less") - set.more = convert(featuresets,name,set,"more") + set.less = convert(featuresets,name,set.less) + set.more = convert(featuresets,name,set.more) end end end fonts.goodies.register("solutions",initialize) -function splitters.define(name,parameters) - local settings = settings_to_hash(parameters) -- todo: interfacing - local goodies, solution, less, more = settings.goodies, settings.solution, settings.less, settings.more +function splitters.define(name,settings) + local goodies = settings.goodies + local solution = settings.solution + local less = settings.less + local more = settings.more local less_set, more_set local l = less and settings_to_array(less) local m = more and settings_to_array(more) @@ -175,12 +240,12 @@ function splitters.define(name,parameters) local featuresets = goodies.featuresets local solution = solution and goodies.solutions[solution] if l and #l > 0 then - less_set = convert(featuresets,name,settings,"less") -- take from settings + less_set = convert(featuresets,name,less) -- take from settings else less_set = solution and solution.less -- take from goodies end if m and #m > 0 then - more_set = convert(featuresets,name,settings,"more") -- take from settings + more_set = convert(featuresets,name,more) -- take from settings else more_set = solution and solution.more -- take from goodies end @@ -211,13 +276,16 @@ function splitters.define(name,parameters) report_solutions("defining solutions '%s', less: '%s', more: '%s'",name,concat(less_set or {}," "),concat(more_set or {}," ")) end local nofsolutions = #solutions + 1 - solutions[nofsolutions] = { + local t = { solution = solution, less = less_set or { }, more = more_set or { }, settings = settings, -- for tracing + attribute = nofsolutions, } - context(nofsolutions) + solutions[nofsolutions] = t + registered[name] = t + return nofsolutions end local nofwords, noftries, nofadapted, nofkept, nofparagraphs = 0, 0, 0, 0, 0 @@ -251,8 +319,8 @@ function splitters.split(head) font = font } if trace_split then - report_splitters("cached %4i: font: %s, attribute: %s, word: %s, direction: %s", n, - font, attribute, nodes.listtoutf(list,true), rlmode) + report_splitters("cached %4i: font: %s, attribute: %s, word: %s, direction: %s", + n, font, attribute, nodes.listtoutf(list,true), rlmode and "r2l" or "l2r") end cache[n] = c local solution = solutions[attribute] @@ -264,7 +332,7 @@ function splitters.split(head) while current do local id = current.id if id == glyph_code and current.subtype < 256 then - local a = has_attribute(current,split) + local a = has_attribute(current,a_split) if not a then start, stop = nil, nil elseif not start then @@ -420,7 +488,7 @@ end -- We repeat some code but adding yet another layer of indirectness is not -- making things better. -variants[variables.normal] = function(words,list,best,width,badness,line,set,listdir) +variants[v_normal] = function(words,list,best,width,badness,line,set,listdir) local changed = 0 for i=1,#words do local done, c = doit(words[i],list,best,width,badness,line,set,listdir) @@ -440,7 +508,7 @@ variants[variables.normal] = function(words,list,best,width,badness,line,set,lis end end -variants[variables.reverse] = function(words,list,best,width,badness,line,set,listdir) +variants[v_reverse] = function(words,list,best,width,badness,line,set,listdir) local changed = 0 for i=#words,1,-1 do local done, c = doit(words[i],list,best,width,badness,line,set,listdir) @@ -460,7 +528,7 @@ variants[variables.reverse] = function(words,list,best,width,badness,line,set,li end end -variants[variables.random] = function(words,list,best,width,badness,line,set,listdir) +variants[v_random] = function(words,list,best,width,badness,line,set,listdir) local changed = 0 while #words > 0 do local done, c = doit(remove(words,random(1,#words)),list,best,width,badness,line,set,listdir) @@ -608,12 +676,56 @@ statistics.register("optimizer statistics", function() end end) -function splitters.enable() - tasks.enableaction("processors", "builders.paragraphs.solutions.splitters.split") - tasks.enableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") +-- we could use a stack + +local enableaction = tasks.enableaction +local disableaction = tasks.disableaction + +local function enable() + enableaction("processors", "builders.paragraphs.solutions.splitters.split") + enableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") end -function splitters.disable() - tasks.disableaction("processors", "builders.paragraphs.solutions.splitters.split") - tasks.disableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") +local function disable() + disableaction("processors", "builders.paragraphs.solutions.splitters.split") + disableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") +end + +function splitters.start(name,settings) + if pushsplitter(name,settings) == 1 then + enable() + end +end + +function splitters.stop() + if popsplitter() == 0 then + disable() + end end + +function splitters.set(name,settings) + if #stack > 0 then + stack = { } + else + enable() + end + pushsplitter(name,settings) -- sets attribute etc +end + +function splitters.reset() + if #stack > 0 then + stack = { } + popsplitter() -- resets attribute etc + disable() + end +end + + +-- interface + +commands.definefontsolution = splitters.define +commands.startfontsolution = splitters.start +commands.stopfontsolution = splitters.stop +commands.setfontsolution = splitters.start +commands.resetfontsolution = splitters.stop + diff --git a/tex/context/base/node-spl.mkiv b/tex/context/base/font-sol.mkiv index 3630212af..2c6bf8860 100644 --- a/tex/context/base/node-spl.mkiv +++ b/tex/context/base/font-sol.mkiv @@ -1,8 +1,8 @@ %D \module -%D [ file=node-spl, +%D [ file=font-sol, %D version=2009.05.19, -%D title=\CONTEXT\ Node Macros, -%D subtitle=Splitters, +%D title=\CONTEXT\ Font Macros, +%D subtitle=Solutions, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] @@ -13,10 +13,6 @@ \writestatus{loading}{ConTeXt Node Support / Splitters} -\registerctxluafile{node-spl}{1.001} - -\definesystemattribute[splitter][public] - %D This module is specially made for the oriental \TEX\ project. The working is as %D follows (and tuned for fonts like Idris' Husayni. The following method came to %D my mind after a couple of Skype sessions with Idris while working on the rough @@ -74,36 +70,47 @@ %D \disabletrackers[parbuilders.solutions.splitters.colors] %D \stoptyping +\registerctxluafile{font-sol}{1.001} + \unprotect -\newtoks\everysetupfontsolutions +\definesystemattribute[splitter][public] + +\installcorenamespace{fontsolution} -\unexpanded\def\definefontsolution - {\dodoubleargument\dodefinefontsolution} +\installcommandhandler \??fontsolution {fontsolution} \??fontsolution -\def\dodefinefontsolution[#1][#2]% we could set the attribute at the lua end - {\setxvalue{\??fu:#1}{\attribute\splitterattribute\ctxlua{builders.paragraphs.solutions.splitters.define("#1","#2")}\relax}} +\let\setupfontsolutions\setupfontsolution -\unexpanded\def\setfontsolution[#1]% - {\ctxlua{builders.paragraphs.solutions.splitters.enable()}% - \csname\??fu:#1\endcsname} +\appendtoks + \ctxcommand{definefontsolution("\currentfontsolution",{ % these are frozen + goodies = "\fontsolutionparameter\s!goodies", + solution = "\fontsolutionparameter\c!solution", + less = "\fontsolutionparameter\c!less", + more = "\fontsolutionparameter\c!more", + })} +\to \everydefinefontsolution -\unexpanded\def\resetfontsolution - {\ctxlua{builders.paragraphs.solutions.splitters.disable()}% - \attribute\splitterattribute\attributeunsetvalue} +\unexpanded\def\setfontsolution[#1]% just one + {\edef\currentfontsolution{#1}% + \ctxcommand{setfontsolution("\currentfontsolution", { + method = "\fontsolutionparameter\c!method", + criterium = "\fontsolutionparameter\c!criterium", + % randomseed = "\fontsolutionparameter\c!random", + })}} -\letvalue{\??fu:\v!reset}\resetfontsolution +\unexpanded\def\resetfontsolution % resets all + {\ctxcommand{resetfontsolution()}% + \let\currentfontsolution\empty} -\unexpanded\def\setupfontsolutions[#1]% - {\getparameters[\??fu][#1]% - \the\everysetupfontsolutions} +\unexpanded\def\startfontsolution % [#1] + {\pushmacro\currentfontsolution + \setfontsolution} -\appendtoks - \ctxlua{builders.paragraphs.solutions.splitters.setup { - method = "\@@fumethod", - criterium = "\@@fucriterium", - }}% -\to \everysetupfontsolutions +\unexpanded\def\stopfontsolution + {\ifhmode\par\fi + \ctxcommand{stopfontsolution()}% + \popmacro\currentfontsolution} % We initialize this module at the \LUA\ end. % diff --git a/tex/context/base/m-visual.mkiv b/tex/context/base/m-visual.mkiv index 5d259f6ab..988276a53 100644 --- a/tex/context/base/m-visual.mkiv +++ b/tex/context/base/m-visual.mkiv @@ -13,6 +13,9 @@ \unprotect +%D Much will probably be replaced by \LUA\ based solutions which is +%D rather trivial and fun doing. + %D This module collect a few more visual debugger features. I %D needed them for manuals and styles. The macros are documented %D in a my way document. @@ -243,10 +246,565 @@ \placefigure{\fakewords{8}{15}}{\fakeimage{5cm}{3cm}{10cm}{5cm}} \dorecurse{2}{\fakewords{100}{200}\endgraf}}}}} +%D Moved code: + +%D \module +%D [ file=trac-vis, % was core-vis, +%D version=1996.06.01, +%D title=\CONTEXT\ Tracking Macros, +%D subtitle=Visualization, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module adds some more visualization cues to the ones +%D supplied in the support module. +%D +%D %\everypar dual character, \the\everypar and \everypar= +%D %\hrule cannot be grabbed in advance, switches mode +%D %\vrule cannot be grabbed in advance, switches mode +%D % +%D %\indent only explicit ones +%D %\noindent only explicit ones +%D %\par only explicit ones +%D +%D %\leftskip only if explicit one +%D %\rightskip only if explicit one + +\writestatus{loading}{ConTeXt Tracking Macros / Visualization} + +\unprotect + +%D \macros +%D {indent, noindent, par} +%D +%D \TeX\ acts upon paragraphs. In mosts documents paragraphs +%D are separated by empty lines, which internally are handled as +%D \type{\par}. Paragraphs can be indented or not, depending on +%D the setting of \type{\parindent}, the first token of a +%D paragraph and/or user suppressed or forced indentation. +%D +%D Because the actual typesetting is based on both explicit +%D user and implicit system actions, visualization is only +%D possible for the user supplied \type{\indent}, +%D \type{\noindent}, and \type{\par}. Other +%D 'clever' tricks will quite certainly lead to more failures +%D than successes, so we only support these three explicit +%D primitives and one macro: + +\unexpanded\def\showparagraphcue#1#2#3#4#5% + {\bgroup + \scratchdimen#1\relax + \dontinterfere + \dontcomplain + \boxrulewidth5\testrulewidth + #3#4\relax + \setbox\scratchbox\normalhbox to \scratchdimen + {#2{\ruledhbox to \scratchdimen + {\vrule #5 20\testrulewidth \!!width \zeropoint + \normalhss}}}% + \smashbox\scratchbox + \normalpenalty\plustenthousand + \box\scratchbox + \egroup} + +\unexpanded\def\ruledhanging + {\ifdim\hangindent>\zeropoint + \ifnum\hangafter<\zerocount + \normalhbox + {\boxrulewidth5\testrulewidth + \setbox\scratchbox\ruledhbox to \hangindent + {\scratchdimen\strutht + \advance\scratchdimen \strutdp + \vrule + \!!width \zeropoint + \!!height \zeropoint + \!!depth -\hangafter\scratchdimen}% + \normalhskip-\hangindent + \smashbox\scratchbox + \raise\strutht\box\scratchbox}% + \fi + \fi} + +\unexpanded\def\ruledparagraphcues + {\bgroup + \dontcomplain + \normalhbox to \zeropoint + {\ifdim\leftskip>\zeropoint\relax + \showparagraphcue\leftskip\llap\relax\relax\!!depth + \normalhskip-\leftskip + \fi + \ruledhanging + \normalhskip\hsize + \ifdim\rightskip>\zeropoint\relax + \normalhskip-\rightskip + \showparagraphcue\rightskip\relax\relax\relax\!!depth + \fi}% + \egroup} + +\unexpanded\def\ruledpar + {\relax + \ifhmode + \showparagraphcue{40\testrulewidth}\relax\rightrulefalse\relax\!!height + \fi + \normalpar} + +\unexpanded\def\rulednoindent + {\relax + \normalnoindent + \ruledparagraphcues + \showparagraphcue{40\testrulewidth}\llap\leftrulefalse\relax\!!height} + +\unexpanded\def\ruledindent + {\relax + \normalnoindent + \ruledparagraphcues + \ifdim\parindent>\zeropoint + \showparagraphcue\parindent\relax\relax\relax\!!height + \else + \showparagraphcue{40\testrulewidth}\llap\relax\relax\!!height + \fi + \normalhskip\parindent} + +\unexpanded\def\dontshowimplicits + {\let\noindent \normalnoindent + \let\indent \normalindent + \let\par \normalpar} + +\unexpanded\def\showimplicits + {\testrulewidth \defaulttestrulewidth + \let\noindent \rulednoindent + \let\indent \ruledindent + \let\par \ruledpar} + +%D The next few||line examples show the four cues. Keep in +%D mind that we only see them when we explicitly open or close +%D a paragraph. +%D +%D \bgroup +%D \def\voorbeeld#1% +%D {#1Visualizing some \TeX\ primitives and Plain \TeX\ +%D macros can be very instructive, at least it is to me. +%D Here we see {\tt\string#1} and {\tt\string\ruledpar} in +%D action, while {\tt\string\parindent} equals +%D {\tt\the\parindent}.\ruledpar} +%D +%D \showimplicits +%D +%D \voorbeeld \indent +%D \voorbeeld \noindent +%D +%D \parindent=60pt +%D +%D \voorbeeld \indent +%D \voorbeeld \noindent +%D +%D \startnarrower +%D \voorbeeld \indent +%D \voorbeeld \noindent +%D \stopnarrower +%D \egroup +%D +%D These examples also demonstrate the visualization of +%D \type {\leftskip} and \type {\rightskip}. The macro +%D \type {\nofruledbaselines} determines the number of lines +%D shown. + +\newcounter\ruledbaselines + +\def\nofruledbaselines{3} + +\unexpanded\def\ruledbaseline + {\vrule \!!width \zeropoint + \bgroup + \dontinterfere + \doglobal\increment\ruledbaselines + \scratchdimen\nofruledbaselines\baselineskip + \setbox\scratchbox\normalvbox to 2\scratchdimen + {\leaders + \normalhbox + {\strut + \vrule + \!!height \testrulewidth + \!!depth \testrulewidth + \!!width 120\points} + \normalvfill}% + \smashbox\scratchbox + \advance\scratchdimen \strutheightfactor\baselineskip + \setbox\scratchbox\normalhbox + {\normalhskip -48\points + \normalhbox to 24\points + {\normalhss + {\ttxx#1}% + \ruledbaselines + \normalhskip6\points}% + \raise\scratchdimen\box\scratchbox}% + \smashbox\scratchbox + \box\scratchbox + \egroup} + +\unexpanded\def\showbaselines + {\testrulewidth\defaulttestrulewidth + \EveryPar{\ruledbaseline}} + +%D \macros +%D {showpagebuilder} +%D +%D The next tracing option probaly is only of use to me and a +%D few \CONTEXT\ hackers. + +\unexpanded\def\showpagebuilder + {\EveryPar{\doshowpagebuilder}} + +\unexpanded\def\doshowpagebuilder + {\strut\llap + {\startcolor[blue]\vl + \high{\infofont v:\the\vsize }\vl + \high{\infofont g:\the\pagegoal }\vl + \high{\infofont t:\the\pagetotal}\vl + \stopcolor}} + +%D \macros +%D {colormarkbox,rastermarkbox} +%D +%D This macro is used in the pagebody routine. No other use +%D is advocated here. +%D +%D \starttyping +%D \colormarkbox0 +%D \stoptyping + +\def\colormarkoffset{\cutmarkoffset} +\def\colormarklength{\cutmarklength} + +\def\dodocolorrangeA#1% + {\fastcolored[#1]{\hrule\!!width3em\!!height\scratchdimen\!!depth\zeropoint}} + +\def\docolorrangeA#1 #2 % + {\vbox + {\hsize3em % \scratchdimen + \ifcase#1\or + \dodocolorrangeA{c=#2}\or + \dodocolorrangeA{m=#2}\or + \dodocolorrangeA{y=#2}\or + \dodocolorrangeA{m=#2,y=#2}\or + \dodocolorrangeA{c=#2,y=#2}\or + \dodocolorrangeA{c=#2,m=#2}\fi + \ifdim\scratchdimen>1ex + \vskip-\scratchdimen + \vbox to \scratchdimen + {\vss\hbox to 3em{\hss#2\hss}\vss}% + \fi}} + +\def\colorrangeA#1% + {\vbox + {\startcolor[\s!white]% + \scratchdimen\dimexpr(-\colormarklength*4+\tractempheight+\tractempdepth)/21\relax + \offinterlineskip + \docolorrangeA #1 1.00 \docolorrangeA #1 0.95 + \docolorrangeA #1 0.75 + \docolorrangeA #1 0.50 + \docolorrangeA #1 0.25 \docolorrangeA #1 0.05 + \docolorrangeA #1 0.00 + \stopcolor}} + +\def\docolorrangeB #1 #2 #3 #4 #5 % + {\fastcolored + [\c!c=#2,\c!m=#3,\c!y=#4,\c!k=#5] + {\vrule\!!width\scratchdimen\!!height\colormarklength\!!depth\zeropoint}% + \ifdim\scratchdimen>2em + \hskip-\scratchdimen + \vbox to \colormarklength + {\vss\hbox to \scratchdimen{\hss#1\hss}\vss}% + \fi} + +\def\colorrangeB + {\hbox + {\startcolor[\s!white]% + \scratchdimen\dimexpr(-\colormarklength*\plustwo+\tractempwidth)/11\relax + \docolorrangeB .5~C .5 0 0 0 + \docolorrangeB .5~M 0 .5 0 0 + \docolorrangeB .5~Y 0 0 .5 0 + \docolorrangeB .5~K 0 0 0 .5 + \docolorrangeB C 1 0 0 0 + \docolorrangeB G 1 0 1 0 + \docolorrangeB Y 0 0 1 0 + \docolorrangeB R 0 1 1 0 + \docolorrangeB M 0 1 0 0 + \docolorrangeB B 1 1 0 0 + \docolorrangeB K 0 0 0 1 + \stopcolor}} + +\def\docolorrangeC#1 % + {\fastcolored + [\c!s=#1]% + {\vrule\!!width\scratchdimen\!!height\colormarklength\!!depth\zeropoint}% + \ifdim\scratchdimen>2em + \hskip-\scratchdimen + \vbox to \colormarklength + {\vss\hbox to \scratchdimen{\hss#1\hss}\vss}% + \fi} + +\def\colorrangeC + {\hbox + {\startcolor[\s!white]% + \scratchdimen\dimexpr(-\colormarklength*2+\tractempwidth)/14\relax + \docolorrangeC 1 \docolorrangeC .95 + \docolorrangeC .9 \docolorrangeC .85 + \docolorrangeC .8 \docolorrangeC .75 + \docolorrangeC .7 + \docolorrangeC .6 + \docolorrangeC .5 + \docolorrangeC .4 + \docolorrangeC .3 + \docolorrangeC .2 + \docolorrangeC .1 + \docolorrangeC 0 + \stopcolor}} + +\def\docolormarkbox#1#2% + {\tractempheight\ht#2% + \tractempdepth \dp#2% + \tractempwidth \wd#2% + \setbox#2\hbox + {\scratchdimen\dimexpr\colormarklength/2\relax + \forgetall + \ssxx + \setbox\scratchbox\vbox + {\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}% + \vskip\colormarkoffset\scratchdimen + \vbox to \tractempheight + {\vss + \hbox to \tractempwidth + {\llap{\colorrangeA1\hskip\colormarkoffset\scratchdimen}\hfill + \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA4}}% + \vss + \hbox to \tractempwidth + {\llap{\colorrangeA2\hskip\colormarkoffset\scratchdimen}\hfill + \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA5}}% + \vss + \hbox 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}}% + \ht\scratchbox\tractempheight + \dp\scratchbox\tractempdepth + \wd\scratchbox\zeropoint + \box\scratchbox + \box#2}% + \wd#2\tractempwidth + \ht#2\tractempheight + \dp#2\tractempdepth} + +\unexpanded\def\colormarkbox {\docolormarkbox\plusone } % #1 +\unexpanded\def\rastermarkbox{\docolormarkbox\zerocount} % #1 + +%D \macros +%D {showwhatsits, dontshowwhatsits} +%D +%D \TEX\ has three so called whatsits: \type {\mark}, \type +%D {\write} and \type {\special}. The first one keeps track of +%D the current state at page boundaries, the last two are used +%D to communicate to the outside world. Due to fact that +%D especially \type {\write} is often used in conjunction with +%D \type {\edef}, we can only savely support that one in \ETEX. +%D +%D \bgroup \showwhatsits \setupcolors[state=start] +%D +%D Whatsits show up \color[blue]{in color} and are +%D characterized bij their first character.\footnote [some note] +%D {So we may encounter \type {w}, \type {m} and \type{s}.} +%D They are \writestatus{dummy}{demo}\color[yellow]{stacked}. +%D +%D \egroup + +\newif\ifimmediatewrite + +\let\supernormalmark \normalmark % mark may already been superseded +\let\supernormalmarks \normalmarks % mark may already been superseded + +\unexpanded\def\showwhatsits + {\protected\def\normalmark {\visualwhatsit100+m\supernormalmark }% + \protected\def\normalmarks{\visualwhatsit100+m\supernormalmarks}% + \protected\def\special {\visualwhatsit0100s\normalspecial }% + \protected\def\write {\visualwhatsit001-w\normalwrite }% + \let\immediate\immediatewhatsit + \appendtoks\dontshowwhatsits\to\everystoptext} + +\unexpanded\def\immediatewhatsit + {\bgroup\futurelet\next\doimmediatewhatsit} + +\unexpanded\def\doimmediatewhatsit + {\ifx\next\write + \egroup\immediatewritetrue + \else + \egroup\expandafter\normalimmediate + \fi} + +\unexpanded\def\dontshowwhatsits + {\let\immediate \normalimmediate + \let\normalmark\supernormalmark + \let\special \normalspecial + \let\write \normalwrite} + +\unexpanded\def\visualwhatsit#1#2#3#4#5% + {\bgroup + \pushwhatsit + \dontinterfere + \dontcomplain + \dontshowcomposition + \dontshowwhatsits + \ttx + \ifvmode\donetrue\else\donefalse\fi + \setbox\scratchbox\hbox + {\ifdone + \colored[r=#1,g=#2,b=#3]{#5}% temp hack + \else + \colored[s=0]{#5}% temp hack + \fi}% + \setbox\scratchbox\hbox + {\ifdone + \colored[r=#1,g=#2,b=#3]{\vrule\!!width\wd\scratchbox}% temp hack + \else + \colored[s=0]{\vrule\!!width\wd\scratchbox}% temp hack + \fi + \hskip-\wd\scratchbox\box\scratchbox}% + \scratchdimen1ex + \setbox\scratchbox\hbox + {\ifdone\hskip\else\raise#4\fi\scratchdimen\box\scratchbox}% + \smashbox\scratchbox + \ifdone\nointerlineskip\fi + \box\scratchbox + \ifvmode\nointerlineskip\fi + \popwhatsit + \egroup + \ifimmediatewrite + \immediatewritefalse + \expandafter\normalimmediate + \fi} + +\unexpanded\def\pushwhatsit + {\ifzeropt\lastskip + \ifcase\lastpenalty + \ifzeropt\lastkern + \ifhmode + \let\popwhatsit\relax + \else + \edef\popwhatsit{\prevdepth\the\prevdepth}% + \fi + \else + \ifhmode + \edef\popwhatsit{\kern\the\lastkern}\unkern + \else + \edef\popwhatsit{\kern\the\lastkern\prevdepth\the\prevdepth}% + \kern-\lastkern + \fi + \fi + \else + \ifhmode + \edef\popwhatsit{\the\lastpenalty}% + \unpenalty + \else + \edef\popwhatsit{\penalty\the\lastpenalty\prevdepth\the\prevdepth}% + %\nobreak + \fi + \fi + \else + \ifhmode + \edef\popwhatsit{\hskip\the\lastskip}\unskip + \else + \edef\popwhatsit{\vskip\the\lastskip\prevdepth\the\prevdepth}% + \vskip-\lastskip + \fi + \fi} + +%D The next macro can be used to keep track of classes of +%D boxes (handy for development cq.\ tracing). + +\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}}% + \processaction + [#1] + [ l=>\next\relax\hfill\vfill\vfill, + r=>\next\hfill\relax\vfill\vfill, + t=>\next\hfill\hfill\relax\vfill, + b=>\next\hfill\hfill\vfill\relax, + lt=>\next\relax\hfill\relax\vfill, + lb=>\next\relax\hfill\vfill\relax, + rt=>\next\hfill\relax\relax\vfill, + rb=>\next\hfill\relax\vfill\relax, + tl=>\next\relax\hfill\relax\vfill, + bl=>\next\relax\hfill\vfill\relax, + tr=>\next\hfill\relax\relax\vfill, + br=>\next\hfill\relax\vfill\relax, + \s!default=>\next\hfill\hfill\vfill\vfill, + \s!unknown=>\next\hfill\hfill\vfill\vfill]} + +\def\dotagbox[#1]#2% + {\bgroup + \dowithnextbox + {\setbox\scratchbox\flushnextbox + \setbox\nextbox\ifhbox\nextbox\hbox\else\vbox\fi + \bgroup + \startoverlay + {\copy\scratchbox} + {\dodotagbox{#1}\scratchbox{\framed + [\c!background=\v!screen,\c!backgroundscreen=1]{#2}}} + \stopoverlay + \egroup + \nextboxwd\the\wd\scratchbox + \nextboxht\the\ht\scratchbox + \nextboxdp\the\dp\scratchbox + \flushnextbox + \egroup}} + +\unexpanded\def\tagbox + {\dosingleempty\dotagbox} + +%D \macros +%D {coloredhbox,coloredvbox,coloredvtop, +%D coloredstrut} +%D +%D The following visualizations are used in some of the manuals: + +\definecolor[boxcolor:ht][r=.5,g=.75,b=.5] +\definecolor[boxcolor:dp][r=.5,g=.5,b=.75] +\definecolor[boxcolor:wd][r=.75,g=.5,b=.5] +\definecolor[strutcolor] [r=.5,g=.25,b=.25] + +\unexpanded\def\coloredbox#1% + {\dowithnextbox{#1{\hbox + {\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\coloredstrut + {\color[strutcolor]{\def\strutwidth{2\points}\setstrut\strut}} + +\protect + \continueifinputfile{m-visual.mkiv} \starttext \simplethesis \stoptext - -\protect \endinput diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 788e8cd42..6fa7022c4 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -41,7 +41,7 @@ %D % \whateverparameter \c!test %D % \whateverparameterhash \c!test %D % \namedwhateverparameter \mycurrentwhatever \c!test -%D % \dosetwhateverstyleandcolor \c!style \c!color +%D % \usewhateverstyleandcolor \c!style \c!color %D % \everydefinewhatever (sets \currentwhatever) %D % \everypresetwhatever (can be used to reset parameters as we can redefine) %D % \everysetupwhatever (sets \currentwhatever) @@ -642,6 +642,26 @@ \installcorenamespace{fontinstancebasic} \installcorenamespace{fontinstanceclass} +%D The next one is handy for local assignments. + +\installcorenamespace{dummy} + +\letvalue\??dummy\empty + +\def\dummyparameter #1{\csname\??dummy\ifcsname\??dummy#1\endcsname#1\fi\endcsname} +\def\directdummyparameter#1{\csname\??dummy#1\endcsname} + +% \unexpanded\def\getdummyparameters +% {\mult_interfaces_get_parameters\??dummy} + +\unexpanded\def\getdummyparameters[#1% + {\if\noexpand#1]% + \expandafter\gobbleoneargument + \else + \let\m_mult_interfaces_namespace\??dummy + \expandafter\mult_interfaces_get_parameters_indeed + \fi#1} + % Maybe a \definecorenamespace[name][directparameter,directsetup][parent] % but we don't gain much. Actually we might just inline all definitions. diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 2f19a78a1..6d4e3734a 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{linkersubsatz} \setinterfaceconstant{lefttext}{linkertext} \setinterfaceconstant{leftwidth}{linkerbreite} +\setinterfaceconstant{less}{less} \setinterfaceconstant{level}{niveau} \setinterfaceconstant{levels}{niveaus} \setinterfaceconstant{limittext}{limittext} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{minhoehe} \setinterfaceconstant{minwidth}{minbreite} \setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{more}{more} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{name} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{zeichen} \setinterfaceconstant{size}{groesse} \setinterfaceconstant{small}{klein} +\setinterfaceconstant{solution}{solution} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{sorttype} \setinterfaceconstant{source}{quelle} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index b700d2802..89ef990c7 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -6449,6 +6449,18 @@ return { }, }, ["constants"]={ + ["less"]={ + ["en"]="less", + ["nl"]="minder", + }, + ["more"]={ + ["en"]="more", + ["nl"]="meer", + }, + ["solution"]={ + ["en"]="solution", + ["nl"]="oplossing", + }, ["anchor"]={ ["en"]="anchor", ["nl"]="anker", diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index c156a0fa3..6325765e0 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{leftsubsentence} \setinterfaceconstant{lefttext}{lefttext} \setinterfaceconstant{leftwidth}{leftwidth} +\setinterfaceconstant{less}{less} \setinterfaceconstant{level}{level} \setinterfaceconstant{levels}{levels} \setinterfaceconstant{limittext}{limittext} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{minheight} \setinterfaceconstant{minwidth}{minwidth} \setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{more}{more} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{name} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{sign} \setinterfaceconstant{size}{size} \setinterfaceconstant{small}{small} +\setinterfaceconstant{solution}{solution} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{sorttype} \setinterfaceconstant{source}{source} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index e48e583ea..6b3acd811 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{sousphrasegauche} \setinterfaceconstant{lefttext}{textegauche} \setinterfaceconstant{leftwidth}{largeurgauche} +\setinterfaceconstant{less}{less} \setinterfaceconstant{level}{niveau} \setinterfaceconstant{levels}{niveaux} \setinterfaceconstant{limittext}{limittext} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{hauteurmin} \setinterfaceconstant{minwidth}{largeurmin} \setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{more}{more} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{nom} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{signe} \setinterfaceconstant{size}{dimension} \setinterfaceconstant{small}{petit} +\setinterfaceconstant{solution}{solution} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{sorttype} \setinterfaceconstant{source}{origine} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 0af7edde5..c901f1816 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{sottofrasesinistra} \setinterfaceconstant{lefttext}{testosinistro} \setinterfaceconstant{leftwidth}{ampiezzasinistra} +\setinterfaceconstant{less}{less} \setinterfaceconstant{level}{livello} \setinterfaceconstant{levels}{livelli} \setinterfaceconstant{limittext}{limittext} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{altezzamin} \setinterfaceconstant{minwidth}{ampiezzamin} \setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{more}{more} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{nome} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{segno} \setinterfaceconstant{size}{dimensione} \setinterfaceconstant{small}{piccolo} +\setinterfaceconstant{solution}{solution} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{sorttype} \setinterfaceconstant{source}{origine} diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 404af4f05..7b92fd200 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -212,6 +212,7 @@ return { "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", + "getdummyparameters", "dummyparameter", "directdummyparameter", -- "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index 88d3ffe58..07165f02c 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{linkersubzin} \setinterfaceconstant{lefttext}{linkertekst} \setinterfaceconstant{leftwidth}{linkerbreedte} +\setinterfaceconstant{less}{minder} \setinterfaceconstant{level}{niveau} \setinterfaceconstant{levels}{niveaus} \setinterfaceconstant{limittext}{limiettekst} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{minhoogte} \setinterfaceconstant{minwidth}{minbreedte} \setinterfaceconstant{monthconversion}{maandconversie} +\setinterfaceconstant{more}{meer} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{naam} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{teken} \setinterfaceconstant{size}{formaat} \setinterfaceconstant{small}{klein} +\setinterfaceconstant{solution}{oplossing} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{sortering} \setinterfaceconstant{source}{bron} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index 8bf67b339..6f7e245ff 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{زیرجملهچپ} \setinterfaceconstant{lefttext}{متنچپ} \setinterfaceconstant{leftwidth}{عرضخط} +\setinterfaceconstant{less}{less} \setinterfaceconstant{level}{مرحله} \setinterfaceconstant{levels}{مرحلهها} \setinterfaceconstant{limittext}{مرزمتن} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{کمترینارتفاع} \setinterfaceconstant{minwidth}{کمترینعرض} \setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{more}{more} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{نام} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{علامت} \setinterfaceconstant{size}{اندازه} \setinterfaceconstant{small}{کوچک} +\setinterfaceconstant{solution}{solution} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{ترتیبتایپ} \setinterfaceconstant{source}{منبع} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index 8495878cd..015603b9b 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -773,6 +773,7 @@ \setinterfaceconstant{leftsubsentence}{subpropozitiestanga} \setinterfaceconstant{lefttext}{textstanga} \setinterfaceconstant{leftwidth}{latimestanga} +\setinterfaceconstant{less}{less} \setinterfaceconstant{level}{nivel} \setinterfaceconstant{levels}{nivele} \setinterfaceconstant{limittext}{limittext} @@ -811,6 +812,7 @@ \setinterfaceconstant{minheight}{inaltimeminima} \setinterfaceconstant{minwidth}{latimeminima} \setinterfaceconstant{monthconversion}{monthconversion} +\setinterfaceconstant{more}{more} \setinterfaceconstant{n}{n} \setinterfaceconstant{name}{nume} \setinterfaceconstant{namesep}{namesep} @@ -973,6 +975,7 @@ \setinterfaceconstant{sign}{semn} \setinterfaceconstant{size}{dimensiune} \setinterfaceconstant{small}{mic} +\setinterfaceconstant{solution}{solution} \setinterfaceconstant{sort}{sort} \setinterfaceconstant{sorttype}{sorttype} \setinterfaceconstant{source}{sursa} diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index 06e6787c6..1eecbaf2f 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -520,7 +520,6 @@ \definesystemvariable {nm} % Nummering \definesystemvariable {np} % NaastPlaatsen \definesystemvariable {nr} % Nummeren -\definesystemvariable {ob} % OBjects \definesystemvariable {oi} % OmlijndInstellingen \definesystemvariable {ol} % OmLijnd \definesystemvariable {od} % Omlijnd Defaults (simple) @@ -530,7 +529,6 @@ \definesystemvariable {ph} % ParagrapH \definesystemvariable {pn} % PaginaNummer \definesystemvariable {pr} % PRogrammas -\definesystemvariable {ps} % PoSitioneren \definesystemvariable {px} % Parallel \definesystemvariable {py} % PropertYs \definesystemvariable {pv} % PublicationVariable diff --git a/tex/context/base/node-par.mkiv b/tex/context/base/node-par.mkiv deleted file mode 100644 index 685167e8a..000000000 --- a/tex/context/base/node-par.mkiv +++ /dev/null @@ -1,82 +0,0 @@ -%D \module -%D [ file=node-par, -%D version=2008.09.30, -%D title=\CONTEXT\ Node Macros, -%D subtitle=Paragraph Building, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\writestatus{loading}{ConTeXt Node Macros / Paragraph Building} - -%D This is very experimental, undocumented, subjected to changes, etc. just as -%D the underlying interfaces. - -% \enableparbuilders -% -% \startparbuilder[default] -% \input tufte \par -% \startparbuilder[oneline] -% \input tufte \par -% \stopparbuilder -% \input tufte \par -% \stopparbuilder - -\unprotect - -\registerctxluafile{node-par}{1.001} - -\definesystemattribute[parbuilder][public] - -% todo auto-enable - -% management (enable/disable) is global and will move to lua - -\installcorenamespace {parbuilder} - -\newcount\c_node_paragraphs_n_of_builders - -\let\m_node_paragraphs_current_builder\empty - -\unexpanded\def\defineparbuilder[#1]% - {\global\advance\c_node_paragraphs_n_of_builders\plusone - \ctxlua{builders.paragraphs.constructors.register("#1",\number\c_node_paragraphs_n_of_builders)}% - \setxvalue{\??parbuilder#1}{\attribute\parbuilderattribute\number\c_node_paragraphs_n_of_builders}} - -\unexpanded\def\startparbuilder[#1]% - {\edef\m_node_paragraphs_current_builder{\number\attribute\parbuilderattribute}% - \globalpushmacro\m_node_paragraphs_current_builder - \getvalue{\??parbuilder#1}\relax - \node_paragraphs_builders_check} - -\unexpanded\def\stopparbuilder - {\ifhmode\par\fi - \globalpopmacro\m_node_paragraphs_current_builder - \attribute\parbuilderattribute\m_node_paragraphs_current_builder\relax - \node_paragraphs_builders_check} - -\unexpanded\def\setmainparbuilder[#1]% - {\ctxlua{builders.paragraphs.constructors.set("#1")}} - -% no high level interface, after all implementing a linebreaker is not something that -% the average user will do - -\defineparbuilder[default] % just for testing -\defineparbuilder[oneline] % just for testing -\defineparbuilder[basic] % just for testing - -\def\enableparbuilders {\ctxlua{builders.paragraphs.constructors.enable ()}} -\def\disableparbuilders{\ctxlua{builders.paragraphs.constructors.disable()}} - -\def\node_paragraphs_builders_check % can be made more efficient as we don't want to do this too often - {\ifcase\attribute\parbuilderattribute - \disableparbuilders - \else - \enableparbuilders - \fi} - -\protect \endinput diff --git a/tex/context/base/pack-bar.mkiv b/tex/context/base/pack-bar.mkiv index 6967173e2..692b6f1f3 100644 --- a/tex/context/base/pack-bar.mkiv +++ b/tex/context/base/pack-bar.mkiv @@ -13,55 +13,80 @@ \writestatus{loading}{ConTeXt Packaging Macros / Bars} -%D This code has been moved from scrn-int to here (was some old -%D experimental code). It could be in scrn-bar but it's static. \unprotect +%D This code has been moved from scrn-int to here (was some old +%D experimental code). It could be in scrn-bar but it's static. In +%D the meantime the interface has been adapted to a key|/|value one. +%D %D \startbuffer -%D \dorecurse{10} -%D {\horizontalpositionbar -%D \pos\recurselevel \min1 \max10 -%D \token\framed{\recurselevel}% -%D \\} +%D \dorecurse{10}{ +%D \ruledhbox{\horizontalpositionbar[n=#1,min=1,max=10,text=!,color=red]} +%D \par +%D } +%D \stopbuffer +%D +%D \typebuffer \stoplinecorrection \getbuffer \stoplinecorrection %D -%D \hbox to 15em -%D {\hss -%D \dorecurse{10} -%D {\verticalpositionbar\pos\recurselevel\min1\max10\token\blackrule\\ -%D \hss}} +%D \startbuffer +%D \dorecurse{10}{ +%D \ruledhbox{\horizontalgrowingbar[n=#1,min=1,max=10,text=!,color=red]} +%D \par +%D } %D \stopbuffer +%D +%D \typebuffer \stoplinecorrection \getbuffer \stoplinecorrection + +\installcorenamespace{positionbar} + +\installsimplecommandhandler \??positionbar {positionbar} + +\setuppositionbar + [\c!min=1, + \c!max=1, + \c!n=1, + \c!text=?, + \c!width=\emwidth, + \c!height=\strutheight, + \c!depth=\strutdepth] -\def\horizontalpositionbar\pos#1\min#2\max#3\token#4\\% +\unexpanded\def\horizontalpositionbar[#1]% {\hbox to \hsize - {\hskip\zeropoint\!!plus #1\!!fill - \hskip\zeropoint\!!plus-#2\!!fill - #4\relax - \hskip\zeropoint\!!plus #3\!!fill - \hskip\zeropoint\!!plus-#1\!!fill}} + {\setuppositionbar[#1]% + \usepositionbarstyleandcolor\c!style\c!color + \hskip\zeropoint\!!plus \positionbarparameter\c!n \!!fill + \hskip\zeropoint\!!plus-\positionbarparameter\c!min\!!fill + \positionbarparameter\c!text\relax + \hskip\zeropoint\!!plus \positionbarparameter\c!max\!!fill + \hskip\zeropoint\!!plus-\positionbarparameter\c!n \!!fill}} -\def\verticalpositionbar\pos#1\min#2\max#3\token#4\\% +\unexpanded\def\verticalpositionbar[#1]% {\vbox to \vsize - {\vskip\zeropoint\!!plus #1\!!fill - \vskip\zeropoint\!!plus-#2\!!fill - \hbox{#4}\relax - \vskip\zeropoint\!!plus #3\!!fill - \vskip\zeropoint\!!plus-#1\!!fill}} + {\setuppositionbar[#1]% + \usepositionbarstyleandcolor\c!style\c!color + \vskip\zeropoint\!!plus \positionbarparameter\c!n \!!fill + \vskip\zeropoint\!!plus-\positionbarparameter\c!min\!!fill + \positionbarparameter\c!text\relax + \vskip\zeropoint\!!plus \positionbarparameter\c!max\!!fill + \vskip\zeropoint\!!plus-\positionbarparameter\c!n \!!fill}} -\def\horizontalgrowingbar\pos#1\min#2\max#3\height#4\depth#5\\% +\unexpanded\def\horizontalgrowingbar[#1]% {\hbox to \hsize - {\scratchcounter\numexpr#1-#2+\plusone\relax - \leaders\vrule\hskip\zeropoint\!!plus \scratchcounter\!!fill - \vrule\!!width\zeropoint\!!height#4\!!depth#5% - \hskip\zeropoint\!!plus #3\!!fill - \hskip\zeropoint\!!plus-#1\!!fill}} + {\setuppositionbar[#1]% + \usepositionbarstyleandcolor\c!style\c!color + \leaders\vrule\hskip\zeropoint\!!plus \numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\!!fill + \vrule\!!width\zeropoint\!!height\positionbarparameter\c!height\!!depth\positionbarparameter\c!depth + \hskip\zeropoint\!!plus \positionbarparameter\c!max\!!fill + \hskip\zeropoint\!!plus-\positionbarparameter\c!n \!!fill}} -\def\verticalgrowingbar\pos#1\min#2\max#3\width#4\\% +\unexpanded\def\verticalgrowingbar[#1]% {\vbox to \vsize - {\scratchcounter\numexpr#1-#2+\plusone\relax - \leaders\hrule\vskip\zeropoint\!!plus\scratchcounter\!!fill - \hrule\!!width#4\!!height\zeropoint\!!depth\zeropoint - \vskip\zeropoint\!!plus #3\!!fill - \vskip\zeropoint\!!plus-#1\!!fill}} + {\setuppositionbar[#1]% + \usepositionbarstyleandcolor\c!style\c!color + \leaders\hrule\vskip\zeropoint\!!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\!!fill + \hrule\!!width\positionbarparameter\c!width\!!height\zeropoint\!!depth\zeropoint + \vskip\zeropoint\!!plus \positionbarparameter\c!max\!!fill + \vskip\zeropoint\!!plus-\positionbarparameter\c!n \!!fill}} \protect \endinput diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv index 41a17953b..b36ae1f11 100644 --- a/tex/context/base/pack-box.mkiv +++ b/tex/context/base/pack-box.mkiv @@ -13,7 +13,9 @@ \writestatus{loading}{ConTeXt Packaging Macros / Boxes} -% to be cleaned up +% to be cleaned up (boring ... so when on long trip or so) +% to be documented (up to users) +% some code can be sped up %D This module contains all kind of macros for moving content %D around. Many macros here come from other modules, but @@ -32,17 +34,8 @@ \definelayer[\v!text+1][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight] \definelayer[\v!text+2][\c!position=\v!yes,\c!region=,\c!width=\overlaywidth,\c!height=\overlayheight] -% \unexpanded\def\positionregionlayer#1#2% -% {\composedlayer{#2}} -% -% \def\internaltextoverlay#1% will become more generic and installable -% {\startoverlay % i.e. probably an overlay by itself -% {\positionregionoverlay\textanchor{\v!text#1}}% see later -% {\positionregionlayer \textanchor{\v!text#1}}% -% \stopoverlay} - -\def\internaltextoverlay#1% will become more generic and installable - {\startoverlay % i.e. probably an overlay by itself +\unexpanded\def\internaltextoverlay#1% will become more generic and installable + {\startoverlay % i.e. probably an overlay by itself {\positionregionoverlay\textanchor{\v!text#1}}% see later {\composedlayer {\v!text#1}}% \stopoverlay} @@ -52,75 +45,6 @@ \defineoverlay[\v!text+1][\internaltextoverlay{+1}] \defineoverlay[\v!text+2][\internaltextoverlay{+2}] -% to be documented - -% \definelayer[anchor] -% -% \unexpanded\def\defineanchor -% {\doquadrupleempty\dodefineanchor} -% -% \def\dodefineanchor[#1][#2][#3][#4]% -% {\setvalue{\??an#1}{\dodefinedanchor[#2][#3][#4]}} -% -% \def\dodefinedanchor[#1][#2][#3]% -% {\def\docommand[##1][##2]% -% {\ifsecondargument -% \def\next{\dodoanchorT[#1][#2,##1][#3,##2]}% -% \else\iffirstargument -% \def\next{\dodoanchorT[#1][#2,##1][#2,##1]}% -% \else -% \def\next{\dodoanchorT[#1][#2][#3]}% -% \fi\fi -% \next}% -% \dodoubleempty\docommand} -% -% \unexpanded\def\anchor -% {\dosingleargument\pack_anchor} -% -% \def\pack_anchor[#1]% -% {\ifcsname\??an#1\endcsname\@EA\nonoanchor\else\@EA\dodoanchor\fi[#1]} -% -% \def\nonoanchor[#1]% -% {\csname\??an#1\endcsname} -% -% \def\dodoanchor[#1]% -% {\dotripleempty\dododoanchor[#1]} -% -% \def\dododoanchor -% {\ifthirdargument -% \expandafter\dodoanchorT -% \else -% \expandafter\dodoanchorS -% \fi} -% -% \def\dodoanchorS[#1][#2][#3]% -% {\dodoanchorT[#1][#2][#2]} -% -% \def\dodoanchorT[#1][#2][#3]% brrr: we need to apply offset only once .. a bit messy -% {\dowithnextbox -% {\bgroup -% % \checktextbackgrounds -% \setbox\scratchbox\emptyhbox -% \wd\scratchbox\nextboxwd -% \ht\scratchbox\nextboxht -% \dp\scratchbox\nextboxdp -% \setlayer -% [anchor] -% [\c!width=\wd\scratchbox, -% \c!height=\ht\scratchbox, -% \c!offset=\!!zeropoint, -% #2,#3] -% {\setlayer[#1]{\flushnextbox}}% -% \framed -% [#2, -% \c!background=anchor, -% \c!offset=\v!overlay, -% \c!frame=\v!off, -% #3] -% {\box\scratchbox}% -% \egroup}% -% \vbox} - \installcorenamespace {anchor} \unexpanded\def\defineanchor @@ -204,22 +128,22 @@ % collectors -\def\@@collectorbox{@@collectorbox} +\installcorenamespace{collectorbox} \unexpanded\def\definecollector {\dodoubleargument\dodefinecollector} \def\dodefinecollector[#1][#2]% - {\ifcsname\@@collectorbox#1\endcsname \else - \expandafter\newbox\csname\@@collectorbox#1\endcsname + {\ifcsname\??collectorbox#1\endcsname \else + \expandafter\newbox\csname\??collectorbox#1\endcsname \fi \resetcollector[#1]% \setupcollector [#1] [\c!state=\v!start, - \c!x=\!!zeropoint,\c!y=\!!zeropoint, - \c!offset=\!!zeropoint,\c!rotation=, % geen 0 ! - \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, + \c!x=\zeropoint,\c!y=\zeropoint, + \c!offset=\zeropoint,\c!rotation=, % geen 0 ! + \c!hoffset=\zeropoint,\c!voffset=\zeropoint, \c!location=rb,\c!corner=,#2]} \unexpanded\def\setupcollector @@ -237,7 +161,7 @@ \forgetall \dontcomplain \dowithnextbox - {\ifcsname\@@collectorbox#1\endcsname + {\ifcsname\??collectorbox#1\endcsname \dodosetcollector[#1][#2]% \else \writestatus{collector}{unknown layer #1}% @@ -249,7 +173,7 @@ \def\dodosetcollector[#1][#2]% todo: keep reference point {\def\currentcollector{#1}% - \chardef\collectorbox\csname\@@collectorbox#1\endcsname + \chardef\collectorbox\csname\??collectorbox#1\endcsname \getparameters[\??cb#1][#2]% \d_pack_layers_x_size\wd\collectorbox \d_pack_layers_y_size\ht\collectorbox @@ -321,14 +245,14 @@ \fi} \def\flushcollector[#1]% - {\ifcsname\@@collectorbox#1\endcsname + {\ifcsname\??collectorbox#1\endcsname \doifnotvalue{\??cb#1\c!state}\v!stop {\vbox {\hbox {\doifelsevalue{\??cb#1\c!state}\v!repeat {\let\next\copy}{\let\next\box}% - \raise\dp\csname\@@collectorbox#1\endcsname - \next\csname\@@collectorbox#1\endcsname}}}% + \raise\dp\csname\??collectorbox#1\endcsname + \next\csname\??collectorbox#1\endcsname}}}% \else \writestatus{collector}{unknown collector #1}% \fi} @@ -336,8 +260,8 @@ \def\composedcollector#1{\flushcollector[#1]} \def\resetcollector[#1]% - {\ifcsname\@@collectorbox#1\endcsname - \global\setbox\csname\@@collectorbox#1\endcsname\emptybox + {\ifcsname\??collectorbox#1\endcsname + \global\setbox\csname\??collectorbox#1\endcsname\emptybox \fi} \def\adaptcollector @@ -346,7 +270,7 @@ \def\doadaptcollector[#1][#2]% % a typical case where \global\wd looks better in the code {\bgroup \def\currentcollector{#1}% - \chardef\collectorbox\csname\@@collectorbox#1\endcsname + \chardef\collectorbox\csname\??collectorbox#1\endcsname \getparameters[\??cb#1][\c!voffset=\zeropoint,\c!hoffset=\zeropoint,#2]% \scratchdimen\wd\collectorbox \advance\scratchdimen\collectorparameter\c!hoffset @@ -406,51 +330,6 @@ % [frame=on,offset=0pt] % {gans} % {\externalfigure[koe][width=3cm]} - -% lean and mean: -% -% \installcorenamespace {layeredtext} -% -% \newdimen\d_pack_layeredtexts_width -% \newdimen\d_pack_layeredtexts_height -% -% \definelayer -% [\??layeredtextlayer] -% -% \setuplayer -% [\??layeredtextlayer]% -% [\c!width=\d_pack_layeredtexts_width,\c!height=\d_pack_layeredtexts_height]% -% -% \unexpanded\def\layeredtext -% {\dodoubleempty\dolayeredtext} -% -% \def\dolayeredtext[#1][#2]#3% -% {\bgroup -% \dowithnextbox -% {\d_pack_layeredtexts_width \wd\nextbox -% \d_pack_layeredtexts_height\ht\nextbox -% \begingroup % preserve \nextbox -% \setlayer -% [\??layeredtextlayer]% -% [#1]% -% {\getparameters[\??du][\c!style=,\c!color=,#2]% -% \dousestyleparameter\@@dustyle -% \setupinterlinespace -% \framed -% [\c!frame=\v!overlay,\c!foregroundcolor=\@@ducolor,\c!foregroundstyle=\@@dustyle,#2]% -% {#3}}% -% \endgroup -% \framed -% [\c!offset=\v!overlay, -% \c!frame=\v!off, -% \c!background={\v!foreground,\??layeredtextlayer}, -% \c!width=\d_pack_layeredtexts_width, -% \c!height=\d_pack_layeredtexts_height]% -% {\flushnextbox}% -% \egroup}% -% \hbox} -% -% maybe faster but more code: \installcorenamespace {layeredtext} \installcorenamespace {layeredtextlayer} @@ -531,15 +410,15 @@ % [frame=on,offset=0pt] % {gans} % {\externalfigure[koe][width=3cm]} - -\def\ornamenttext - {\dodoubleempty\doornamenttext} -\def\doornamenttext[#1][#2]% +\unexpanded\def\ornamenttext + {\dodoubleempty\pack_ornament_text} + +\def\pack_ornament_text[#1][#2]% {\bgroup \doifassignmentelse{#1} - {\getparameters[\s!dummy][\c!alternative=\v!a,#1]% - \doifelse\dummyalternative\v!a + {\getdummyparameters[\c!alternative=\v!a,#1]% + \doifelse{\directdummyparameter\c!alternative}\v!a {\egroup\collectedtext}% {\egroup\layeredtext }% [#1][#2]}% @@ -549,7 +428,7 @@ {\dotripleempty\dodefineornament} \def\dodefineornament[#1][#2][#3]% - {\setvalue{#1}{\doornamenttext[#2][#3]}} + {\setuvalue{#1}{\pack_ornament_text[#2][#3]}} % \defineornament % [affiliation] @@ -582,7 +461,7 @@ % [background=color,style=\ss\tfxx,backgroundcolor=white,offset=0pt] % % \affiliation{drawing}{\externalfigure[hakker][width=3cm]} - + % pas op: aanpassen aan nieuwe layer hoek ankers en columnset \newcount\nofbleeds % per pag @@ -680,9 +559,13 @@ \fi \egroup} -\setupbleeding[\c!stretch=\v!yes] +\setupbleeding + [\c!stretch=\v!yes] -\defineexternalfigure[bleed][\c!width=\bleedwidth,\c!height=\bleedheight] % should be \v!bleed +\defineexternalfigure + [bleed] % should be \v!bleed + [\c!width=\bleedwidth, + \c!height=\bleedheight] % \placefigure[left]{none} % {\bleed[width=5cm,height=3cm,location=lt]{\externalfigure[koe][bleed]}} @@ -804,22 +687,6 @@ [\v!middle] [\c!corner=\v!middle,\c!location=\v!middle] -% \definelayerpreset -% [\v!middle\v!top] -% [\c!location=\v!bottom,\c!hoffset=.5\layerwidth] - -% \definelayerpreset -% [\v!middle\v!bottom] -% [\c!location=\v!top,\c!hoffset=.5\layerwidth,\c!voffset=\layerheight] - -% \definelayerpreset -% [\v!middle\v!left] -% [\c!location=\v!right,\c!voffset=.5\layerheight] - -% \definelayerpreset -% [\v!middle\v!right] -% [\c!location=\v!left,\c!hoffset=\layerwidth,\c!voffset=.5\layerheight] - \definelayerpreset [\v!middle\v!top] [\c!location=\v!bottom,\c!corner=\v!top,\c!dx=.5\layerwidth] @@ -911,9 +778,9 @@ {\getparameters[\??ox] [\c!x=\zeropoint, \c!y=\zeropoint, - \c!width=\nextboxwd, - \c!height=\nextboxht, - \c!depth=\nextboxdp, + \c!width=\wd\nextbox, + \c!height=\ht\nextbox, + \c!depth=\dp\nextbox, \c!location=, \c!leftoffset=\zeropoint, \c!rightoffset=\zeropoint, @@ -1020,15 +887,14 @@ \unexpanded\def\phantombox[#1]% == \framed[\c!empty=\v!yes,\c!offset=\v!overlay,#1]{} {\hbox\bgroup - \getparameters - [\??ol] % brrr + \getdummyparameters [\c!width=\zeropoint,% \c!height=\zeropoint,% \c!depth=\zeropoint,#1]% \setbox\scratchbox\emptyhbox - \wd\scratchbox\@@olwidth - \ht\scratchbox\@@olheight - \dp\scratchbox\@@oldepth + \wd\scratchbox\directdummyparameter\c!width + \ht\scratchbox\directdummyparameter\c!height + \dp\scratchbox\directdummyparameter\c!depth \box\scratchbox \egroup} diff --git a/tex/context/base/pack-cut.mkiv b/tex/context/base/pack-cut.mkiv new file mode 100644 index 000000000..1afccee50 --- /dev/null +++ b/tex/context/base/pack-cut.mkiv @@ -0,0 +1,162 @@ +%D \module +%D [ file=pack-cut, % comes from core-vis/trac-vis +%D version=1996.06.01, +%D title=\CONTEXT\ Packaging Macros, +%D subtitle=Cut boxes, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D \macros +%D {makecutbox, cuthbox, cutvbox, cutvtop} +%D +%D Although mainly used for marking the page, these macros can +%D also serve local use. +%D +%D \startbuffer +%D \setbox0=\vbox{a real \crlf vertical box} \makecutbox0 +%D \stopbuffer +%D +%D \typebuffer +%D +%D This marked \type{\vbox} shows up as: +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection +%D +%D The alternative macros are used as: +%D +%D \startbuffer +%D \cuthbox{a made cut box} +%D \stopbuffer +%D +%D \typebuffer +%D +%D This is typeset as: +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection +%D +%D By setting the next macros one can influence the length of +%D the marks as well as the horizontal and vertical divisions. + +\newdimen\d_pack_cutmarks_width +\newdimen\d_pack_cutmarks_height +\newdimen\d_pack_cutmarks_depth + +\newcount\horizontalcutmarks \horizontalcutmarks \plustwo +\newcount\verticalcutmarks \verticalcutmarks \plustwo +\newcount\cutmarkoffset \cutmarkoffset \plusone + +\let\cutmarksymbol \relax +\let\cutmarktoptext \empty +\let\cutmarkbottomtext\empty +\let\cutmarkhoffset \empty +\let\cutmarkvoffset \empty +\def\cutmarklength {2\bodyfontsize} + +\unexpanded\def\horizontalcuts + {\normalhbox to \d_pack_cutmarks_width + {\dorecurse\horizontalcutmarks{\vrule\!!width\boxrulewidth\!!height\cutmarklength\normalhfill}% + \unskip}} + +\unexpanded\def\verticalcuts + {\normalvbox to \dimexpr\d_pack_cutmarks_height+\d_pack_cutmarks_depth\relax + {\hsize\cutmarklength + \dorecurse\verticalcutmarks{\vrule\!!height\boxrulewidth\!!width\hsize\normalvfill}% + \unskip}} + +\unexpanded\def\baselinecuts + {\ifdim\d_pack_cutmarks_depth>\zeropoint + \normalvbox to \dimexpr\d_pack_cutmarks_height+\d_pack_cutmarks_depth\relax + {\hsize\dimexpr\cutmarklength/2\relax + \normalvskip\zeropoint\!!plus\d_pack_cutmarks_height + \vrule\!!height\boxrulewidth\!!width\hsize + \normalvskip\zeropoint\!!plus\d_pack_cutmarks_depth}% + \fi} + +\unexpanded\def\cutmarksymbols#1% + {\normalhbox to \d_pack_cutmarks_width + {\setbox\scratchbox\normalhbox to \cutmarklength + {\normalhss\infofont\cutmarksymbol\normalhss}% + \normalhss + \normalvbox to \cutmarklength + {\scratchdimen\dimexpr\cutmarklength/2\relax + \scratchskip \ifx\cutmarkhoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi + \normalvss + \hbox to \d_pack_cutmarks_width + {\llap{\copy\scratchbox\normalhskip\scratchskip}% + \normalhskip\scratchdimen\hss\infofont#1\hss\normalhskip\scratchdimen + \rlap{\normalhskip\scratchskip\copy\scratchbox}}% + \normalvss}% + \normalhss}} + +\unexpanded\def\makecutbox#1% + {\bgroup + \d_pack_cutmarks_height\ht#1% + \d_pack_cutmarks_depth \dp#1% + \d_pack_cutmarks_width \wd#1% + \setbox#1\normalhbox + {\dontcomplain + \forgetall + \boxmaxdepth\maxdimen + \offinterlineskip + \scratchdimen\dimexpr\cutmarklength/2\relax + \hsize\d_pack_cutmarks_width + \setbox\scratchbox\normalvbox + {\setbox\scratchbox\normalhbox{\horizontalcuts}% + \scratchskip\ifx\cutmarkvoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkvoffset\fi + \tlap{\copy\scratchbox\normalvskip\scratchskip}% + \hbox to \d_pack_cutmarks_width + {\scratchskip\ifx\cutmarkhoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi + \setbox\scratchbox\normalhbox{\verticalcuts}% + \llap{\copy\scratchbox\normalhskip\scratchskip}% + \ifdim\d_pack_cutmarks_depth=\zeropoint + \normalhfill + \else + \bgroup + \setbox\scratchbox\normalhbox{\baselinecuts}% + \llap{\copy\scratchbox\normalhskip\scratchskip}% + \normalhfill + \rlap{\normalhskip\scratchskip\copy\scratchbox}% + \egroup + \fi + \rlap{\normalhskip\scratchskip\copy\scratchbox}}% + \blap{\normalvskip\scratchskip\copy\scratchbox}}% + \ht\scratchbox\d_pack_cutmarks_height + \dp\scratchbox\d_pack_cutmarks_depth + \wd\scratchbox\zeropoint + \startcolor[\defaulttextcolor]% + \box\scratchbox + \ifx\cutmarksymbol\relax \else + \setbox\scratchbox\normalvbox + {\scratchskip\ifx\cutmarkvoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkvoffset\fi + \vskip-\dimexpr\scratchskip+\cutmarklength\relax + \normalhbox{\cutmarksymbols\cutmarktoptext}% + \vskip\dimexpr\scratchskip+\d_pack_cutmarks_height+\d_pack_cutmarks_depth+\scratchskip\relax + \normalhbox{\cutmarksymbols\cutmarkbottomtext}}% + \ht\scratchbox\d_pack_cutmarks_height + \dp\scratchbox\d_pack_cutmarks_depth + \wd\scratchbox\zeropoint + \box\scratchbox + \fi + \stopcolor + \box#1}% + \wd#1\d_pack_cutmarks_width + \ht#1\d_pack_cutmarks_height + \dp#1\d_pack_cutmarks_depth + \egroup} + +\unexpanded\def\cuthbox{\normalhbox\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalhbox} +\unexpanded\def\cutvbox{\normalvbox\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalvbox} +\unexpanded\def\cutvtop{\normalvtop\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalvtop} + +\protect \endinput diff --git a/tex/context/base/pack-obj.lua b/tex/context/base/pack-obj.lua index c580aaa62..a54a48d22 100644 --- a/tex/context/base/pack-obj.lua +++ b/tex/context/base/pack-obj.lua @@ -46,15 +46,30 @@ end function jobobjects.number(tag,default) local o = collected[tag] or tobesaved[tag] - context((o and o[1]) or default) + return o and o[1] or default end function jobobjects.page(tag,default) local o = collected[tag] or tobesaved[tag] - context((o and o[2]) or default) + return o and o[2] or default end -function jobobjects.doifelse(tag) +-- interface + +commands.saveobject = jobobjects.save +commands.setobject = jobobjects.set + +function commands.objectnumber(tag,default) + local o = collected[tag] or tobesaved[tag] + context(o and o[1] or default) +end + +function commands.objectpage(tag,default) + local o = collected[tag] or tobesaved[tag] + context(o and o[2] or default) +end + +function commands.doifobjectreferencefoundelse(tag) commands.testcase(collected[tag] or tobesaved[tag]) end diff --git a/tex/context/base/pack-obj.mkiv b/tex/context/base/pack-obj.mkiv index 6c9848a01..1e2c392a2 100644 --- a/tex/context/base/pack-obj.mkiv +++ b/tex/context/base/pack-obj.mkiv @@ -105,29 +105,27 @@ % % \everyobject{\the\pdfbackendeveryxform} % -% \let\doresetobjects\relax -% -% \def\setobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\the\everyobject\dowithnextbox{\dosetobject{#1}{#2}}} -% \def\settightobject#1#2{\begingroup\objectoff\zeropoint \inobjecttrue\the\everyobject\dowithnextbox{\dosetobject{#1}{#2}}} +% \unexpanded\def\setobject #1#2{\begingroup\objectoff\objectoffset\inobjecttrue\the\everyobject\dowithnextbox{\pack_objects_set{#1}{#2}}} +% \unexpanded\def\settightobject#1#2{\begingroup\objectoff\zeropoint \inobjecttrue\the\everyobject\dowithnextbox{\pack_objects_set{#1}{#2}}} % % \let\objectsetvbox\vbox %\def\objectsetvbox{\ruledvbox} % \let\objectgetvbox\vbox %\def\objectgetvbox{\ruledvbox} % \let\objectsethbox\hbox %\def\objectsethbox{\ruledhbox} % \let\objectgethbox\hbox %\def\objectgethbox{\ruledhbox} % -% \def\dosetobject#1#2% +% \unexpanded\def\pack_objects_set#1#2% % {\objectwd\wd\nextbox % \objectht\ht\nextbox % \objectdp\dp\nextbox % \ifdim\objectoff=\zeropoint\relax % \setbox\objectbox\box\nextbox % \else -% \setbox\objectbox\objectsetvbox spread 2\objectoff{\vss\objectsethbox spread 2\objectoff{\hss\flushnextbox\hss}\vss}% +% \setbox\objectbox\objectsetvbox spread 2\objectoff{\vss\objectsethbox spread 2\objectoff{\hss\box\nextbox\hss}\vss}% % \fi % \ctxlua{objects.register("#1::#2")}% % \endgroup} % -% \def\getobject#1#2% +% \unexpanded\def\getobject#1#2% % {\begingroup % \ctxlua{objects.restore("#1::#2")}% % \ifdim\objectoff=\zeropoint\relax \else @@ -140,7 +138,7 @@ % \box\objectbox % \endgroup} % -% \def\getpageobject#1#2% +% \unexpanded\def\getpageobject#1#2% % {\begingroup % \ctxlua{objects.restore("#1::#2")}% % \ifdim\objectoff=\zeropoint\relax @@ -155,25 +153,25 @@ % \box\objectbox % \endgroup} % -% \def\setobjectdirectly #1#2{\ctxlua{objects.register("#1::#2")}} -% \def\getobjectdirectly #1#2{\ctxlua{objects.restore ("#1::#2")}} -% \def\getobjectdimensions #1#2{\ctxlua{objects.restore ("#1::#2")}} -% \def\doifobjectfoundelse #1#2{\ctxlua{objects.doifelse("#1::#2")}} -% \def\doifobjectreferencefoundelse#1#2{\ctxlua{objects.doifelse("#1::#2")}} +% \unexpanded\def\setobjectdirectly #1#2{\ctxlua{objects.register("#1::#2")}} +% \unexpanded\def\getobjectdirectly #1#2{\ctxlua{objects.restore ("#1::#2")}} +% \unexpanded\def\getobjectdimensions #1#2{\ctxlua{objects.restore ("#1::#2")}} +% \unexpanded\def\doifobjectfoundelse #1#2{\ctxlua{objects.doifelse("#1::#2")}} +% \unexpanded\def\doifobjectreferencefoundelse#1#2{\ctxlua{objects.doifelse("#1::#2")}} % % \let\objectreferenced\relax % \let\driverreferenced\relax % -% \def\doregisterobjectreference{\writestatus{objects}{obsolete: register object reference}\gobblethreearguments} -% \def\dooverloadobjectreference{\writestatus{objects}{obsolete: overload object reference}\gobblethreearguments} -% \def\dosetobjectreference {\writestatus{objects}{obsolete: set object reference}\gobblethreearguments} -% \def\dosetdriverreference {\writestatus{objects}{obsolete: set driver reference}\gobblethreearguments} +% \unexpanded\def\pack_objects_register_reference{\writestatus{objects}{obsolete: register object reference}\gobblethreearguments} +% \unexpanded\def\pack_objects_overload_reference{\writestatus{objects}{obsolete: overload object reference}\gobblethreearguments} +% \unexpanded\def\dosetobjectreference {\writestatus{objects}{obsolete: set object reference}\gobblethreearguments} +% \unexpanded\def\dosetdriverreference {\writestatus{objects}{obsolete: set driver reference}\gobblethreearguments} % % \def\defaultobjectreference{0} % \def\defaultobjectpage {\realfolio} % -% \def\dogetobjectreference #1#2#3{\xdef#3{\ctxlua{objects.reference("#1::#2)}}} -% \def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxlua{objects.page("#1::#2))}}} +% \unexpanded\def\dogetobjectreference #1#2#3{\xdef#3{\ctxlua{objects.reference("#1::#2)}}} +% \unexpanded\def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxlua{objects.page("#1::#2))}}} % % \protect % @@ -219,26 +217,27 @@ %D housekeeping to the driver. The current approach permits %D us to keep the box characteristic too. -\newif\ifinobject +\installcorenamespace {objects} + +\newif\ifinobject % public (might become a conditional) -\def\objectplaceholder{NOT YET FLUSHED}% +\def\objectplaceholder{NOT YET FLUSHED} -\def\presetobject#1#2% \global added - {\ifcsname\??ob:#1::#2\endcsname\else - \global\@EA\let\csname\??ob:#1::#2\endcsname\objectplaceholder +\unexpanded\def\presetobject#1#2% \global added + {\ifcsname\??objects#1::#2\endcsname\else + \global\expandafter\let\csname\??objects#1::#2\endcsname\objectplaceholder \fi} -\def\dosetobject#1#2#3% \initializepaper this will move to \everyshipout - {% \initializepaper - \ifcsname\??ob:#2::#3\endcsname +\unexpanded\def\pack_objects_set#1#2#3% + {\ifcsname\??objects#2::#3\endcsname \expandafter\gobblefivearguments \else % tzt, overload internal referenced objects to save entries - \expandafter\dodosetobject + \expandafter\pack_objects_set_indeed \fi {#1}{#2}{#3}} -\def\resetobject#1#2% - {\letbeundefined{\??ob:#1::#2}} +\unexpanded\def\resetobject#1#2% + {\letbeundefined{\??objects#1::#2}} %D \macros %D {finalizeobjectbox} @@ -246,7 +245,7 @@ %D This one provides a hook for last minute object box processing %D we need this in \MKIV. -\ifx\finalizeobjectbox\undefined +\ifdefined\finalizeobjectbox \else \let\finalizeobjectbox\gobbleoneargument \fi @@ -257,47 +256,54 @@ \def\objectoffset{1cm} -\def\dodosetobject#1#2#3% +\unexpanded\def\pack_objects_set_indeed#1#2#3% {\bgroup - \globalpushmacro\crossreferenceobject \objectreferenced + \globalpushmacro\crossreferenceobject + \objectreferenced \inobjecttrue \dowithnextbox {\globalpopmacro\crossreferenceobject - \dododosetobject{#1}{#2}{#3}\egroup}} + \pack_objects_set_indeed_indeed{#1}{#2}{#3}% + \egroup}} % in luatex version < 66 we had a 1bp compensation (hardcoded in luatex) -\def\dododosetobject#1#2#3% +\let\pack_objects_handle\relax + +\unexpanded\def\pack_objects_set_indeed_indeed#1#2#3% {\begingroup \scratchdimen\objectoffset - \@EA\xdef\csname\??ob:#2::#3\endcsname - {\noexpand\dohandleobject{#2}{#3}% + \expandafter\xdef\csname\??objects#2::#3\endcsname + {\pack_objects_handle + {#2}% + {#3}% {\ifhbox\nextbox\hbox\else\vbox\fi}% - {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}% + {\number\wd\nextbox}% + {\number\ht\nextbox}% + {\number\dp\nextbox}% {\number\scratchdimen}}% \expanded % freeze the dimensions since \dostartobject may use \nextbox - {\dostartobject{#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% + {\dostartobject{#2}{#3}{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}% \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint - \setbox\nextbox\vbox spread 2\scratchdimen + \setbox\nextbox\vbox \!!spread 2\scratchdimen {\forgetall \offinterlineskip - \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% + \vss\hbox \!!spread 2\scratchdimen{\hss\box\nextbox\hss}\vss}% \fi \fi - \flushnextbox + \box\nextbox \dostopobject \endgroup} -\def\getobject#1#2% - {\ifcsname\??ob:#1::#2\endcsname +\unexpanded\def\getobject#1#2% + {\ifcsname\??objects#1::#2\endcsname \begingroup - \let\dohandleobject\dogetobject - \csname\??ob:#1::#2\expandafter\endcsname + \let\pack_objects_handle\pack_objects_get + \csname\??objects#1::#2\expandafter\endcsname \else {\infofont[object #1::#2]}% \fi} -\def\dogetobject#1#2#3#4#5#6#7% don't change this, should work for dvi & pdf - {% \initializepaper - \forgetall +\unexpanded\def\pack_objects_get#1#2#3#4#5#6#7% don't change this, should work for dvi & pdf + {\forgetall % todo: if no attr then faster \setbox\scratchbox\vbox attr \viewerlayerattribute \attribute\viewerlayerattribute {\doinsertobject{#1}{#2}}% @@ -323,18 +329,18 @@ %D The results are reported in \type {\objectwidth}, \type %D {\objectheight} and \type {\objectdepth}. -\def\dogetobjectdimensions#1#2#3#4#5#6#7% +\unexpanded\def\pack_objects_get_dimensions#1#2#3#4#5#6#7% {\def\objectwidth {#4\s!sp}% \def\objectheight{#5\s!sp}% \def\objectdepth {#6\s!sp}% \def\objectmargin{#7\s!sp}} -\def\getobjectdimensions#1#2% - {\let\dohandleobject\dogetobjectdimensions +\unexpanded\def\getobjectdimensions#1#2% + {\let\pack_objects_handle\pack_objects_get_dimensions \let\objectwidth \!!zeropoint \let\objectheight\!!zeropoint \let\objectdepth \!!zeropoint - \csname\??ob:#1::#2\endcsname} + \csname\??objects#1::#2\endcsname} %D Apart from this kind of objects, that have typeset content, %D we can have low level driver specific objects. Both types @@ -352,35 +358,35 @@ %D These commands are to be called by the \type{\startobject}, %D \type{\stopobject} and \type{\insertobject} specials. -\def\objectreferenced{\global\chardef\crossreferenceobject\plusone} -\def\driverreferenced{\global\chardef\crossreferenceobject\zerocount} +\unexpanded\def\objectreferenced{\global\chardef\crossreferenceobject\plusone} +\unexpanded\def\driverreferenced{\global\chardef\crossreferenceobject\zerocount} \objectreferenced % no undefined test ! ! ! ! (pdftex fails on undefined objects) -\def\doregisterobjectreference#1#2#3{\normalexpanded{\noexpand\ctxlatelua{job.objects.save("#1::#2",#3,\noexpand\the\realpageno)}}} -\def\dooverloadobjectreference#1#2#3{\ctxlua{job.objects.set("#1::#2",#3,\the\realpageno)}} +\unexpanded\def\pack_objects_register_reference#1#2#3{\normalexpanded{\noexpand\ctxlatecommand{saveobject("#1::#2",#3,\noexpand\the\realpageno)}}} +\unexpanded\def\pack_objects_overload_reference#1#2#3{\ctxcommand{setobject("#1::#2",#3,\the\realpageno)}} -\def\dosetobjectreference +\unexpanded\def\dosetobjectreference {\ifcase\crossreferenceobject \objectreferenced - \expandafter\dooverloadobjectreference + \expandafter\pack_objects_overload_reference \else - \expandafter\doregisterobjectreference + \expandafter\pack_objects_register_reference \fi} -\def\dosetdriverreference +\unexpanded\def\dosetdriverreference {\driverreferenced\dosetobjectreference} \def\defaultobjectreference#1#2{0} % driver dependent \def\defaultobjectpage #1#2{\realfolio} -\def\dogetobjectreference #1#2#3{\xdef#3{\ctxlua{job.objects.number("#1::#2","\defaultobjectreference{#1}{#2}")}}} -\def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxlua{job.objects.page("#1::#2","\defaultobjectpage{#1}{#2}")}}} +\unexpanded\def\dogetobjectreference #1#2#3{\xdef#3{\ctxcommand{objectnumber("#1::#2","\defaultobjectreference{#1}{#2}")}}} +\unexpanded\def\dogetobjectreferencepage#1#2#3{\xdef#3{\ctxcommand{objectpage("#1::#2","\defaultobjectpage{#1}{#2}")}}} -\def\setobject {\driverreferenced\dosetobject1} -\def\settightobject{\driverreferenced\dosetobject0} +\unexpanded\def\setobject {\driverreferenced\pack_objects_set1} +\unexpanded\def\settightobject{\driverreferenced\pack_objects_set0} %D \macros %D {doifobjectfoundelse,doifobjectreferencefoundelse} @@ -393,13 +399,14 @@ %D \doifobjectreferencefoundelse{class}{object}{do then}{do else} %D \stoptyping -\def\doifobjectfoundelse#1#2% - {\ifcsname\??ob:#1::#2\endcsname +\unexpanded\def\doifobjectfoundelse#1#2% + {\ifcsname\??objects#1::#2\endcsname \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\def\doifobjectreferencefoundelse#1#2{\ctxlua{job.objects.doifelse("#1::#2")}} +\unexpanded\def\doifobjectreferencefoundelse#1#2% + {\ctxcommand{doifobjectreferencefoundelse("#1::#2")}} \protect \endinput diff --git a/tex/context/base/pack-pos.mkiv b/tex/context/base/pack-pos.mkiv index fab73bc4a..d14d53751 100644 --- a/tex/context/base/pack-pos.mkiv +++ b/tex/context/base/pack-pos.mkiv @@ -23,65 +23,82 @@ % \position[ystep=relative](3,-1){test} % \position(10,10){test} % \stoppositioning} +% +% watch out: rather global -\newdimen\positioningxposition \newdimen\positioningyposition -\newdimen\positioningxdimension \newdimen\positioningydimension -\newdimen\positioningxoffset \newdimen\positioningyoffset +\installcorenamespace {positioning} -\newbox\positioningbox +\installcommandhandler \??positioning {positioning} \??positioning -\unexpanded\def\startpositioning - {\dosingleempty\dostartpositioning} +\setuppositioning + [\c!state=\v!start, + \c!unit=\s!cm, + \c!factor=\plusone, + \c!scale =\plusone, + \c!xfactor=\positioningparameter\c!factor, + \c!yfactor=\positioningparameter\c!factor, + \c!xscale=\positioningparameter\c!scale, + \c!yscale=\positioningparameter\c!scale, + \c!xstep=\v!absolute, + \c!ystep=\v!absolute, + \c!xoffset=\zeropoint, + \c!yoffset=\zeropoint] + +\newdimen\d_pack_positioning_x_position +\newdimen\d_pack_positioning_y_position +\newdimen\d_pack_positioning_x_dimension +\newdimen\d_pack_positioning_y_dimension +\newdimen\d_pack_positioning_x_offset +\newdimen\d_pack_positioning_y_offset -\def\dostartpositioning[#1]% +\newbox\b_pack_positioning + +\unexpanded\def\startpositioning {\bgroup - \getparameters[\??ps][#1]% - \positioningxposition \zeropoint \positioningyposition \zeropoint - \positioningxdimension\zeropoint \positioningydimension\zeropoint - \positioningxoffset \zeropoint \positioningyoffset \zeropoint - \hfuzz \paperwidth \vfuzz \paperheight - \setbox\positioningbox\hbox\bgroup + \dodoubleempty\pack_positioning_start} + +\def\pack_positioning_start[#1][#2]% + {\ifsecondargument + \edef\currentpositioning{#1}% + \setupcurrentpositioning[#2]% + \else\iffirstargument + \doifassignmentelse{#1} + {\let\currentpositioning\empty + \setupcurrentpositioning[#1]}% + {\edef\currentpositioning{#1}}% + \else + \let\currentpositioning\empty + \fi\fi + \d_pack_positioning_x_position \zeropoint + \d_pack_positioning_y_position \zeropoint + \d_pack_positioning_x_dimension\zeropoint + \d_pack_positioning_y_dimension\zeropoint + \d_pack_positioning_x_offset \zeropoint + \d_pack_positioning_y_offset \zeropoint + \hfuzz\paperwidth + \vfuzz\paperheight + \setbox\b_pack_positioning\hbox\bgroup \ignorespaces} \unexpanded\def\stoppositioning {\removeunwantedspaces - \doifnot\@@psoffset\v!yes - {\global\positioningxoffset\zeropoint - \global\positioningyoffset\zeropoint}% - \global\advance\positioningxdimension \positioningxoffset - \global\advance\positioningydimension \positioningyoffset + \doifnot{\positioningparameter\c!offset}\v!yes + {\global\d_pack_positioning_x_offset\zeropoint + \global\d_pack_positioning_y_offset\zeropoint}% + \global\advance\d_pack_positioning_x_dimension\d_pack_positioning_x_offset + \global\advance\d_pack_positioning_y_dimension\d_pack_positioning_y_offset \egroup - \vbox to \positioningydimension - {\vskip\positioningyoffset - \hbox to \positioningxdimension - {\hskip\positioningxoffset - \box\positioningbox + \vbox to \d_pack_positioning_y_dimension + {\vskip\d_pack_positioning_y_offset + \hbox to \d_pack_positioning_x_dimension + {\hskip\d_pack_positioning_x_offset + \box\b_pack_positioning \hfill} \vfill}% \egroup} -\def\resetpositioning - {\let\@@psstate \v!start - \let\@@psunit \s!cm - \let\@@psfactor \plusone - \let\@@psscale \plusone - \def\@@psxfactor{\@@psfactor}% - \def\@@psyfactor{\@@psfactor}% - \def\@@psxscale {\@@psscale}% - \def\@@psyscale {\@@psscale}% - \let\@@psxstep \v!absolute - \let\@@psystep \v!absolute - \let\@@psxoffset \zeropoint - \let\@@psyoffset \zeropoint} - -\resetpositioning - -\unexpanded\def\setuppositioning - {\resetpositioning - \dodoubleargument\getparameters[\??ps]} - -\def\calculateposition#1#2#3#4#5#6#7#8#9% - {\setdimensionwithunit\scratchdimen{#1}\@@psunit +\unexpanded\def\pack_positioning_calculate#1#2#3#4#5#6#7#8#9% + {\setdimensionwithunit\scratchdimen{#1}{\positioningparameter\c!unit}% \scratchdimen#8\scratchdimen \scratchdimen#9\scratchdimen \advance\scratchdimen #4\relax @@ -90,47 +107,58 @@ {\advance\scratchdimen#3% \let#4\zeropoint}% #3\scratchdimen - \doifnot\@@psstate\v!overlay + \doifnot{\positioningparameter\c!state}\v!overlay {\scratchdimen\dimexpr#5+#3\relax \ifdim #3<-#7\relax \global#7-#3\relax \fi \ifdim\scratchdimen> #6\relax \global#6\scratchdimen\fi}} -\def\position - {\dosingleempty\doposition} +\unexpanded\def\position + {\bgroup + \dosingleempty\pack_positioning_position} -\def\doposition[#1]#2(#3,#4)% - {\removeunwantedspaces - \dowithnextbox{\dodoposition{#1}{#2}{#3}{#4}}\hbox} +\def\pack_positioning_position[#1]#2(#3,#4)% + {\iffirstargument + \setupcurrentpositioning[#1]% + \fi + \removeunwantedspaces + \dowithnextbox{\pack_positioning_position_indeed{#3}{#4}}\hbox} -\def\dodoposition#1#2#3#4% - {\bgroup - \dontcomplain - \getparameters[\??ps][#1]% - \calculateposition{#3}\@@psxstep\positioningxposition\@@psxoffset\nextboxwd \positioningxdimension\positioningxoffset\@@psxscale\@@psxfactor - \calculateposition{#4}\@@psystep\positioningyposition\@@psyoffset\nextboxhtdp\positioningydimension\positioningyoffset\@@psyscale\@@psyfactor +\def\pack_positioning_position_indeed#1#2% + {\dontcomplain + \normalexpanded + {\pack_positioning_calculate + {#1}% + {\positioningparameter\c!xstep}% + \d_pack_positioning_x_position + {\positioningparameter\c!xoffset}% + {\wd\nextbox}% + \d_pack_positioning_x_dimension + \d_pack_positioning_x_offset + {\positioningparameter\c!xscale}% + {\positioningparameter\c!xfactor}% + \pack_positioning_calculate + {#2}% + {\positioningparameter\c!ystep}% + \d_pack_positioning_y_position + {\positioningparameter\c!yoffset}% + {\htdp\nextbox}% + \d_pack_positioning_y_dimension + \d_pack_positioning_y_offset + {\positioningparameter\c!yscale}% + {\positioningparameter\c!yfactor}}% \vbox to \zeropoint - {\vskip\positioningyposition + {\vskip\d_pack_positioning_y_position \hbox to \zeropoint - {\hskip\positioningxposition - \flushnextbox + {\hskip\d_pack_positioning_x_position + \box\nextbox \hss} \vss}% \normalexpanded {\egroup - \positioningxposition\the\positioningxposition - \positioningyposition\the\positioningyposition - \def\noexpand\@@psxoffset{\the\dimexpr\@@psxoffset}% - \def\noexpand\@@psyoffset{\the\dimexpr\@@psyoffset}}% + \d_pack_positioning_x_position\the\d_pack_positioning_x_position + \d_pack_positioning_y_position\the\d_pack_positioning_y_position + \setexpandedpositioningparameter\c!xoffset{\the\dimexpr\positioningparameter\c!xoffset}% + \setexpandedpositioningparameter\c!yoffset{\the\dimexpr\positioningparameter\c!yoffset}}% \ignorespaces} -\setuppositioning - [\c!unit=\s!cm, - \c!factor=\plusone, - \c!scale=\plusone, - \c!xstep=\v!absolute, - \c!ystep=\v!absolute, - \c!offset=\v!yes, - \c!xoffset=\zeropoint, - \c!yoffset=\zeropoint] - \protect \endinput diff --git a/tex/context/base/page-col.mkiv b/tex/context/base/page-col.mkiv index 50a05d351..87591e336 100644 --- a/tex/context/base/page-col.mkiv +++ b/tex/context/base/page-col.mkiv @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Page Macros / Column Helpers} -%D Here we implement a coouple of helpers for dealing with +%D Here we implement a couple of helpers for dealing with %D columns. For the moment we keep the names. \unprotect diff --git a/tex/context/base/page-inf.mkiv b/tex/context/base/page-inf.mkiv index 6c220fb31..acfbf26f6 100644 --- a/tex/context/base/page-inf.mkiv +++ b/tex/context/base/page-inf.mkiv @@ -24,7 +24,7 @@ \let\currentversioninfo\empty -\def\setupversion +\unexpanded\def\setupversion {\dosingleargument\page_info_setup} \let\version\setupversion @@ -52,7 +52,7 @@ {\csname\??layoutinfo#1\endcsname} \installversioninfo\v!concept - {\vskip\!!sixpoint + {\vskip6\points \hbox to \makeupwidth {\infofont \v!concept:\space\currentdate @@ -60,7 +60,7 @@ \page_adapts_status_info}} \installversioninfo\v!file - {\vskip\!!sixpoint + {\vskip6\points \hbox to \makeupwidth {\infofont \getmessage\m!system{27}:\space\currentdate\space diff --git a/tex/context/base/page-par.mkiv b/tex/context/base/page-par.mkiv index 26e306ef5..868cdec51 100644 --- a/tex/context/base/page-par.mkiv +++ b/tex/context/base/page-par.mkiv @@ -15,49 +15,59 @@ \unprotect -\newcount\internalparagraphnumber - -\unexpanded\def\setupparagraphnumbering - {\dosingleempty\dosetupparagraphnumbering} - -\def\dosetupparagraphnumbering[#1]% - {\getparameters - [\??ph][#1]% - \processaction - [\@@phstate] - [\v!start=>\let\showparagraphnumber\doshowparagraphnumberA, - \v!stop=>\let\showparagraphnumber\relax, - \v!line=>\let\showparagraphnumber\doshowparagraphnumberB, - \v!reset=>\global\internalparagraphnumber\zerocount - \let\showparagraphnumber\doshowparagraphnumberA]} - -\def\dodoshowparagraphnumber - {\global\advance\internalparagraphnumber \plusone - \inleftmargin % \tf normalizes em - {\tf - \dousestyleparameter\@phstyle - \dousecolorparameter\@phcolor - \the\internalparagraphnumber - \kern\@@phdistance}} - -\def\doshowparagraphnumberA - {%\ifprocessingverbatim - % \iflinepar - % % obsolete: \dodoshowparagraphnumber - % \fi - %\else - \dodoshowparagraphnumber - }%\fi} - -\def\doshowparagraphnumberB +\installcorenamespace {paragraphnumbering} +\installcorenamespace {paragraphnumberingvariants} + +\installsimplecommandhandler \??paragraphnumbering {paragraphnumbering} \??paragraphnumbering + +\definecounter[\v!paragraph] + +\let\showparagraphnumber\relax + +\appendtoks + \page_par_check_state +\to \everysetupparagraphnumbering + +\unexpanded\def\page_par_check_state + {\rawprocesscommacommand[\paragraphnumberingparameter\c!state]\page_par_check_state_step} + +\def\page_par_check_state_step#1% + {\ifcsname\??paragraphnumberingvariants#1\endcsname + \csname\??paragraphnumberingvariants#1\endcsname + \fi} + +\setvalue{\??paragraphnumberingvariants\v!start}% + {\let\showparagraphnumber\page_par_show_number_normal} + +\setvalue{\??paragraphnumberingvariants\v!stop}% + {\let\showparagraphnumber\relax} + +\setvalue{\??paragraphnumberingvariants\v!line}% + {\let\showparagraphnumber\page_par_show_number_lines} + +\setvalue{\??paragraphnumberingvariants\v!reset}% + {\strc_counters_reset\v!paragraph + \let\showparagraphnumber\page_par_show_number_normal} + +\unexpanded\def\page_par_show_number_normal + {\strc_counters_increment\v!paragraph + \inleftmargin % todo: \c!location, only a few make sense + {\hfill % no complaints + \tf % \tf normalizes em + \useparagraphnumberingstyleandcolor\c!style\c!color + \convertedcounter[\v!paragraph]% + \kern\paragraphnumberingparameter\c!distance}} + +\unexpanded\def\page_par_show_number_lines {\ifnumberinglines - \doshowparagraphnumberA + \page_par_show_number_normal \fi} \setupparagraphnumbering [\c!state=\v!stop, - \c!style=, - \c!color=, - \c!distance=\ifcase\linenumberlocation2em\else\!!zeropoint\fi] % will change + %\c!location, + %\c!style=, + %\c!color=, + \c!distance=\ifcase\linenumberlocation2\emwidth\else\zeropoint\fi] % will change \protect \endinput diff --git a/tex/context/base/page-sel.mkiv b/tex/context/base/page-sel.mkiv index 1e706aa22..cfa9b3737 100644 --- a/tex/context/base/page-sel.mkiv +++ b/tex/context/base/page-sel.mkiv @@ -111,7 +111,7 @@ {\hsize\textwidth \scratchdimen\@@ipoffset \centeredbox - {\doifelse\@@ipmarking\v!on\cuthbox\hbox + {\doifelse\@@ipmarking\v!on\cuthbox\hbox % only place where cuthbox is used {\ifdim\scratchdimen>\zeropoint\relax \advance\vsize -2\scratchdimen \advance\hsize -2\scratchdimen diff --git a/tex/context/base/page-str.mkiv b/tex/context/base/page-str.mkiv index f14f2f716..47eb5e3bf 100644 --- a/tex/context/base/page-str.mkiv +++ b/tex/context/base/page-str.mkiv @@ -43,18 +43,18 @@ \page_otr_command_flush_side_floats \to \everyenableoutputstream -\def\initializeoutputstreams +\unexpanded\def\initializeoutputstreams {\ctxlua{streams.initialize()}% \glet\initializeoutputstreams\relax} -\def\enableoutputstream[#1]% could be \startoutputsubstream +\unexpanded\def\enableoutputstream[#1]% could be \startoutputsubstream {\initializeoutputstreams \the\everyenableoutputstream \inoutputstreamtrue \xdef\currentoutputstream{#1}% \ctxlua{streams.enable("#1")}} -\def\disableoutputstream +\unexpanded\def\disableoutputstream {\inoutputstreamfalse \global\let\currentoutputstream\s!default \ctxlua{streams.disable()}} @@ -73,11 +73,11 @@ \let\currentoutputsubstream\empty -\def\startoutputsubstream[#1]% +\unexpanded\def\startoutputsubstream[#1]% just push/pop instead {\glet\savedcurrentoutputstream\currentoutputstream \enableoutputstream[#1]} -\def\stopoutputsubstream +\unexpanded\def\stopoutputsubstream {\glet\currentoutputstream\savedcurrentoutputstream \enableoutputstream[\savedcurrentoutputstream]} @@ -89,7 +89,8 @@ \def\synchronizestreams [#1]{\ctxlua{streams.synchronize("#1")}} \def\dopushoutputstream [#1]{\ctxlua{streams.push("#1")}} -\def\pushoutputstream {\dosingleempty\dopushoutputstream} +\unexpanded\def\pushoutputstream + {\dosingleempty\dopushoutputstream} % \unexpanded\def\defineoutputstream[#1]% % {\doifundefined{otrs:#1}{\expandafter\newbox\csname otrs:#1\endcsname}} @@ -103,13 +104,15 @@ % \directsetup{stream:\firstoutputstream:bottom} % \directsetup{stream:\firstoutputstream:reset} -%D Obsolete in \MKIV: - -\unexpanded\def\definemarknote {\dodoubleempty\dodefinemarknote} -\def\dodefinemarknote[#1][#2]{} -\def\setmarknote [#1]{\gobbleoneargument} -\def\flushmarknotes [#1]{} -\def\erasemarknotes [#1]{} +% Obsolete in \MKIV: +% +% \unexpanded\def\definemarknote +% {\dodoubleempty\dodefinemarknote} +% +% \def\dodefinemarknote[#1][#2]{} +% \def\setmarknote [#1]{\gobbleoneargument} +% \def\flushmarknotes [#1]{} +% \def\erasemarknotes [#1]{} \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 6e6ab9c07..0a7e12e4e 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 9690b7ed0..7483bbd83 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index f6096863e..6d5ba34f7 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -232,9 +232,9 @@ return { comment = "needs integration and configuration", }, { - filename = "node-par", + filename = "typo-bld", marktype = "mkiv", - status = "experimental", + status = "okay", }, { filename = "back-ini", @@ -415,9 +415,9 @@ return { status = "okay", }, { - filename = "trac-vis", + filename = "pack-cut", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "lang-mis", @@ -644,7 +644,8 @@ return { { filename = "pack-obj", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "will change when we have objects at lua end", }, { filename = "strc-itm", @@ -717,7 +718,8 @@ return { { filename = "page-inf", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "room for improvement and extension", }, { filename = "page-grd", @@ -799,7 +801,7 @@ return { { filename = "pack-pos", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "page-mak", @@ -814,7 +816,8 @@ return { { filename = "page-par", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "might get extended", }, { filename = "typo-pag", @@ -1204,7 +1207,7 @@ return { { filename = "page-mrk", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "page-flw", @@ -1354,9 +1357,10 @@ return { comment = "maybe some cleanup is needed", }, { - filename = "node-spl", + filename = "font-sol", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "needs testing", }, { filename = "strc-not", @@ -1412,7 +1416,7 @@ return { { filename = "pack-bar", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "page-app", diff --git a/tex/context/base/status-mkiv.tex b/tex/context/base/status-mkiv.tex index 0d22d51a1..e9b12b130 100644 --- a/tex/context/base/status-mkiv.tex +++ b/tex/context/base/status-mkiv.tex @@ -1,4 +1,4 @@ - \setupbodyfont[dejavu,10pt] +\setupbodyfont[dejavu,10pt] \setuplayout [width=middle, @@ -17,7 +17,7 @@ [location=] \setupheadertexts - [\currentdate][MkIV cleanup Status / Page \pagenumber] + [\currentdate][MkIV Cleanup Status / Page \pagenumber] \starttext diff --git a/tex/context/base/trac-vis.mkiv b/tex/context/base/trac-vis.mkiv deleted file mode 100644 index e906bb50d..000000000 --- a/tex/context/base/trac-vis.mkiv +++ /dev/null @@ -1,721 +0,0 @@ -%D \module -%D [ file=trac-vis, % was core-vis, -%D version=1996.06.01, -%D title=\CONTEXT\ Tracking Macros, -%D subtitle=Visualization, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D This module adds some more visualization cues to the ones -%D supplied in the support module. -%D -%D %\everypar dual character, \the\everypar and \everypar= -%D %\hrule cannot be grabbed in advance, switches mode -%D %\vrule cannot be grabbed in advance, switches mode -%D % -%D %\indent only explicit ones -%D %\noindent only explicit ones -%D %\par only explicit ones -%D -%D %\leftskip only if explicit one -%D %\rightskip only if explicit one - -\writestatus{loading}{ConTeXt Tracking Macros / Visualization} - -\unprotect - -%D \macros -%D {indent, noindent, par} -%D -%D \TeX\ acts upon paragraphs. In mosts documents paragraphs -%D are separated by empty lines, which internally are handled as -%D \type{\par}. Paragraphs can be indented or not, depending on -%D the setting of \type{\parindent}, the first token of a -%D paragraph and/or user suppressed or forced indentation. -%D -%D Because the actual typesetting is based on both explicit -%D user and implicit system actions, visualization is only -%D possible for the user supplied \type{\indent}, -%D \type{\noindent}, and \type{\par}. Other -%D 'clever' tricks will quite certainly lead to more failures -%D than successes, so we only support these three explicit -%D primitives and one macro: - -\def\showparagraphcue#1#2#3#4#5% - {\bgroup - \scratchdimen#1\relax - \dontinterfere - \dontcomplain - \boxrulewidth5\testrulewidth - #3#4\relax - \setbox\scratchbox\normalhbox to \scratchdimen - {#2{\ruledhbox to \scratchdimen - {\vrule #5 20\testrulewidth \!!width \zeropoint - \normalhss}}}% - \smashbox\scratchbox - \normalpenalty\plustenthousand - \box\scratchbox - \egroup} - -\def\ruledhanging - {\ifdim\hangindent>\zeropoint - \ifnum\hangafter<\zerocount - \normalhbox - {\boxrulewidth5\testrulewidth - \setbox\scratchbox\ruledhbox to \hangindent - {\scratchdimen\strutht - \advance\scratchdimen \strutdp - \vrule - \!!width \zeropoint - \!!height \zeropoint - \!!depth -\hangafter\scratchdimen}% - \normalhskip-\hangindent - \smashbox\scratchbox - \raise\strutht\box\scratchbox}% - \fi - \fi} - -\def\ruledparagraphcues - {\bgroup - \dontcomplain - \normalhbox to \zeropoint - {\ifdim\leftskip>\zeropoint\relax - \showparagraphcue\leftskip\llap\relax\relax\!!depth - \normalhskip-\leftskip - \fi - \ruledhanging - \normalhskip\hsize - \ifdim\rightskip>\zeropoint\relax - \normalhskip-\rightskip - \showparagraphcue\rightskip\relax\relax\relax\!!depth - \fi}% - \egroup} - -\def\ruledpar - {\relax - \ifhmode - \showparagraphcue{40\testrulewidth}\relax\rightrulefalse\relax\!!height - \fi - \normalpar} - -\def\rulednoindent - {\relax - \normalnoindent - \ruledparagraphcues - \showparagraphcue{40\testrulewidth}\llap\leftrulefalse\relax\!!height} - -\def\ruledindent - {\relax - \normalnoindent - \ruledparagraphcues - \ifdim\parindent>\zeropoint - \showparagraphcue\parindent\relax\relax\relax\!!height - \else - \showparagraphcue{40\testrulewidth}\llap\relax\relax\!!height - \fi - \normalhskip\parindent} - -\def\dontshowimplicits - {\let\noindent \normalnoindent - \let\indent \normalindent - \let\par \normalpar} - -\def\showimplicits - {\testrulewidth \defaulttestrulewidth - \let\noindent \rulednoindent - \let\indent \ruledindent - \let\par \ruledpar} - -%D The next few||line examples show the four cues. Keep in -%D mind that we only see them when we explicitly open or close -%D a paragraph. -%D -%D \bgroup -%D \def\voorbeeld#1% -%D {#1Visualizing some \TeX\ primitives and Plain \TeX\ -%D macros can be very instructive, at least it is to me. -%D Here we see {\tt\string#1} and {\tt\string\ruledpar} in -%D action, while {\tt\string\parindent} equals -%D {\tt\the\parindent}.\ruledpar} -%D -%D \showimplicits -%D -%D \voorbeeld \indent -%D \voorbeeld \noindent -%D -%D \parindent=60pt -%D -%D \voorbeeld \indent -%D \voorbeeld \noindent -%D -%D \startnarrower -%D \voorbeeld \indent -%D \voorbeeld \noindent -%D \stopnarrower -%D \egroup -%D -%D These examples also demonstrate the visualization of -%D \type {\leftskip} and \type {\rightskip}. The macro -%D \type {\nofruledbaselines} determines the number of lines -%D shown. - -\newcounter\ruledbaselines - -\def\nofruledbaselines{3} - -\def\debuggertext#1% - {\ifx\ttxx\undefined - $\scriptscriptstyle#1$% - \else - {\ttxx#1}% - \fi} - -\def\ruledbaseline - {\vrule \!!width \zeropoint - \bgroup - \dontinterfere - \doglobal\increment\ruledbaselines - \scratchdimen\nofruledbaselines\baselineskip - \setbox\scratchbox\normalvbox to 2\scratchdimen - {\leaders - \normalhbox - {\strut - \vrule - \!!height \testrulewidth - \!!depth \testrulewidth - \!!width 120\points} - \normalvfill}% - \smashbox\scratchbox - \advance\scratchdimen \strutheightfactor\baselineskip - \setbox\scratchbox\normalhbox - {\normalhskip -48\points - \normalhbox to 24\points - {\normalhss\debuggertext\ruledbaselines\normalhskip6\points}% - \raise\scratchdimen\box\scratchbox}% - \smashbox\scratchbox - \box\scratchbox - \egroup} - -\def\showbaselines - {\testrulewidth\defaulttestrulewidth - \EveryPar{\ruledbaseline}} - -%D \macros -%D {showpagebuilder} -%D -%D The next tracing option probaly is only of use to me and a -%D few \CONTEXT\ hackers. - -\def\showpagebuilder - {\EveryPar{\doshowpagebuilder}} - -\def\doshowpagebuilder - {\strut\llap - {\startcolor[blue]\vl - \high{\infofont v:\the\vsize }\vl - \high{\infofont g:\the\pagegoal }\vl - \high{\infofont t:\the\pagetotal}\vl - \stopcolor}} - -%D \macros -%D {makecutbox, cuthbox, cutvbox, cutvtop} -%D -%D Although mainly used for marking the page, these macros can -%D also serve local use. -%D -%D \startbuffer -%D \setbox0=\vbox{a real \crlf vertical box} \makecutbox0 -%D \stopbuffer -%D -%D \typebuffer -%D -%D This marked \type{\vbox} shows up as: -%D -%D \startlinecorrection -%D \getbuffer -%D \stoplinecorrection -%D -%D The alternative macros are used as: -%D -%D \startbuffer -%D \cuthbox{a made cut box} -%D \stopbuffer -%D -%D \typebuffer -%D -%D This is typeset as: -%D -%D \startlinecorrection -%D \getbuffer -%D \stoplinecorrection -%D -%D By setting the next macros one can influence the length of -%D the marks as well as the horizontal and vertical divisions. - -\newdimen\tractempwidth -\newdimen\tractempheight -\newdimen\tractempdepth - -\def \cutmarklength {2\bodyfontsize} - -\newcount\horizontalcutmarks \horizontalcutmarks = 2 -\newcount\verticalcutmarks \verticalcutmarks = 2 -\newcount\cutmarkoffset \cutmarkoffset = 1 - -\let \cutmarksymbol \relax -\let \cutmarktoptext \empty -\let \cutmarkbottomtext \empty -\let \cutmarkhoffset \empty -\let \cutmarkvoffset \empty - -\def\horizontalcuts - {\normalhbox to \tractempwidth - {\dorecurse\horizontalcutmarks{\vrule\!!width\boxrulewidth\!!height\cutmarklength\normalhfill}% - \unskip}} - -\def\verticalcuts - {\normalvbox to \dimexpr\tractempheight+\tractempdepth\relax - {\hsize\cutmarklength - \dorecurse\verticalcutmarks{\vrule\!!height\boxrulewidth\!!width\hsize\normalvfill}% - \unskip}} - -\def\baselinecuts - {\ifdim\tractempdepth>\zeropoint - \normalvbox to \dimexpr\tractempheight+\tractempdepth\relax - {\hsize\dimexpr\cutmarklength/2\relax - \normalvskip\zeropoint\!!plus\tractempheight - \vrule\!!height\boxrulewidth\!!width\hsize - \normalvskip\zeropoint\!!plus\tractempdepth}% - \fi} - -\def\cutmarksymbols#1% - {\normalhbox to \tractempwidth - {\setbox\scratchbox\normalhbox to \cutmarklength - {\normalhss\infofont\cutmarksymbol\normalhss}% - \normalhss - \normalvbox to \cutmarklength - {\scratchdimen\dimexpr\cutmarklength/2\relax - \scratchskip \ifx\cutmarkhoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi - \normalvss - \hbox to \tractempwidth - {\llap{\copy\scratchbox\normalhskip\scratchskip}% - \normalhskip\scratchdimen\hss\infofont#1\hss\normalhskip\scratchdimen - \rlap{\normalhskip\scratchskip\copy\scratchbox}}% - \normalvss}% - \normalhss}} - -\def\makecutbox#1% simplier with layers, todo - {\tractempheight\ht#1% - \tractempdepth \dp#1% - \tractempwidth \wd#1% - \setbox#1\normalhbox - {\dontcomplain - \forgetall - \boxmaxdepth\maxdimen - \offinterlineskip - \scratchdimen\dimexpr\cutmarklength/2\relax - \hsize\tractempwidth - \setbox\scratchbox\normalvbox - {\setbox\scratchbox\normalhbox{\horizontalcuts}% - \scratchskip\ifx\cutmarkvoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkvoffset\fi -% \normalvskip\dimexpr-\scratchskip-2\scratchdimen\relax -% \copy\scratchbox -% \normalvskip\scratchskip - \tlap{\copy\scratchbox\normalvskip\scratchskip}% - \hbox to \tractempwidth - {\scratchskip\ifx\cutmarkhoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkhoffset\fi - \setbox\scratchbox\normalhbox{\verticalcuts}% - \llap{\copy\scratchbox\normalhskip\scratchskip}% - \ifdim\tractempdepth=\zeropoint - \normalhfill - \else - \bgroup - \setbox\scratchbox\normalhbox{\baselinecuts}% - \llap{\copy\scratchbox\normalhskip\scratchskip}% - \normalhfill - \rlap{\normalhskip\scratchskip\copy\scratchbox}% - \egroup - \fi - \rlap{\normalhskip\scratchskip\copy\scratchbox}}% -% \normalvskip\scratchskip -% \copy\scratchbox}% - \blap{\normalvskip\scratchskip\copy\scratchbox}}% - \ht\scratchbox\tractempheight - \dp\scratchbox\tractempdepth - \wd\scratchbox\zeropoint - \startcolor[\defaulttextcolor]% - \box\scratchbox - \ifx\cutmarksymbol\relax \else - \setbox\scratchbox\normalvbox - {\scratchskip\ifx\cutmarkvoffset\empty\cutmarkoffset\scratchdimen\else\cutmarkvoffset\fi - \vskip-\scratchskip - \vskip-\cutmarklength - \normalhbox{\cutmarksymbols\cutmarktoptext}% - \vskip\scratchskip - \vskip\tractempheight - \vskip\tractempdepth - \vskip\scratchskip - \normalhbox{\cutmarksymbols\cutmarkbottomtext}}% - \ht\scratchbox\tractempheight - \dp\scratchbox\tractempdepth - \wd\scratchbox\zeropoint - \box\scratchbox - \fi - \stopcolor - \box#1}% - \wd#1\tractempwidth - \ht#1\tractempheight - \dp#1\tractempdepth} - -\def\cuthbox{\normalhbox\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalhbox} -\def\cutvbox{\normalvbox\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalvbox} -\def\cutvtop{\normalvtop\bgroup\dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalvtop} - -%D \macros -%D {colormarkbox,rastermarkbox} -%D -%D This macro is used in the pagebody routine. No other use -%D is advocated here. -%D -%D \starttyping -%D \colormarkbox0 -%D \stoptyping - -\def\colormarkoffset{\cutmarkoffset} -\def\colormarklength{\cutmarklength} - -\def\dodocolorrangeA#1% - {\fastcolored[#1]{\hrule\!!width3em\!!height\scratchdimen\!!depth\zeropoint}} - -\def\docolorrangeA#1 #2 % - {\vbox - {\hsize3em % \scratchdimen - \ifcase#1\or - \dodocolorrangeA{c=#2}\or - \dodocolorrangeA{m=#2}\or - \dodocolorrangeA{y=#2}\or - \dodocolorrangeA{m=#2,y=#2}\or - \dodocolorrangeA{c=#2,y=#2}\or - \dodocolorrangeA{c=#2,m=#2}\fi - \ifdim\scratchdimen>1ex - \vskip-\scratchdimen - \vbox to \scratchdimen - {\vss\hbox to 3em{\hss#2\hss}\vss}% - \fi}} - -\def\colorrangeA#1% - {\vbox - {\startcolor[\s!white]% - \scratchdimen\dimexpr(-\colormarklength*4+\tractempheight+\tractempdepth)/21\relax - \offinterlineskip - \docolorrangeA #1 1.00 \docolorrangeA #1 0.95 - \docolorrangeA #1 0.75 - \docolorrangeA #1 0.50 - \docolorrangeA #1 0.25 \docolorrangeA #1 0.05 - \docolorrangeA #1 0.00 - \stopcolor}} - -\def\docolorrangeB #1 #2 #3 #4 #5 % - {\fastcolored - [\c!c=#2,\c!m=#3,\c!y=#4,\c!k=#5] - {\vrule\!!width\scratchdimen\!!height\colormarklength\!!depth\zeropoint}% - \ifdim\scratchdimen>2em - \hskip-\scratchdimen - \vbox to \colormarklength - {\vss\hbox to \scratchdimen{\hss#1\hss}\vss}% - \fi} - -\def\colorrangeB - {\hbox - {\startcolor[\s!white]% - \scratchdimen\dimexpr(-\colormarklength*\plustwo+\tractempwidth)/11\relax - \docolorrangeB .5~C .5 0 0 0 - \docolorrangeB .5~M 0 .5 0 0 - \docolorrangeB .5~Y 0 0 .5 0 - \docolorrangeB .5~K 0 0 0 .5 - \docolorrangeB C 1 0 0 0 - \docolorrangeB G 1 0 1 0 - \docolorrangeB Y 0 0 1 0 - \docolorrangeB R 0 1 1 0 - \docolorrangeB M 0 1 0 0 - \docolorrangeB B 1 1 0 0 - \docolorrangeB K 0 0 0 1 - \stopcolor}} - -\def\docolorrangeC#1 % - {\fastcolored - [\c!s=#1]% - {\vrule\!!width\scratchdimen\!!height\colormarklength\!!depth\zeropoint}% - \ifdim\scratchdimen>2em - \hskip-\scratchdimen - \vbox to \colormarklength - {\vss\hbox to \scratchdimen{\hss#1\hss}\vss}% - \fi} - -\def\colorrangeC - {\hbox - {\startcolor[\s!white]% - \scratchdimen\dimexpr(-\colormarklength*2+\tractempwidth)/14\relax - \docolorrangeC 1 \docolorrangeC .95 - \docolorrangeC .9 \docolorrangeC .85 - \docolorrangeC .8 \docolorrangeC .75 - \docolorrangeC .7 - \docolorrangeC .6 - \docolorrangeC .5 - \docolorrangeC .4 - \docolorrangeC .3 - \docolorrangeC .2 - \docolorrangeC .1 - \docolorrangeC 0 - \stopcolor}} - -\def\docolormarkbox#1#2% - {\tractempheight\ht#2% - \tractempdepth \dp#2% - \tractempwidth \wd#2% - \setbox#2\hbox - {\scratchdimen\dimexpr\colormarklength/2\relax - \forgetall - \ssxx - \setbox\scratchbox\vbox - {\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}% - \vskip\colormarkoffset\scratchdimen - \vbox to \tractempheight - {\vss - \hbox to \tractempwidth - {\llap{\colorrangeA1\hskip\colormarkoffset\scratchdimen}\hfill - \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA4}}% - \vss - \hbox to \tractempwidth - {\llap{\colorrangeA2\hskip\colormarkoffset\scratchdimen}\hfill - \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA5}}% - \vss - \hbox 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}}% - \ht\scratchbox\tractempheight - \dp\scratchbox\tractempdepth - \wd\scratchbox\zeropoint - \box\scratchbox - \box#2}% - \wd#2\tractempwidth - \ht#2\tractempheight - \dp#2\tractempdepth} - -\def\colormarkbox {\docolormarkbox\plusone } % #1 -\def\rastermarkbox{\docolormarkbox\zerocount} % #1 - -%D \macros -%D {showwhatsits, dontshowwhatsits} -%D -%D \TEX\ has three so called whatsits: \type {\mark}, \type -%D {\write} and \type {\special}. The first one keeps track of -%D the current state at page boundaries, the last two are used -%D to communicate to the outside world. Due to fact that -%D especially \type {\write} is often used in conjunction with -%D \type {\edef}, we can only savely support that one in \ETEX. -%D -%D \bgroup \showwhatsits \setupcolors[state=start] -%D -%D Whatsits show up \color[blue]{in color} and are -%D characterized bij their first character.\footnote [some note] -%D {So we may encounter \type {w}, \type {m} and \type{s}.} -%D They are \writestatus{dummy}{demo}\color[yellow]{stacked}. -%D -%D \egroup - -\newif\ifimmediatewrite - -\ifx\eTeXversion\undefined - - \let\showwhatsits \relax - \let\dontshowwhatsits\relax - -\else - - \let\supernormalmark \normalmark % mark may already been superseded - \let\supernormalmarks \normalmarks % mark may already been superseded - - \def\showwhatsits - {\protected\def\normalmark {\visualwhatsit100+m\supernormalmark }% - \protected\def\normalmarks{\visualwhatsit100+m\supernormalmarks}% - \protected\def\special {\visualwhatsit0100s\normalspecial }% - \protected\def\write {\visualwhatsit001-w\normalwrite }% - \let\immediate\immediatewhatsit - \appendtoks\dontshowwhatsits\to\everystoptext} - - \def\immediatewhatsit - {\bgroup\futurelet\next\doimmediatewhatsit} - - \def\doimmediatewhatsit - {\ifx\next\write - \egroup\immediatewritetrue - \else - \egroup\expandafter\normalimmediate - \fi} - - \def\dontshowwhatsits - {\let\immediate \normalimmediate - \let\normalmark\supernormalmark - \let\special \normalspecial - \let\write \normalwrite} - - \def\visualwhatsit#1#2#3#4#5% - {\bgroup - \pushwhatsit - \dontinterfere - \dontcomplain - \dontshowcomposition - \dontshowwhatsits - \ttx - \ifvmode\donetrue\else\donefalse\fi - \setbox\scratchbox\hbox - {\ifdone - \colored[r=#1,g=#2,b=#3]{#5}% temp hack - \else - \colored[s=0]{#5}% temp hack - \fi}% - \setbox\scratchbox\hbox - {\ifdone - \colored[r=#1,g=#2,b=#3]{\vrule\!!width\wd\scratchbox}% temp hack - \else - \colored[s=0]{\vrule\!!width\wd\scratchbox}% temp hack - \fi - \hskip-\wd\scratchbox\box\scratchbox}% - \scratchdimen1ex - \setbox\scratchbox\hbox - {\ifdone\hskip\else\raise#4\fi\scratchdimen\box\scratchbox}% - \smashbox\scratchbox - \ifdone\nointerlineskip\fi - \box\scratchbox - \ifvmode\nointerlineskip\fi - \popwhatsit - \egroup - \ifimmediatewrite - \immediatewritefalse - \expandafter\normalimmediate - \fi} - - \def\pushwhatsit - {\ifzeropt\lastskip - \ifcase\lastpenalty - \ifzeropt\lastkern - \ifhmode - \let\popwhatsit\relax - \else - \edef\popwhatsit{\prevdepth\the\prevdepth}% - \fi - \else - \ifhmode - \edef\popwhatsit{\kern\the\lastkern}\unkern - \else - \edef\popwhatsit{\kern\the\lastkern\prevdepth\the\prevdepth}% - \kern-\lastkern - \fi - \fi - \else - \ifhmode - \edef\popwhatsit{\the\lastpenalty}% - \unpenalty - \else - \edef\popwhatsit{\penalty\the\lastpenalty\prevdepth\the\prevdepth}% - %\nobreak - \fi - \fi - \else - \ifhmode - \edef\popwhatsit{\hskip\the\lastskip}\unskip - \else - \edef\popwhatsit{\vskip\the\lastskip\prevdepth\the\prevdepth}% - \vskip-\lastskip - \fi - \fi} - -\fi - -%D The next macro can be used to keep track of classes of -%D boxes (handy for development cq.\ tracing). - -\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}}% - \processaction - [#1] - [ l=>\next\relax\hfill\vfill\vfill, - r=>\next\hfill\relax\vfill\vfill, - t=>\next\hfill\hfill\relax\vfill, - b=>\next\hfill\hfill\vfill\relax, - lt=>\next\relax\hfill\relax\vfill, - lb=>\next\relax\hfill\vfill\relax, - rt=>\next\hfill\relax\relax\vfill, - rb=>\next\hfill\relax\vfill\relax, - tl=>\next\relax\hfill\relax\vfill, - bl=>\next\relax\hfill\vfill\relax, - tr=>\next\hfill\relax\relax\vfill, - br=>\next\hfill\relax\vfill\relax, - \s!default=>\next\hfill\hfill\vfill\vfill, - \s!unknown=>\next\hfill\hfill\vfill\vfill]} - -\def\dotagbox[#1]#2% - {\bgroup - \dowithnextbox - {\setbox\scratchbox\flushnextbox - \setbox\nextbox\ifhbox\nextbox\hbox\else\vbox\fi - \bgroup - \startoverlay - {\copy\scratchbox} - {\dodotagbox{#1}\scratchbox{\framed - [\c!background=\v!screen,\c!backgroundscreen=1]{#2}}} - \stopoverlay - \egroup - \nextboxwd\the\wd\scratchbox - \nextboxht\the\ht\scratchbox - \nextboxdp\the\dp\scratchbox - \flushnextbox - \egroup}} - -\def\tagbox - {\dosingleempty\dotagbox} - -%D \macros -%D {coloredhbox,coloredvbox,coloredvtop, -%D coloredstrut} -%D -%D The following visualizations are used in some of the manuals: - -\definecolor[boxcolor:ht][r=.5,g=.75,b=.5] -\definecolor[boxcolor:dp][r=.5,g=.5,b=.75] -\definecolor[boxcolor:wd][r=.75,g=.5,b=.5] -\definecolor[strutcolor] [r=.5,g=.25,b=.25] - -\def\coloredbox#1% - {\dowithnextbox{#1{\hbox - {\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} - -\def\coloredhbox{\coloredbox\hbox} -\def\coloredvbox{\coloredbox\vbox} -\def\coloredvtop{\coloredbox\vtop} - -\def\coloredstrut - {\color[strutcolor]{\def\strutwidth{2\points}\setstrut\strut}} - -\protect \endinput diff --git a/tex/context/base/node-par.lua b/tex/context/base/typo-bld.lua index 423d69fc7..87d280541 100644 --- a/tex/context/base/node-par.lua +++ b/tex/context/base/typo-bld.lua @@ -1,11 +1,13 @@ -if not modules then modules = { } end modules ['node-par'] = { +if not modules then modules = { } end modules ['typo-bld'] = { -- was node-par version = 1.001, - comment = "companion to node-par.mkiv", + comment = "companion to typo-bld.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } +local insert, remove = table.insert, table.remove + local builders, nodes, node = builders, nodes, node builders.paragraphs = builders.paragraphs or { } @@ -23,10 +25,20 @@ local numbers = constructors.numbers constructors.methods = constructors.methods or { } local methods = constructors.methods -local p_attribute = attributes.numbers['parbuilder'] or 999 -constructors.attribute = p_attribute +local a_parbuilder = attributes.numbers['parbuilder'] or 999 -- why 999 +constructors.attribute = a_parbuilder +local unsetvalue = attributes.unsetvalue +local texsetattribute = tex.setattribute local has_attribute = node.has_attribute +local texnest = tex.nest + +local nodepool = nodes.pool +local new_baselineskip = nodepool.baselineskip +local new_lineskip = nodepool.lineskip +local insert_node_before = node.insert_before +local hpack_node = node.hpack + local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming @@ -35,17 +47,47 @@ storage.register("builders/paragraphs/constructors/numbers", numbers, "builders. local report_parbuilders = logs.reporter("parbuilders") -local texnest = tex.nest - local mainconstructor = nil -- not stored in format +local nofconstructors = 0 +local stack = { } -function constructors.register(name,number) - names[number] = name - numbers[name] = number +function constructors.define(name) + nofconstructors = nofconstructors + 1 + names[nofconstructors] = name + numbers[name] = nofconstructors end -function constructors.set(name) - mainconstructor = numbers[name] +function constructors.set(name) --- will go + if name then + mainconstructor = numbers[name] or unsetvalue + else + mainconstructor = stack[#stack] or unsetvalue + end + texsetattribute(a_parbuilder,mainconstructor) + if mainconstructor ~= unsetvalue then + constructors.enable() + end +end + +function constructors.start(name) + local number = numbers[name] + insert(stack,number) + mainconstructor = number or unsetvalue + texsetattribute(a_parbuilder,mainconstructor) + if mainconstructor ~= unsetvalue then + constructors.enable() + end +-- report_parbuilders("start %s",name) +end + +function constructors.stop() + remove(stack) + mainconstructor = stack[#stack] or unsetvalue + texsetattribute(a_parbuilder,mainconstructor) + if mainconstructor == unsetvalue then + constructors.disable() + end +-- report_parbuilders("stop") end -- return values: @@ -58,7 +100,7 @@ function constructors.handler(head,followed_by_display) if type(head) == "boolean" then return head else - local attribute = has_attribute(head,p_attribute) or mainconstructor + local attribute = has_attribute(head,a_parbuilder) -- or mainconstructor if attribute then local method = names[attribute] if method then @@ -81,14 +123,20 @@ function constructors.methods.default(head,followed_by_display) return true -- let tex break end --- also for testing (no surrounding spacing done) - -function constructors.methods.oneline(head,followed_by_display) - local h = node.hpack(head) - local p = texnest.ptr - texnest[p].prevgraf = 1 - texnest[p].prevdepth = h.depth - return h +-- also for testing (now also surrounding spacing done) + +function builders.paragraphs.constructors.methods.oneline(head,followed_by_display) + -- when needed we will turn this into a helper + local t = texnest[texnest.ptr] + local h = hpack_node(head) + local d = tex.baselineskip.width - t.prevdepth - h.height + t.prevdepth = h.depth + t.prevgraf = 1 + if d < tex.lineskiplimit then + return insert_node_before(h,h,new_lineskip(tex.lineskip)) + else + return insert_node_before(h,h,new_baselineskip(d)) + end end -- It makes no sense to have a sequence here as we already have @@ -96,17 +144,13 @@ end -- -- local actions = nodes.tasks.actions("parbuilders") -- --- yet (maybe some day). --- --- todo: enable one as main +-- yet ... maybe some day. local actions = constructors.handler local enabled = false -function constructors.enable () enabled = true end -function constructors.disable() enabled = false end - local function processor(head,followed_by_display) + -- todo: not again in otr so we need to flag if enabled then starttiming(parbuilders) local head = actions(head,followed_by_display) @@ -117,8 +161,26 @@ local function processor(head,followed_by_display) end end +function constructors.enable() + enabled = true +end + +function constructors.disable() + enabled = false +end + + callbacks.register('linebreak_filter', processor, "breaking paragraps into lines") statistics.register("linebreak processing time", function() return statistics.elapsedseconds(parbuilders) end) + +-- interface + +commands.defineparbuilder = constructors.define +commands.startparbuilder = constructors.start +commands.stopparbuilder = constructors.stop +commands.setparbuilder = constructors.set +commands.enableparbuilder = constructors.enable +commands.disableparbuilder = constructors.disable diff --git a/tex/context/base/typo-bld.mkiv b/tex/context/base/typo-bld.mkiv new file mode 100644 index 000000000..10502005b --- /dev/null +++ b/tex/context/base/typo-bld.mkiv @@ -0,0 +1,64 @@ +%D \module +%D [ file=typo-bld, % was node-par, +%D version=2008.09.30, +%D title=\CONTEXT\ Typesetting Macros, +%D subtitle=Paragraph Building, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Node Macros / Paragraph Building} + +%D This is very experimental, undocumented, subjected to changes, etc. just as +%D the underlying interfaces. But at least it's cleaned as part of the status-mkiv +%D cleanup. + +% \startparbuilder[default] +% \input tufte \par +% \startparbuilder[oneline] +% \input tufte \par +% \stopparbuilder +% \input tufte \par +% \stopparbuilder +% +% \startparbuilder[oneline] +% \dorecurse{100}{\input ward \par} +% \stopparbuilder + +\unprotect + +\registerctxluafile{typo-bld}{1.001} + +\definesystemattribute[parbuilder][public] + +\installcorenamespace {parbuilder} + +\unexpanded\def\defineparbuilder[#1]% + {\ctxcommand{defineparbuilder("#1")}} + +\unexpanded\def\startparbuilder[#1]% + {\ifhmode\par\fi + \ctxcommand{startparbuilder("#1")}} + +\unexpanded\def\stopparbuilder + {\ifhmode\par\fi + \ctxcommand{stopparbuilder()}} + +\unexpanded\def\setmainparbuilder[#1]% + {\ctxcommand{setparbuilder("#1")}} + +% no high level interface, after all implementing a linebreaker is not something that +% the average user will do + +\defineparbuilder[default] % just for testing +\defineparbuilder[oneline] % just for testing +\defineparbuilder[basic] % just for testing + +\def\enableparbuilders {\ctxcommand{enableparbuilder()}} % hooks in otr so we need to pickup +\def\disableparbuilders{\ctxcommand{disableparbuilder()}} % hooks in otr so we need to pickup + +\protect \endinput diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index 7feb615ef..2499ad8db 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='podvetavlevo'/> <cd:constant name='lefttext' value='textvlevo'/> <cd:constant name='leftwidth' value='sirkavlevo'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='uroven'/> <cd:constant name='levels' value='urovne'/> <cd:constant name='limittext' value='limittext'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='minvyska'/> <cd:constant name='minwidth' value='minsirka'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='jmeno'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='znak'/> <cd:constant name='size' value='velikost'/> <cd:constant name='small' value='male'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sorttype'/> <cd:constant name='source' value='zdroj'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 0c985f851..5ba370a6d 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='linkersubsatz'/> <cd:constant name='lefttext' value='linkertext'/> <cd:constant name='leftwidth' value='linkerbreite'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='niveau'/> <cd:constant name='levels' value='niveaus'/> <cd:constant name='limittext' value='limittext'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='minhoehe'/> <cd:constant name='minwidth' value='minbreite'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='name'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='zeichen'/> <cd:constant name='size' value='groesse'/> <cd:constant name='small' value='klein'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sorttype'/> <cd:constant name='source' value='quelle'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index ab43723d1..fa765aa54 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='leftsubsentence'/> <cd:constant name='lefttext' value='lefttext'/> <cd:constant name='leftwidth' value='leftwidth'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='level'/> <cd:constant name='levels' value='levels'/> <cd:constant name='limittext' value='limittext'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='minheight'/> <cd:constant name='minwidth' value='minwidth'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='name'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='sign'/> <cd:constant name='size' value='size'/> <cd:constant name='small' value='small'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sorttype'/> <cd:constant name='source' value='source'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index c98e6a367..b668bd35c 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='sousphrasegauche'/> <cd:constant name='lefttext' value='textegauche'/> <cd:constant name='leftwidth' value='largeurgauche'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='niveau'/> <cd:constant name='levels' value='niveaux'/> <cd:constant name='limittext' value='limittext'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='hauteurmin'/> <cd:constant name='minwidth' value='largeurmin'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='nom'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='signe'/> <cd:constant name='size' value='dimension'/> <cd:constant name='small' value='petit'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sorttype'/> <cd:constant name='source' value='origine'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index 08a7d7947..df260ffa4 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='sottofrasesinistra'/> <cd:constant name='lefttext' value='testosinistro'/> <cd:constant name='leftwidth' value='ampiezzasinistra'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='livello'/> <cd:constant name='levels' value='livelli'/> <cd:constant name='limittext' value='limittext'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='altezzamin'/> <cd:constant name='minwidth' value='ampiezzamin'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='nome'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='segno'/> <cd:constant name='size' value='dimensione'/> <cd:constant name='small' value='piccolo'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sorttype'/> <cd:constant name='source' value='origine'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index 6d9852258..5dd2f83dd 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='linkersubzin'/> <cd:constant name='lefttext' value='linkertekst'/> <cd:constant name='leftwidth' value='linkerbreedte'/> + <cd:constant name='less' value='minder'/> <cd:constant name='level' value='niveau'/> <cd:constant name='levels' value='niveaus'/> <cd:constant name='limittext' value='limiettekst'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='minhoogte'/> <cd:constant name='minwidth' value='minbreedte'/> <cd:constant name='monthconversion' value='maandconversie'/> + <cd:constant name='more' value='meer'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='naam'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='teken'/> <cd:constant name='size' value='formaat'/> <cd:constant name='small' value='klein'/> + <cd:constant name='solution' value='oplossing'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sortering'/> <cd:constant name='source' value='bron'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 232f3ce59..2128680e7 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='زیرجملهچپ'/> <cd:constant name='lefttext' value='متنچپ'/> <cd:constant name='leftwidth' value='عرضخط'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='مرحله'/> <cd:constant name='levels' value='مرحلهها'/> <cd:constant name='limittext' value='مرزمتن'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='کمترینارتفاع'/> <cd:constant name='minwidth' value='کمترینعرض'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='نام'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='علامت'/> <cd:constant name='size' value='اندازه'/> <cd:constant name='small' value='کوچک'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='ترتیبتایپ'/> <cd:constant name='source' value='منبع'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index 6368aede6..915a0c226 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -779,6 +779,7 @@ <cd:constant name='leftsubsentence' value='subpropozitiestanga'/> <cd:constant name='lefttext' value='textstanga'/> <cd:constant name='leftwidth' value='latimestanga'/> + <cd:constant name='less' value='less'/> <cd:constant name='level' value='nivel'/> <cd:constant name='levels' value='nivele'/> <cd:constant name='limittext' value='limittext'/> @@ -817,6 +818,7 @@ <cd:constant name='minheight' value='inaltimeminima'/> <cd:constant name='minwidth' value='latimeminima'/> <cd:constant name='monthconversion' value='monthconversion'/> + <cd:constant name='more' value='more'/> <cd:constant name='n' value='n'/> <cd:constant name='name' value='nume'/> <cd:constant name='namesep' value='namesep'/> @@ -979,6 +981,7 @@ <cd:constant name='sign' value='semn'/> <cd:constant name='size' value='dimensiune'/> <cd:constant name='small' value='mic'/> + <cd:constant name='solution' value='solution'/> <cd:constant name='sort' value='sort'/> <cd:constant name='sorttype' value='sorttype'/> <cd:constant name='source' value='sursa'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b4f6f63d0..f3f55bd5a 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 06/12/12 09:56:51 +-- merge date : 06/13/12 09:57:33 do -- begin closure to overcome local limits and interference |