summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/char-ini.lua10
-rw-r--r--tex/context/base/lpdf-wid.lua114
-rw-r--r--tex/context/base/sort-lan.lua3
3 files changed, 86 insertions, 41 deletions
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index 369b4f2d2..a6b033b08 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -434,9 +434,9 @@ if texsetcatcode then
end
if tobelettered then -- shared
- -- local saved = tex.catcodetable
- -- for i=1,#tobelettered do
- -- tex.catcodetable = tobelettered[i]
+ local saved = tex.catcodetable
+ for i=1,#tobelettered do
+ tex.catcodetable = tobelettered[i]
if trace_defining then
report_defining("defining letters (global, shared)")
end
@@ -452,8 +452,8 @@ if texsetcatcode then
end
texsetcatcode(0x200C,11) -- non-joiner
texsetcatcode(0x200D,11) -- joiner
- -- end
- -- tex.catcodetable = saved
+ end
+ tex.catcodetable = saved
end
local nofactivated = #tobeactivated
diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua
index e45e9727c..a948fcedc 100644
--- a/tex/context/base/lpdf-wid.lua
+++ b/tex/context/base/lpdf-wid.lua
@@ -30,6 +30,7 @@ local pdfstring = lpdf.string
local pdfcolorspec = lpdf.colorspec
local pdfflushobject = lpdf.flushobject
local pdfreserveannotation = lpdf.reserveannotation
+local pdfreserveobject = lpdf.reserveobject
local pdfimmediateobject = lpdf.immediateobject
local pdfpagereference = lpdf.pagereference
@@ -254,8 +255,8 @@ end
-- P media play parameters (evt /BE for controls etc
-- A boolean (audio)
-- C boolean (captions)
----O boolean (overdubs)
----S boolean (subtitles)
+-- O boolean (overdubs)
+-- S boolean (subtitles)
-- PL pdfconstant("ADBE_MCI"),
-- F = flags,
@@ -274,7 +275,8 @@ local function delayed(label)
return pdfreference(a)
end
-local function insertrenderingwindow(label,width,height,specification)
+local function insertrenderingwindow(specification)
+ local label = specification.label
--~ local openpage = specification.openpage
--~ local closepage = specification.closepage
if specification.options == variables.auto then
@@ -293,62 +295,104 @@ local function insertrenderingwindow(label,width,height,specification)
}
end
local page = tonumber(specification.page) or texcount.realpageno -- todo
+ local r = mu[label] or pdfreserveannotation() -- why the reserve here?
+ local a = pdfdictionary {
+ S = pdfconstant("Rendition"),
+ R = mf[label],
+ OP = 0,
+ AN = pdfreference(r),
+ }
local d = pdfdictionary {
Subtype = pdfconstant("Screen"),
P = pdfreference(pdfpagereference(page)),
- A = mf[label],
+ A = a, -- needed in order to make the annotation clickable (i.e. don't bark)
Border = pdf_border,
AA = actions,
}
- local r = mu[label] or pdfreserveannotation()
- write_node(pdfannotation_node(width,height,0,d(),r)) -- save ref
+ write_node(pdfannotation_node(specification.width or 0,specification.height or 0,0,d(),r)) -- save ref
return pdfreference(r)
end
+-- some dictionaries can have a MH (must honor) or BE (best effort) capsule
+
local function insertrendering(specification)
local label = specification.label
if not mf[label] then
local filename = specification.filename
local isurl = find(filename,"://")
- local d = pdfdictionary {
+ --~ local start = pdfdictionary {
+ --~ Type = pdfconstant("MediaOffset"),
+ --~ S = pdfconstant("T"), -- time
+ --~ T = pdfdictionary { -- time
+ --~ Type = pdfconstant("Timespan"),
+ --~ S = pdfconstant("S"),
+ --~ V = 3, -- time in seconds
+ --~ },
+ --~ }
+ --~ local start = pdfdictionary {
+ --~ Type = pdfconstant("MediaOffset"),
+ --~ S = pdfconstant("F"), -- frame
+ --~ F = 100 -- framenumber
+ --~ }
+ --~ local start = pdfdictionary {
+ --~ Type = pdfconstant("MediaOffset"),
+ --~ S = pdfconstant("M"), -- mark
+ --~ M = "somemark",
+ --~ }
+ --~ local parameters = pdfdictionary {
+ --~ BE = pdfdictionary {
+ --~ B = start,
+ --~ }
+ --~ }
+ --~ local parameters = pdfdictionary {
+ --~ Type = pdfconstant(MediaPermissions),
+ --~ TF = pdfstring("TEMPALWAYS") }, -- TEMPNEVER TEMPEXTRACT TEMPACCESS TEMPALWAYS
+ --~ }
+ local descriptor = pdfdictionary {
+ Type = pdfconstant("Filespec"),
+ F = filename,
+ }
+ if isurl then
+ descriptor.FS = pdfconstant("URL")
+ elseif specification.embed then
+ descriptor.EF = codeinjections.embedfile(filename)
+ end
+ local clip = pdfdictionary {
+ Type = pdfconstant("MediaClip"),
+ S = pdfconstant("MCD"),
+ N = label,
+ CT = specification.mime,
+ Alt = pdfarray { "", "file not found" }, -- language id + message
+ D = pdfreference(pdfflushobject(descriptor)),
+ -- P = pdfreference(pdfflushobject(parameters)),
+ }
+ local rendition = pdfdictionary {
Type = pdfconstant("Rendition"),
- S = pdfconstant("MR"), -- or SR for selector
- N = label, -- here too?
- C = pdfdictionary {
- Type = pdfconstant("MediaClip"),
- S = pdfconstant("MCD"),
- N = label,
- -- 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
- },
- D = pdfdictionary {
- Type = pdfconstant("Filespec"),
- F = filename,
- FS = (isurl and pdfconstant("URL")) or nil,
- }
- }
+ S = pdfconstant("MR"),
+ N = label,
+ C = pdfreference(pdfflushobject(clip)),
}
- mf[label] = pdfreference(pdfflushobject(d))
+ mf[label] = pdfreference(pdfflushobject(rendition))
end
end
-local function insertrenderingobject(specification)
+local function insertrenderingobject(specification) -- todo
local label = specification.label
if not mf[label] then
report_media("todo: unknown medium '%s'",label or "?")
- local d = pdfdictionary {
+ local clip = pdfdictionary { -- does not work that well one level up
+ Type = pdfconstant("MediaClip"),
+ S = pdfconstant("MCD"),
+ N = label,
+ D = pdfreference(unknown), -- not label but objectname, hm .. todo?
+ }
+ local rendition = pdfdictionary {
Type = pdfconstant("Rendition"),
S = pdfconstant("MR"),
- C = pdfdictionary {
- Type = pdfconstant("MediaClip"),
- S = pdfconstant("MCD"),
- N = label,
- D = pdfreference(unknown), -- not label but objectname, hm .. todo?
- }
+ N = label,
+ C = pdfreference(pdfflushobject(clip)),
}
- mf[label] = pdfreference(pdfflushobject(d))
+ mf[label] = pdfreference(pdfflushobject(rendition))
end
end
@@ -366,7 +410,7 @@ end
function codeinjections.insertrenderingwindow(specification)
local label = specification.label
codeinjections.processrendering(label)
- ms[label] = insertrenderingwindow(label,specification.width,specification.height,specification)
+ ms[label] = insertrenderingwindow(specification)
end
local function set(operation,arguments)
diff --git a/tex/context/base/sort-lan.lua b/tex/context/base/sort-lan.lua
index 338ba747b..8137bac13 100644
--- a/tex/context/base/sort-lan.lua
+++ b/tex/context/base/sort-lan.lua
@@ -14,9 +14,10 @@ local utfchar = utf.char
local sorters = sorters
local definitions = sorters.definitions
local replacementoffset = sorters.constants.replacementoffset
+local variables = interfaces.variables
definitions["default"] = {
- method = "before",
+ method = variables.before,
replacements = {
-- no replacements
},