summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-10-10 22:38:43 +0300
committerMarius <mariausol@gmail.com>2010-10-10 22:38:43 +0300
commit16099e33b6d50b37bcddb96e29777a235d2335d7 (patch)
tree724169a7882d1588f8ee4a4511c73fb9b9a232cd /tex
parent2040be98036288cccf0384479819e8c0c17e8d8d (diff)
downloadcontext-16099e33b6d50b37bcddb96e29777a235d2335d7.tar.gz
beta 2010.10.10 14:25
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/buff-ini.mkiv12
-rw-r--r--tex/context/base/char-def.lua4
-rw-r--r--tex/context/base/char-utf.lua22
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/data-res.lua6
-rw-r--r--tex/context/base/grph-inc.lua4
-rw-r--r--tex/context/base/l-table.lua11
-rw-r--r--tex/context/base/lpdf-fmt.lua29
-rw-r--r--tex/context/base/lpdf-ren.lua51
-rw-r--r--tex/context/base/lpdf-wid.lua78
-rw-r--r--tex/context/base/math-noa.lua67
-rw-r--r--tex/context/base/math-vfu.lua51
-rw-r--r--tex/context/base/node-inj.lua18
-rw-r--r--tex/context/base/page-lin.lua46
-rw-r--r--tex/context/base/page-lin.mkiv52
-rw-r--r--tex/context/base/page-mar.mkiv11
-rw-r--r--tex/context/base/scrn-int.lua2
-rw-r--r--tex/context/base/scrn-int.mkiv5
-rw-r--r--tex/context/base/strc-num.lua32
-rw-r--r--tex/context/base/strc-reg.lua61
-rw-r--r--tex/context/base/strc-reg.mkiv30
-rw-r--r--tex/context/base/strc-sec.mkiv23
-rw-r--r--tex/context/base/task-ini.lua1
-rw-r--r--tex/context/base/x-res-50.tex2
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua31
27 files changed, 450 insertions, 205 deletions
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index 2ea660dc1..19fabcff6 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -203,18 +203,14 @@
\def\doprocessbufferverbatim
{\doinitializeverbatim
+ \beginofverbatimlines
\dostarttagged\t!verbatim\currentbuffer
\ctxlua{buffers.type("\currentbuffer","\typingparameter\c!strip")}%
- \dostoptagged}
+ \dostoptagged
+ \endofverbatimlines}
\def\doprocessbufferlinesverbatim#1#2#3%
- {#2%
- % todo, set up numbers
- \doinitializeverbatim
- \dostarttagged\t!verbatim\currentbuffer
- \ctxlua{buffers.type("\currentbuffer","\typingparameter\c!strip")}
- \dostoptagged
- #3}
+ {#2\doprocessbufferverbatim#3}
\def\doifelsebuffer#1%
{\ctxlua{buffers.doifelsebuffer("#1")}}
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index 2a46080b3..4c72c4772 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -53839,7 +53839,7 @@ characters.data={
mathname="nsubset",
linebreak="al",
mirror=0x2285,
- specials={ "char", 0x0338, 0x2282 },
+ specials={ "char", 0x2282, 0x0338 },
unicodeslot=0x2284,
},
[0x2285]={
@@ -53850,7 +53850,7 @@ characters.data={
mathclass="relation",
mathname="nsupset",
mirror=0x2284,
- specials={ "char", 0x0338, 0x2283 },
+ specials={ "char", 0x2283, 0x0338 },
unicodeslot=0x2285,
},
[0x2286]={
diff --git a/tex/context/base/char-utf.lua b/tex/context/base/char-utf.lua
index a0a611e9a..c3549ec01 100644
--- a/tex/context/base/char-utf.lua
+++ b/tex/context/base/char-utf.lua
@@ -35,6 +35,9 @@ local characters = characters
characters.graphemes = allocate()
local graphemes = characters.graphemes
+characters.mathpairs = allocate()
+local mathpairs = characters.mathpairs
+
characters.filters = allocate()
local filters = characters.filters
@@ -54,13 +57,28 @@ local function initialize()
-- using vs and first testing for length is faster (.02->.01 s)
local vs = v.specials
if vs and #vs == 3 and vs[1] == 'char' then
- local first, second = utfchar(vs[2]), utfchar(vs[3])
+ local one, two = vs[2], vs[3]
+ local first, second, combined = utfchar(one), utfchar(two), utfchar(k)
local cgf = graphemes[first]
if not cgf then
cgf = { }
graphemes[first] = cgf
end
- cgf[second] = utfchar(k)
+ cgf[second] = combined
+ if v.mathclass or v.mathspec then
+ local mps = mathpairs[two]
+ if not mps then
+ mps = { }
+ mathpairs[two] = mps
+ end
+ mps[one] = k
+ local mps = mathpairs[second]
+ if not mps then
+ mps = { }
+ mathpairs[second] = mps
+ end
+ mps[first] = combined
+ end
end
end
initialize = false
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index e400dfaa0..33f4b7d6d 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -45,4 +45,6 @@
buffers.change_state = logs.obsolete("buffers.change_state","buffers.finishstate")
\stopluacode
+\def\luaexpr#1{\ctxlua{tex.sprint(tex.ctxcatcodes,tostring(#1))}} % todo: other catcode regimes
+
\protect \endinput
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index c2577a3a6..1ec2bd3f8 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2010.10.06 10:20}
+\newcontextversion{2010.10.10 14:25}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 17ab0279f..e08f3528a 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2010.10.06 10:20}
+\edef\contextversion{2010.10.10 14:25}
%D For those who want to use this:
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index f7dd5cd2e..4a61ae61f 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -244,9 +244,9 @@ local function load_configuration_files()
local filename = filejoin(pathname,luacnfname)
local blob = loadfile(filename)
if blob then
+ local setups = instance.setups
local data = blob()
data = data and data.content
- local setups = instance.setups
if data then
if trace_locating then
report_resolvers("loading configuration file '%s'",filename)
@@ -298,13 +298,13 @@ local function load_configuration_files()
else
if trace_locating then
- report_resolvers("skipping configuration file '%s'",filename)
+ report_resolvers("skipping configuration file '%s' (no content)",filename)
end
setups[pathname] = { }
instance.loaderror = true
end
elseif trace_locating then
- report_resolvers("skipping configuration file '%s'",filename)
+ report_resolvers("skipping configuration file '%s' (no file)",filename)
end
instance.order[#instance.order+1] = instance.setups[pathname]
if instance.loaderror then
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 95a465b4d..651ed7157 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -154,7 +154,7 @@ figures.formats = allocate{
["svg"] = { list = { "svg", "svgz" } },
["eps"] = { list = { "eps", "ai" } },
["gif"] = { list = { "gif" } },
- ["mov"] = { list = { "mov", "flv" } }, -- "avi" is not supported
+ ["mov"] = { list = { "mov", "flv", "mp4" } }, -- "avi" is not supported
["buffer"] = { list = { "tmp", "buffer", "buf" } },
["tex"] = { list = { "tex" } },
}
@@ -353,7 +353,7 @@ function figures.current()
end
local defaultformat = "pdf"
-local defaultprefix = "m_k_v_i_"
+local defaultprefix = "m_k_i_v_"
local function register(askedname,specification)
if specification then
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index 1bd9921cb..1a871f0fe 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -82,7 +82,12 @@ function table.keys(t)
end
local function compare(a,b)
- return (tostring(a) < tostring(b))
+ local ta, tb = type(a), type(b) -- needed, else 11 < 2
+ if ta == tb then
+ return a < b
+ else
+ return tostring(a) < tostring(b)
+ end
end
local function sortedkeys(tab)
@@ -94,12 +99,10 @@ local function sortedkeys(tab)
else
local tkey = type(key)
if tkey == "string" then
- -- if kind == 2 then kind = 3 else kind = 1 end
kind = (kind == 2 and 3) or 1
elseif tkey == "number" then
- -- if kind == 1 then kind = 3 else kind = 2 end
kind = (kind == 1 and 3) or 2
- else -- if tkey then
+ else
kind = 3
end
end
diff --git a/tex/context/base/lpdf-fmt.lua b/tex/context/base/lpdf-fmt.lua
index 0b1dada0e..a5152c461 100644
--- a/tex/context/base/lpdf-fmt.lua
+++ b/tex/context/base/lpdf-fmt.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['lpdf-fmt'] = {
license = "see context related readme files",
}
+-- Thanks to Luigi and Steffen for testing.
+
-- context --directives="backend.format=PDF/X-1a:2001" --trackers=backend.format yourfile
local trace_format = false trackers.register("backend.format", function(v) trace_format = v end)
@@ -115,6 +117,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.3,
format_name = "PDF/X-1a:2001",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
spot_colors = true,
@@ -128,6 +131,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.4,
format_name = "PDF/X-1a:2003",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
spot_colors = true,
@@ -141,6 +145,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.3,
format_name = "PDF/X-3:2002",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -157,6 +162,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.4,
format_name = "PDF/X-3:2003",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -174,6 +180,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.6,
format_name = "PDF/X-4",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -197,6 +204,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.6,
format_name = "PDF/X-4p",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -221,6 +229,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.6,
format_name = "PDF/X-5g",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -243,6 +252,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.6,
format_name = "PDF/X-5pg",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -266,6 +276,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.6,
format_name = "PDF/X-5n",
xmp_file = "lpdf-pdx.xml",
+ gts_flag = "GTS_PDFX",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -288,6 +299,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.4,
format_name = "pdf/a-1a:2005",
xmp_file = "lpdf-pda.xml",
+ gts_flag = "GTS_PDFA1",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -297,6 +309,7 @@ local formats = utilities.storage.allocate {
include_intents = true,
forms = true, -- NEW; forms are allowed (with limitations); no JS, other restrictions are unknown (TODO)
tagging = true, -- NEW; the only difference to PDF/A-1b
+ internal_icc_profiles = true,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>1</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false)
end
@@ -305,6 +318,7 @@ local formats = utilities.storage.allocate {
pdf_version = 1.4,
format_name = "pdf/a-1b:2005",
xmp_file = "lpdf-pda.xml",
+ gts_flag = "GTS_PDFA1",
gray_scale = true,
cmyk_colors = true,
rgb_colors = true,
@@ -313,6 +327,7 @@ local formats = utilities.storage.allocate {
cielab_colors = true, -- unknown
include_intents = true,
forms = true,
+ internal_icc_profiles = true,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>1</pdfaid:part><pdfaid:conformance>B</pdfaid:conformance></rdf:Description>",false)
end
@@ -485,7 +500,7 @@ end
local loadeddefaults = { }
-local function handledefaultprofile(s) -- specification
+local function handledefaultprofile(s,spec) -- specification
local filename, colorspace = s.filename or "", lower(s.colorspace or "")
if filename == "" or colorspace == "" then
report_backends("error in default profile specification: %s",serialize(s,false))
@@ -513,7 +528,7 @@ end
local loadedintents, intents = { }, pdfarray()
-local function handleoutputintent(s)
+local function handleoutputintent(s,spec)
local name, url, filename, id, outputcondition, info = s.info or s.filename or "", s.url or "", s.filename or "", s.id or "", s.outputcondition or "", s.info or ""
if name == "" or id == "" then
report_backends("error in output intent specification: %s",serialize(s,false))
@@ -523,7 +538,7 @@ local function handleoutputintent(s)
if internal or external then
local d = {
Type = pdfconstant("OutputIntent"),
- S = pdfconstant("GTS_PDFX"),
+ S = pdfconstant(spec.gts_flag or "GTS_PDFX"),
OutputConditionIdentifier = id,
RegistryName = url,
OutputCondition = outputcondition,
@@ -549,7 +564,7 @@ local function handleoutputintent(s)
end
end
-local function handleiccprofile(message,name,filename,how,options,alwaysinclude)
+local function handleiccprofile(message,spec,name,filename,how,options,alwaysinclude,gts_flag)
if name and name ~= "" then
local list = settings_to_array(name)
for i=1,#list do
@@ -595,7 +610,7 @@ local function handleiccprofile(message,name,filename,how,options,alwaysinclude)
report_backends("no profile inclusion for '%s'",formatname)
end
end
- how(profile)
+ how(profile,spec)
elseif trace_format then
report_backends("unknown profile '%s'",name)
end
@@ -679,8 +694,8 @@ function codeinjections.setformat(s)
inject_metadata()
end
local options = settings_to_hash(option)
- handleiccprofile("color profile",profile,filename,handledefaultprofile,options,true)
- handleiccprofile("output intent",intent,filename,handleoutputintent,options,false)
+ handleiccprofile("color profile",spec,profile,filename,handledefaultprofile,options,true)
+ handleiccprofile("output intent",spec,intent,filename,handleoutputintent,options,false)
if trace_variables then
for k, v in table.sortedhash(formats.default) do
local v = formatspecification[k]
diff --git a/tex/context/base/lpdf-ren.lua b/tex/context/base/lpdf-ren.lua
index 7c2d96467..33513c0d1 100644
--- a/tex/context/base/lpdf-ren.lua
+++ b/tex/context/base/lpdf-ren.lua
@@ -53,57 +53,6 @@ function backends.pdf.layerreference(name)
return pdfln[name]
end
--- only flush layers that are used
-
---~ function codeinjections.defineviewerlayer(specification)
---~ if textlayers then
---~ local tag = specification.tag
---~ -- todo: reserve
---~ local n = pdfdictionary {
---~ Type = pdf_ocg,
---~ Name = specification.title or "unknown",
---~ Intent = ((specification.kind > 0) and pdf_design) or nil, -- disable layer hiding by user
---~ Usage = ((specification.printable == variables.no) and lpdf_usage) or nil , -- printable or not
---~ }
---~ local nr = pdfreference(pdfflushobject(n))
---~ pdfln[tag] = nr -- was n
---~ local d = pdfdictionary {
---~ Type = pdf_ocmd,
---~ OCGs = pdfarray { nr },
---~ }
---~ local dr = pdfreference(pdfflushobject(d))
---~ pdfld[tag] = dr
---~ textlayers[#textlayers+1] = nr
---~ if specification.visible == variables.start then
---~ videlayers[#videlayers+1] = nr
---~ else
---~ hidelayers[#hidelayers+1] = nr
---~ end
---~ pagelayers[tag] = dr -- check
---~ end
---~ end
-
---~ local function flushtextlayers()
---~ if textlayers and #textlayers > 0 then
---~ local d = pdfdictionary {
---~ OCGs = textlayers,
---~ D = pdfdictionary {
---~ Order = textlayers,
---~ ON = videlayers,
---~ OFF = hidelayers,
---~ },
---~ }
---~ lpdf.addtocatalog("OCProperties",d)
---~ textlayers = nil
---~ end
---~ end
-
---~ local function flushpagelayers() -- we can share these
---~ if next(pagelayers) then
---~ lpdf.addtopageresources("Properties",pagelayers)
---~ end
---~ end
-
local pagelayers, pagelayersreference, cache = nil, nil, { }
function codeinjections.defineviewerlayer(specification)
diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua
index 651790630..fe02196dc 100644
--- a/tex/context/base/lpdf-wid.lua
+++ b/tex/context/base/lpdf-wid.lua
@@ -10,6 +10,8 @@ local format, gmatch, gsub, find = string.format, string.gmatch, string.gsub, st
local texsprint, ctxcatcodes, texbox, texcount = tex.sprint, tex.ctxcatcodes, tex.box, tex.count
local settings_to_array = utilities.parsers.settings_to_array
+local report_media = logs.report("media")
+
local backends, lpdf, nodes = backends, lpdf, nodes
local nodeinjections = backends.pdf.nodeinjections
@@ -37,6 +39,8 @@ local pdfannotation_node = nodepool.pdfannotation
local hpack_node, write_node = node.hpack, node.write
+local pdf_border = pdfarray { 0, 0, 0 } -- can be shared
+
-- symbols
local presets = { } -- xforms
@@ -247,12 +251,33 @@ end
-- smil application/smil
-- swf application/x-shockwave-flash
+-- P media play parameters (evt /BE for controls etc
+-- A boolean (audio)
+-- C boolean (captions)
+---O boolean (overdubs)
+---S boolean (subtitles)
+-- PL pdfconstant("ADBE_MCI"),
+
+-- F = flags,
+-- T = title,
+-- Contents = rubish,
+-- AP = irrelevant,
+
+-- sound is different, no window (or zero) so we need to collect them and
+-- force them if not set
+
local ms, mu, mf = { }, { }, { }
-local delayed = { }
+local function delayed(label)
+ local a = pdfreserveannotation()
+ mu[label] = a
+ return pdfreference(a)
+end
local function insertrenderingwindow(label,width,height,specification)
- if options == variables.auto then
+--~ local openpage = specification.openpage
+--~ local closepage = specification.closepage
+ if specification.options == variables.auto then
if openpageaction then
-- \handlereferenceactions{\v!StartRendering{#2}}
end
@@ -267,15 +292,15 @@ local function insertrenderingwindow(label,width,height,specification)
PC = (closepage and lpdf.action(closepage)) or nil,
}
end
- local page = tonumber(specification.page) or texcount.realpageno
+ local page = tonumber(specification.page) or texcount.realpageno -- todo
local d = pdfdictionary {
Subtype = pdfconstant("Screen"),
P = pdfreference(pdfpagereference(page)),
A = mf[label],
- Border = pdfarray { 0, 0, 0 } ,
+ Border = pdf_border,
AA = actions,
}
- local r = pdfreserveannotation()
+ local r = mu[label] or pdfreserveannotation()
write_node(pdfannotation_node(width,height,0,d(),r)) -- save ref
return pdfreference(r)
end
@@ -287,12 +312,14 @@ local function insertrendering(specification)
local isurl = find(filename,"://")
local d = pdfdictionary {
Type = pdfconstant("Rendition"),
- S = pdfconstant("MR"),
+ S = pdfconstant("MR"), -- or SR for selector
+ N = label, -- here too?
C = pdfdictionary {
Type = pdfconstant("MediaClip"),
S = pdfconstant("MCD"),
N = label,
- CT = specification.mime,
+ -- P = pdfdictionary { TF = pdfstring("TEMPALWAYS") }, -- TEMPNEVER TEMPEXTRACT TEMPACCESS TEMPALWAYS
+ CT = specification.mime, -- also /PL needs to be present then
Alt = pdfarray {
"", "file not found", -- language id + message
},
@@ -304,15 +331,13 @@ local function insertrendering(specification)
}
}
mf[label] = pdfreference(pdfflushobject(d))
- if not ms[label] then
- mu[label] = insertrenderingwindow(label,0,0,specification.options)
- end
end
end
local function insertrenderingobject(specification)
local label = specification.label
if not mf[label] then
+ report_media("todo: unknown medium '%s'",label or "?")
local d = pdfdictionary {
Type = pdfconstant("Rendition"),
S = pdfconstant("MR"),
@@ -320,40 +345,37 @@ local function insertrenderingobject(specification)
Type = pdfconstant("MediaClip"),
S = pdfconstant("MCD"),
N = label,
- D = pdfreference(unknown), -- not label but objectname, hm
+ D = pdfreference(unknown), -- not label but objectname, hm .. todo?
}
}
mf[label] = pdfreference(pdfflushobject(d))
- if ms[label] then
- insertrenderingwindow(label,0,0,specification)
- end
end
end
-function codeinjections.insertrenderingwindow(specification)
- local label = specification.label
- codeinjections.processrendering(label) -- was check at tex end
- ms[label] = insertrenderingwindow(label,specification.width,specification.height,specification)
-end
-
function codeinjections.processrendering(label)
local specification = interactions.renderings.rendering(label)
- if specification then
- if specification.kind == "external" then
- insertrendering(specification)
- else
- insertrenderingobject(specification)
- end
+ if not specification then
+ -- error
+ elseif specification.kind == "external" then
+ insertrendering(specification)
+ else
+ insertrenderingobject(specification)
end
end
+function codeinjections.insertrenderingwindow(specification)
+ local label = specification.label
+ codeinjections.processrendering(label)
+ ms[label] = insertrenderingwindow(label,specification.width,specification.height,specification)
+end
+
local function set(operation,arguments)
- codeinjections.processrendering(arguments) -- was check at the tex end
+ codeinjections.processrendering(arguments)
return pdfdictionary {
S = pdfconstant("Rendition"),
OP = operation,
R = mf[arguments],
- AN = ms[arguments] or mu[arguments],
+ AN = ms[arguments] or delayed(arguments),
}
end
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index c22b1272f..51df84e6f 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -11,6 +11,9 @@ if not modules then modules = { } end modules ['math-noa'] = {
-- moment this is ok
--
-- we will also make dedicated processors (faster)
+--
+-- beware: names will change as we wil make noads.xxx.handler i.e. xxx
+-- subnamespaces
local utf = unicode.utf8
@@ -46,6 +49,7 @@ local nodecodes = nodes.nodecodes
local noadcodes = nodes.noadcodes
local noad_ord = noadcodes.ord
+local noad_rel = noadcodes.rel
local noad_punct = noadcodes.punct
local math_noad = nodecodes.noad -- attr nucleus sub sup
@@ -160,6 +164,8 @@ local fcs = fonts.colors.set
--~ end
--~ end
+local current_id, current_characters
+
processors.relocate[math_char] = function(pointer)
local g = has_attribute(pointer,mathgreek) or 0
local a = has_attribute(pointer,mathalphabet) or 0
@@ -175,8 +181,15 @@ processors.relocate[math_char] = function(pointer)
if newchar then
local fam = pointer.fam
local id = font_of_family(fam)
+ --
local tfmdata = fontdata[id]
- if tfmdata and tfmdata.characters[newchar] then -- we could probably speed this up
+ if tfmdata and tfmdata.characters[newchar] then
+ -- -- to be tested:
+ -- if id ~= current_id then
+ -- current_id = id
+ -- current_characters = fontdata[id].characters
+ -- end
+ -- if current_characters and current_characters[newchar] then
if trace_remapping then
report_remap("char",id,char,newchar)
end
@@ -313,6 +326,58 @@ function handlers.respace(head,style,penalties)
return true
end
+-- The following code is dedicated to Luigi Scarso who pointed me
+-- to the fact that \not= is not producing valid pdf-a code.
+-- The code does not solve this for virtual characters but it does
+-- a decent job on collapsing so that fonts that have the right
+-- glyph will have a decent unicode point.
+
+local collapse = { } processors.collapse = collapse
+
+local mathpairs = characters.mathpairs
+
+collapse[math_noad] = function(pointer)
+ if pointer.subtype == noad_rel then
+ local current_nucleus = pointer.nucleus
+ if current_nucleus.id == math_char then
+ local current_char = current_nucleus.char
+ local mathpair = mathpairs[current_char]
+ if mathpair then
+ local next_noad = pointer.next
+ if next_noad and next_noad.id == math_noad and next_noad.subtype == noad_rel then
+ local next_nucleus = next_noad.nucleus
+ if next_nucleus.id == math_char then
+ local next_char = next_nucleus.char
+ local newchar = mathpair[next_char]
+ if newchar then
+ local fam = current_nucleus.fam
+ local id = font_of_family(fam)
+ local tfmdata = fontdata[id]
+ if tfmdata and tfmdata.characters[newchar] then
+ -- print("!!!!!",current_char,next_char,newchar)
+ current_nucleus.char = newchar
+ local next_next_noad = next_noad.next
+ if next_next_noad then
+ pointer.next = next_next_noad
+ next_next_noad.prev = pointer
+ else
+ pointer.next = nil
+ end
+ node.free(next_noad)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+function noads.handlers.collapse(head,style,penalties)
+ process(head,collapse)
+ return true
+end
+
-- math alternates
function fonts.initializers.common.mathalternates(tfmdata)
diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua
index 183eefc2a..e1a664ef9 100644
--- a/tex/context/base/math-vfu.lua
+++ b/tex/context/base/math-vfu.lua
@@ -29,31 +29,31 @@ local shared = { }
fonts.vf.math = fonts.vf.math or { }
fonts.vf.math.optional = false
-local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 }
+--~ local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 }
-local function negate(main,characters,id,size,unicode,basecode)
- if not characters[unicode] then
- local basechar = characters[basecode]
- if basechar then
- local ht, wd = basechar.height, basechar.width
- characters[unicode] = {
- width = wd,
- height = ht,
- depth = basechar.depth,
- italic = basechar.italic,
- kerns = basechar.kerns,
- commands = {
- { "slot", 1, basecode },
- push,
- { "down", ht/5},
- { "right", - wd/2},
- back,
- push,
- }
- }
- end
- end
-end
+--~ local function negate(main,characters,id,size,unicode,basecode)
+--~ if not characters[unicode] then
+--~ local basechar = characters[basecode]
+--~ if basechar then
+--~ local ht, wd = basechar.height, basechar.width
+--~ characters[unicode] = {
+--~ width = wd,
+--~ height = ht,
+--~ depth = basechar.depth,
+--~ italic = basechar.italic,
+--~ kerns = basechar.kerns,
+--~ commands = {
+--~ { "slot", 1, basecode },
+--~ push,
+--~ { "down", ht/5},
+--~ { "right", - wd/2},
+--~ back,
+--~ push,
+--~ }
+--~ }
+--~ end
+--~ end
+--~ end
--~ \Umathchardef\braceld="0 "1 "FF07A
--~ \Umathchardef\bracerd="0 "1 "FF07B
@@ -300,7 +300,7 @@ function fonts.vf.math.alas(main,id,size)
brace (main,characters,id,size,0x23DF,0xFF27C,0xFF401,0xFF27B,0xFF27A,0xFF401,0xFF27D)
parent (main,characters,id,size,0x23DC,0xFF17A,0xFF301,0xFF17B)
parent (main,characters,id,size,0x23DD,0xFF27C,0xFF401,0xFF27D)
- negate (main,characters,id,size,0x2260,0x003D)
+ -- negate (main,characters,id,size,0x2260,0x003D)
dots (main,characters,id,size,0x2026) -- ldots
dots (main,characters,id,size,0x22EE) -- vdots
dots (main,characters,id,size,0x22EF) -- cdots
@@ -322,6 +322,7 @@ function fonts.vf.math.alas(main,id,size)
jointwo (main,characters,id,size,0x21AA,0xFE322,3,0x02192) -- \lhook\joinrel\rightarrow
stack (main,characters,id,size,0x2259,0x0003D,3,0x02227) -- \buildrel\wedge\over=
jointwo (main,characters,id,size,0x22C8,0x022B3,4,0x022B2) -- \mathrel\triangleright\joinrel\mathrel\triangleleft (4 looks better than 3)
+ jointwo (main,characters,id,size,0x2260,0x00338,0,0x0003D) -- \not\equal
jointwo (main,characters,id,size,0x2284,0x00338,0,0x02282) -- \not\subset
jointwo (main,characters,id,size,0x2285,0x00338,0,0x02283) -- \not\supset
jointwo (main,characters,id,size,0x22A7,0x0007C,3,0x0003D) -- \mathrel|\joinrel=
diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua
index 55fab6e75..f576c7ee2 100644
--- a/tex/context/base/node-inj.lua
+++ b/tex/context/base/node-inj.lua
@@ -121,7 +121,7 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,index) --ba=baseancho
set_attribute(base,markbase,bound)
set_attribute(start,markmark,bound)
set_attribute(start,markdone,index)
- marks[bound] = { [index] = { dx, dy } }
+ marks[bound] = { [index] = { dx, dy, rlmode } }
return dx, dy, bound
end
@@ -318,17 +318,23 @@ function injections.handler(head,where,keep)
local index = has_attribute(n,markdone) or 1
local d = mrks[index]
if d then
- -- local rlmode = d[3] -- not used
- -- if rlmode and rlmode > 0 then
- -- todo
- -- else
+ local rlmode = d[3]
+ if rlmode and rlmode > 0 then
+ -- new per 2010-10-06
+ local k = wx[p]
+ if k then -- maybe (d[1] - p.width) and/or + k[2]
+ n.xoffset = p.xoffset - (p.width - d[1]) - k[2]
+ else
+ n.xoffset = p.xoffset - (p.width - d[1])
+ end
+ else
local k = wx[p]
if k then
n.xoffset = p.xoffset - d[1] - k[2]
else
n.xoffset = p.xoffset - d[1]
end
- -- end
+ end
if mk[p] then
n.yoffset = p.yoffset + d[2]
else
diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua
index e814fd7c4..895f0ec80 100644
--- a/tex/context/base/page-lin.lua
+++ b/tex/context/base/page-lin.lua
@@ -178,11 +178,43 @@ local function check_number(n,a,skip,sameline)
end
end
-function boxed.stage_one(n)
+-- xlist
+-- xlist
+-- hlist
+
+local function identify(list)
+ if list then
+ for n in traverse_id(hlist_code,list) do
+ if has_attribute(n,a_linenumber) then
+ return list
+ end
+ end
+ local n = list
+ while n do
+ local id = n.id
+ if id == hlist_code or id == vlist_code then
+ local ok = identify(n.list)
+ if ok then
+ return ok
+ end
+ end
+ n = n.next
+ end
+ end
+end
+
+function boxed.stage_zero(n)
+ return identify(texbox[n].list)
+end
+
+function boxed.stage_one(n,nested)
current_list = { }
local head = texbox[n]
if head then
local list = head.list
+ if nested then
+ list = identify(list)
+ end
local last_a, last_v, skip = nil, -1, false
for n in traverse_id(hlist_code,list) do -- attr test here and quit as soon as zero found
if n.height == 0 and n.depth == 0 then
@@ -200,6 +232,9 @@ function boxed.stage_one(n)
da.start = 1 -- eventually we will have a normal counter
end
last_a = a
+ if trace_numbers then
+ report_lines("starting line number range %s: start %s, continue",a,da.start,da.continue or "no")
+ end
end
if has_attribute(n,a_displaymath) then
if nodes.is_display_math(n) then
@@ -231,8 +266,13 @@ function boxed.stage_two(n,m)
for i=1,#current_list do
local li = current_list[i]
local n, m, ti = li[1], li[2], t[i]
- ti.next, n.list = n.list, ti
- resolve(n,m)
+ if ti then
+ ti.next, n.list = n.list, ti
+ resolve(n,m)
+ else
+ report_lines("error in linenumbering (1)")
+ return
+ end
end
end
end
diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv
index 84fa77813..2cea2da03 100644
--- a/tex/context/base/page-lin.mkiv
+++ b/tex/context/base/page-lin.mkiv
@@ -24,6 +24,30 @@
%
% we should use normal counters but then we need to sync settings
+% not yet ok, we need to give the top line a proper height
+%
+% \newbox\locallinenumberbox
+%
+% \unexpanded\def\startlocallinenumbering
+% {\setbox\locallinenumberbox\vbox\bgroup
+% \startlinenumbering}
+%
+% \unexpanded\def\stoplocallinenumbering
+% {\stoplinenumbering
+% \egroup
+% \mkdoprocessdeepboxcontents\locallinenumberbox
+% \unvbox\locallinenumberbox}
+
+% some line
+%
+% \startlocallinenumbering
+% some source code 1\par
+% some source code 2\par
+% some source code 3\par
+% \stoplocallinenumbering
+%
+% some line
+
\registerctxluafile{page-lin}{1.001}
\definesystemattribute[linenumber] [public]
@@ -32,15 +56,19 @@
\appendtoksonce \attribute\linenumberattribute \attributeunsetvalue \to \everyforgetall
\appendtoksonce \attribute\displaymathattribute\plusone \to \everybeforedisplayformula
-\newcount\linenumber % not used
-\newbox \linenumberscratchbox
-\newcount\linenumberchunk
-\newcount\linerefcounter
+\newcount \linenumber % not used
+\newbox \linenumberscratchbox
+\newcount \linenumberchunk
+\newcount \linerefcounter
+\newconstant\linenumbernesting
\newconditional\tracelinenumbering
-\def\mkprocesstextlinenumbers#1%
- {\setbox\linenumberscratchbox\vbox{\forgetall\offinterlineskip\ctxlua{nodes.lines.boxed.stage_one(\number#1)}}%
+\def\mkprocesstextlinenumbers#1#2%
+ {\setbox\linenumberscratchbox\vbox
+ {\forgetall
+ \offinterlineskip
+ \ctxlua{nodes.lines.boxed.stage_one(\number#1,\ifcase\linenumbernesting false\else true\fi)}}%
\ctxlua{nodes.lines.boxed.stage_two(\number#1,\number\linenumberscratchbox)}}% can move to lua code
% id nr shift width leftskip dir
@@ -49,9 +77,10 @@
\newconditional\boxcontentneedsprocessing
-\def\mkdoprocesspagecontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone}
-\def\mkdoprocessboxcontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone}
-\def\mkdoprocesscolumncontents#1{\mkaddtextlinenumbers{#1}\currentcolumn\nofcolumns}
+\def\mkdoprocesspagecontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone \zerocount}
+\def\mkdoprocessboxcontents #1{\mkaddtextlinenumbers{#1}\plusone \plusone \zerocount}
+\def\mkdoprocessdeepboxcontents#1{\mkaddtextlinenumbers{#1}\plusone \plusone \plusone }
+\def\mkdoprocesscolumncontents #1{\mkaddtextlinenumbers{#1}\currentcolumn\nofcolumns\zerocount}
\def\mklinenumberparameters
{continue = "\linenumberparameter\c!continue",
@@ -280,14 +309,15 @@
\newconstant \linenumbercolumn
\newconstant \linenumberlastcolumn
-\def\mkaddtextlinenumbers#1#2#3% box col max
+\def\mkaddtextlinenumbers#1#2#3#4% box col max nesting
{\bgroup
\linenumberbox #1\relax
\linenumbercolumn #2\relax
\linenumberlastcolumn#3\relax
+ \linenumbernesting #4\relax
\fullrestoreglobalbodyfont
\let\makelinenumber\maketextlinenumber
- \mkprocesstextlinenumbers\linenumberbox
+ \mkprocesstextlinenumbers\linenumberbox\linenumbernesting
\egroup}
\def\maketextlinenumber#1#2%
diff --git a/tex/context/base/page-mar.mkiv b/tex/context/base/page-mar.mkiv
index d5e7dbae1..037dc1298 100644
--- a/tex/context/base/page-mar.mkiv
+++ b/tex/context/base/page-mar.mkiv
@@ -16,6 +16,8 @@
%D extended en enhanced. Therefore it's always good to watch
%D out for unexpected side effects.
+%D TODO: use parents etc
+
\writestatus{loading}{ConTeXt Page Macros / Maginal Things}
\unprotect
@@ -197,6 +199,9 @@
\newcount\margincontentlevel
\newdimen\margincontentheight
+% \installparameterhandler \??im{inmargin}
+% \installparameterhashhandler\??im{inmargin}
+
\unexpanded\def\setupinmargin
{\dodoubleempty\dosetupinmargin}
@@ -207,10 +212,6 @@
\getparameters[\??im][#1]%
\fi}
-% \def\dodosetupinmargin[#1]#2% [settings]{class}
-% {\checkinmargin[#2]%
-% \getparameters[\??im#2][#1]}
-
\def\dodosetupinmargin[#1]#2% [settings]{class}
{\checkinmargin[#2]%
\getparameters[\??im#2][#1]%
@@ -423,7 +424,7 @@
+\compensatedinnermakeupmargin
+\csname\??im#1\c!distance\endcsname
\relax}
- {\dimexpr
+ {\hskip\dimexpr
+\margincontenthoffset
+\compensatedinnermakeupmargin
+\margincontentdistance
diff --git a/tex/context/base/scrn-int.lua b/tex/context/base/scrn-int.lua
index d01669aa4..556ead7c5 100644
--- a/tex/context/base/scrn-int.lua
+++ b/tex/context/base/scrn-int.lua
@@ -106,7 +106,7 @@ function linkedlists.add(name)
local l = collected[noflinks] or 0
local p = collected[currentlink-1] or f
local n = collected[currentlink+1] or l
- texsprint(ctxcatcodes,format("\\setlinkproperties{%s}{%s}{%s}{%s}{%s}{%s}",currentlink,noflinks,f,p,n,l))
+ context.setlinkproperties(currentlink,noflinks,f,p,n,l)
end
function linkedlists.enhance(name,n)
diff --git a/tex/context/base/scrn-int.mkiv b/tex/context/base/scrn-int.mkiv
index 70382249c..83263d1df 100644
--- a/tex/context/base/scrn-int.mkiv
+++ b/tex/context/base/scrn-int.mkiv
@@ -588,13 +588,14 @@
% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!closepageaction}}\dosetuprenderingclosepageaction
\localframed
[\??rw\currentrenderingwindow][\c!offset=\v!overlay]%
- {\ctxlua{backends.codeinjections.insertrenderingwindow {
+ {\vfill
+ \ctxlua{backends.codeinjections.insertrenderingwindow {
label = "\currentrendering",
width = \number\dimexpr\renderingwidth\relax,
height = \number\dimexpr\renderingheight\relax,
options = "\renderingoptions\currentrendering",
page = \number\renderingpage,
- }}}%
+ }}\hfill}%
\egroup}
\setupinteractionscreen
diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua
index f42b11b32..72cd75ecf 100644
--- a/tex/context/base/strc-num.lua
+++ b/tex/context/base/strc-num.lua
@@ -27,8 +27,8 @@ local variables = interfaces.variables
-- state: start stop none reset
-counters.specials = counters.specials or { }
-local counterspecials = counters.specials
+counters.specials = counters.specials or { }
+local counterspecials = counters.specials
local counterranges, tbs = { }, 0
@@ -121,13 +121,13 @@ local function allocate(name,i)
local cd = counterdata[name]
if not cd then
cd = {
- level = 1,
---~ block = "", -- todo
+ level = 1,
+ -- block = "", -- todo
numbers = nil,
- state = variables.start, -- true
- data = { }
+ state = variables.start, -- true
+ data = { }
}
- tobesaved[name] = { }
+ tobesaved[name] = { }
counterdata[name] = cd
end
cd = cd.data
@@ -135,13 +135,12 @@ local function allocate(name,i)
if not ci then
ci = {
number = 0,
- start = 0,
- saved = 0,
- step = 1,
- range = 1,
+ start = 0,
+ saved = 0,
+ step = 1,
+ range = 1,
offset = false,
- -- via metatable: last, first, and for tracing:
- stop = 0,
+ stop = 0, -- via metatable: last, first, stop only for tracing
}
setmetatable(ci, { __index = function(t,s) return constructor(t,s,name,i) end })
cd[i] = ci
@@ -340,7 +339,7 @@ function counters.setown(name,n,value)
elseif level > 0 then
check(name,d,n+1)
elseif level == 0 then
- -- happens elsewhere
+ -- happens elsewhere, check this for block
end
synchronize(name,d)
end
@@ -378,10 +377,15 @@ function counters.add(name,n,delta)
if cd and cd.state == variables.start then
local data = cd.data
local d = allocate(name,n)
+-- table.print(cd)
d.number = (d.number or d.start or 0) + delta*(d.step or 0)
local level = cd.level
+-- print(name,n,level)
if not level or level == -1 then
-- -1 is signal that we reset manually
+ elseif level == -2 then
+ -- -2 is signal that we work per text
+ check(name,data,n+1)
elseif level > 0 then
-- within countergroup
check(name,data,n+1)
diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua
index b08d73159..899339b5c 100644
--- a/tex/context/base/strc-reg.lua
+++ b/tex/context/base/strc-reg.lua
@@ -443,6 +443,8 @@ end
-- proc can be wrapped
+local seeindex = 0
+
function registers.flush(data,options,prefixspec,pagespec)
local equal = table.are_equal
-- local usedtags = { }
@@ -502,8 +504,49 @@ function registers.flush(data,options,prefixspec,pagespec)
end
texsprint(ctxcatcodes,"}")
end
- -- ranges need checking !
+ --
+ -- maybe we can nil the splits and save memory
+ --
+ do
+ -- hash words (potential see destinations)
+ local words = { }
+ for i=1,#result do
+ local data = result[i].data
+ for j=1,#data do
+ local d = data[j]
+ local word = d.list[1][1]
+ words[word] = d
+ end
+ end
+ -- link seewords to words and tag destination
+ for i=1,#result do
+ local data = result[i].data
+ for j=1,#data do
+ local d = data[j]
+ local seeword = d.seeword
+ if seeword then
+ local text = seeword.text
+ if text then
+ local w = words[text]
+ if w then
+ local wr = w.references
+ local dr = d.references
+ if wr.seeindex then
+ dr.seeindex = wr.seeindex
+ else
+ seeindex = seeindex + 1
+ dr.seeindex = seeindex
+ wr.seeindex = seeindex
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ --
for i=1,#result do
+ -- ranges need checking !
local sublist = result[i]
local done = { false, false, false, false }
local data = sublist.data
@@ -533,9 +576,10 @@ function registers.flush(data,options,prefixspec,pagespec)
texsprint(ctxcatcodes,"\\startregisterentries{",n,"}")
end
end
- local internal = entry.references.internal
+ local internal = entry.references.internal or 0
+ local seeindex = entry.references.seeindex or ""
if metadata then
- texsprint(ctxcatcodes,"\\registerentry{",internal,"}{")
+ texsprint(ctxcatcodes,"\\registerentry{",internal,"}{",seeindex,"}{")
local proc = entry.processors and entry.processors[1]
if proc then
texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{")
@@ -548,9 +592,9 @@ function registers.flush(data,options,prefixspec,pagespec)
else
local proc = entry.processors and entry.processors[1]
if proc then
- texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{\\registerentry{",internal,"}{",e[i],"}}")
+ texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{\\registerentry{",internal,"}{",seeindex,"}{",e[i],"}}")
else
- texsprint(ctxcatcodes,"\\registerentry{",internal,"}{",e[i],"}")
+ texsprint(ctxcatcodes,"\\registerentry{",internal,"}{",seeindex,"}{",e[i],"}")
end
end
else
@@ -712,11 +756,14 @@ function registers.flush(data,options,prefixspec,pagespec)
elseif kind == 'see' then
-- maybe some day more words
texsprint(ctxcatcodes,"\\startregisterseewords")
+ local seeindex = entry.references.seeindex or ""
+ local seetext = entry.seeword.text or ""
local proc = entry.processors and entry.processors[1]
+ -- todo: metadata like normal entries
if proc then
- texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{\\registeroneword{0}{0}{",entry.seeword.text,"}}") -- todo: internal
+ texsprint(ctxcatcodes,"\\applyprocessor{",proc,"}{\\registeroneword{0}{",seeindex,"}{",seetext,"}}")
else
- texsprint(ctxcatcodes,"\\registeroneword{0}{0}{",entry.seeword.text,"}") -- todo: internal
+ texsprint(ctxcatcodes,"\\registeroneword{0}{",seeindex,"}{",seetext,"}")
end
texsprint(ctxcatcodes,"\\stopregisterseewords")
end
diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv
index e1719bbc9..88c9dcca5 100644
--- a/tex/context/base/strc-reg.mkiv
+++ b/tex/context/base/strc-reg.mkiv
@@ -730,25 +730,43 @@
\dostoptagged
\dostoptagged}
-\def\registeroneword#1#2#3% content
+\def\registeroneword#1#2#3% #1:internal #2:seeindex #3:word
{\registerpageseparator
+ \def\currentregisterpageindex{#1}%
\dostarttagged\t!registersee\empty
- \registerseeword{#3}%
+ \iflocation
+ \def\currentregisterseeindex{#2}%
+ \else
+ \let\currentregisterseeindex\empty
+ \fi
+ \ifx\currentregisterseeindex\empty
+ \registerseeword{#3}%
+ \else
+[>\currentregisterseeindex]%
+ \registerseeword{\goto{#3}[seeindex:\currentregisterseeindex]}%
+ \fi
\dostoptagged}
\def\doapplyregisterentrycommand#1%
{\dostarttagged\t!registerentry\empty
+ \ifx\currentregisterseeindex\empty \else
+ \dontleavehmode
+[<\currentregisterseeindex]%
+ \pagereference[seeindex:\currentregisterseeindex]% maybe some day we will support an area
+ \fi
\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#1}}}%
\dostoptagged}
-\def\defaultregisterentry#1#2% #1 is pageref
+\def\defaultregisterentry#1#2#3% #1:internal #2:seeindex #3:word
{\def\currentregisterpageindex{#1}%
\iflocation
+ \def\currentregisterseeindex{#2}%
\doifelse{\registerparameter\c!interaction}\v!text
- {\directgoto{\setlocationcolor\??ia\doapplyregisterentrycommand{#2}}[internal(#1)]}
- {\doapplyregisterentrycommand{#2}}%
+ {\directgoto{\setlocationcolor\??ia\doapplyregisterentrycommand{#3}}[internal(#1)]}
+ {\doapplyregisterentrycommand{#3}}%
\else
- \doapplyregisterentrycommand{#2}%
+ \let\currentregisterseeindex\empty
+ \doapplyregisterentrycommand{#3}%
\fi}
\def\defaultregisterseeword#1%
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 2a6d25631..496d95b67 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -15,6 +15,8 @@
\unprotect
+\ifdefined \v!block \else \def\v!block{block} \fi
+
% compatibility issue:
%
% \def\setfullsectionnumber #1{}
@@ -114,10 +116,14 @@
\getparameters[\??nh#1][#2]%
\fi}
+% -2=text -1=manual 0=block 1+=structurelevel
+
\def\structuresectionlevel#1%
{\executeifdefined{\??nh#1\c!level}{-1}}
-\setvalue{\??nh block\c!level}{0} % -1 == manual
+\setvalue{\??nh\v!block\c!level}{0}
+\setvalue{\??nh\v!none \c!level}{-1}
+\setvalue{\??nh\v!text \c!level}{-2}
% head -> structurehead
@@ -600,13 +606,13 @@
\def\dostructureheadspacingbeforeyes
{\docheckstructureheadbefore
- \dohandlestructureheadpagebreak
+ \dohandlestructureheadpagebreakyes
\structureheadparameter\c!inbetween
\dostarttagged\t!section\currentstructurehead}
\def\dostructureheadspacingbeforenop
{\docheckstructureheadbefore
- \docheckstructureheadlayout
+ \dohandlestructureheadpagebreaknop
\structureheadparameter\c!inbetween
\dostarttagged\currentstructurehead\empty}
@@ -675,7 +681,16 @@
\def\currentstructurecounter {\ctxlua{structures.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead)}}
\def\previousstructurecounter{\ctxlua{structures.sections.depthnumber(\thenamedstructureheadlevel\currentstructurehead-1)}}
-\def\dohandlestructureheadpagebreak
+\def\dohandlestructureheadpagebreaknop
+ {\doifelse{\structureheadparameter\c!continue}\v!yes
+ {\ifnum\previousstructurecounter=\zerocount
+ \docheckstructureheadlayout
+ \else\ifnum\currentstructurecounter>\zerocount
+ \docheckstructureheadlayout
+ \fi\fi}%
+ {\docheckstructureheadlayout}}
+
+\def\dohandlestructureheadpagebreakyes
{%[[\currentstructurehead @\thenamedstructureheadlevel\currentstructurehead/prev:\previousstructurecounter/curr:\currentstructurecounter]]
\ifconditional\ignorehandlepagebreak
\setfalse\ignorehandlepagebreak
diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua
index 0f1af0c5a..5af225bf5 100644
--- a/tex/context/base/task-ini.lua
+++ b/tex/context/base/task-ini.lua
@@ -53,6 +53,7 @@ tasks.appendaction("shipouts", "finishers", "attributes.effects.handler")
tasks.appendaction("shipouts", "finishers", "attributes.viewerlayers.handler") -- disabled
tasks.appendaction("math", "normalizers", "noads.handlers.relocate", nil, "nohead") -- always on
+tasks.appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nohead") -- always on
tasks.appendaction("math", "normalizers", "noads.handlers.resize", nil, "nohead") -- always on
tasks.appendaction("math", "normalizers", "noads.handlers.respace", nil, "nohead") -- always on
tasks.appendaction("math", "normalizers", "noads.handlers.check", nil, "nohead") -- always on
diff --git a/tex/context/base/x-res-50.tex b/tex/context/base/x-res-50.tex
index 382256fd4..6fa1a3e4f 100644
--- a/tex/context/base/x-res-50.tex
+++ b/tex/context/base/x-res-50.tex
@@ -45,6 +45,8 @@
% output=pdftex
+% \nopdfcompression
+
% bugs in recognizing embedded stream cq. player
% bugs in layers + hide/vide
% bugs in save javascripts
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 085572e45..f2fc970f7 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/06/10 10:20:42
+-- merge date : 10/10/10 14:25:57
do -- begin closure to overcome local limits and interference
@@ -719,7 +719,12 @@ function table.keys(t)
end
local function compare(a,b)
- return (tostring(a) < tostring(b))
+ local ta, tb = type(a), type(b) -- needed, else 11 < 2
+ if ta == tb then
+ return a < b
+ else
+ return tostring(a) < tostring(b)
+ end
end
local function sortedkeys(tab)
@@ -731,12 +736,10 @@ local function sortedkeys(tab)
else
local tkey = type(key)
if tkey == "string" then
- -- if kind == 2 then kind = 3 else kind = 1 end
kind = (kind == 2 and 3) or 1
elseif tkey == "number" then
- -- if kind == 1 then kind = 3 else kind = 2 end
kind = (kind == 1 and 3) or 2
- else -- if tkey then
+ else
kind = 3
end
end
@@ -2757,7 +2760,7 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,index) --ba=baseancho
set_attribute(base,markbase,bound)
set_attribute(start,markmark,bound)
set_attribute(start,markdone,index)
- marks[bound] = { [index] = { dx, dy } }
+ marks[bound] = { [index] = { dx, dy, rlmode } }
return dx, dy, bound
end
@@ -2954,17 +2957,23 @@ function injections.handler(head,where,keep)
local index = has_attribute(n,markdone) or 1
local d = mrks[index]
if d then
- -- local rlmode = d[3] -- not used
- -- if rlmode and rlmode > 0 then
- -- todo
- -- else
+ local rlmode = d[3]
+ if rlmode and rlmode > 0 then
+ -- new per 2010-10-06
+ local k = wx[p]
+ if k then -- maybe (d[1] - p.width) and/or + k[2]
+ n.xoffset = p.xoffset - (p.width - d[1]) - k[2]
+ else
+ n.xoffset = p.xoffset - (p.width - d[1])
+ end
+ else
local k = wx[p]
if k then
n.xoffset = p.xoffset - d[1] - k[2]
else
n.xoffset = p.xoffset - d[1]
end
- -- end
+ end
if mk[p] then
n.yoffset = p.yoffset + d[2]
else