diff options
Diffstat (limited to 'tex/context')
-rw-r--r-- | tex/context/base/back-swf.mkiv | 29 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4093 -> 4094 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 106125 -> 106211 bytes | |||
-rw-r--r-- | tex/context/base/font-otn.lua | 1 | ||||
-rw-r--r-- | tex/context/base/lpdf-grp.lua | 4 | ||||
-rw-r--r-- | tex/context/base/lpdf-swf.lua | 76 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 23890 -> 23880 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 162208 -> 162211 bytes | |||
-rw-r--r-- | tex/context/base/typo-mar.mkiv | 2 |
9 files changed, 93 insertions, 19 deletions
diff --git a/tex/context/base/back-swf.mkiv b/tex/context/base/back-swf.mkiv index 82c95f898..1d225b550 100644 --- a/tex/context/base/back-swf.mkiv +++ b/tex/context/base/back-swf.mkiv @@ -14,6 +14,35 @@ % This is only a placeholder that demonstrates the usage of swf % resources. +%D \starttyping +%D \starttext +%D +%D \enabletrackers[graphics.locating] +%D \enabletrackers[backend.swf] +%D +%D \startluaparameterset [swf:relative:resources] +%D relativepaths = { +%D "assets" +%D } +%D \stopluaparameterset +%D +%D \startluaparameterset[swf:relative:display] +%D toolbar = true, +%D preview = "images/posterframes/*.jpg", -- relative to assets +%D open = "click", +%D close = "focus", +%D \stopluaparameterset +%D +%D \startTEXpage +%D \externalfigure +%D [whatever.swf] +%D [resources=swf:relative:resources, +%D display=swf:relative:display] +%D \stopTEXpage +%D \stoptyping + +\stoptext + \endinput \starttext diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex b9f838973..469fc8aa6 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 2328fe297..579c7b48f 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 1d2b20976..bd1f78c38 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -1112,6 +1112,7 @@ function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,look local choice, index = alternative_glyph(current,alternatives,kind,chainname,chainlookupname,lookupname) current.char = choice if trace_alternatives then + m = m + 1 logprocess("%s: %s of %s, replacing single %s by alternative %s (%s)", cref(kind,chainname,chainlookupname,lookupname),m,n,index,gref(currentchar),gref(choice)) end diff --git a/tex/context/base/lpdf-grp.lua b/tex/context/base/lpdf-grp.lua index 5ea0442b6..bea0b2ee9 100644 --- a/tex/context/base/lpdf-grp.lua +++ b/tex/context/base/lpdf-grp.lua @@ -172,11 +172,11 @@ function codeinjections.getpreviewfigure(request) return end figure = figures.identify(figure) - if not figure then + if not (figure and figure.status and figure.status.fullname) then return end figure = figures.check(figure) - if not figure then + if not (figure and figure.status and figure.status.fullname) then return end local image = figure.status.private diff --git a/tex/context/base/lpdf-swf.lua b/tex/context/base/lpdf-swf.lua index c3e83dc69..4bbec8dbe 100644 --- a/tex/context/base/lpdf-swf.lua +++ b/tex/context/base/lpdf-swf.lua @@ -93,29 +93,41 @@ local function insertswf(spec) -- todo: check op subpath figuur (relatief) + -- filename : ./test.swf (graphic) + -- root : . + -- prefix : ^%./ + -- fullname : ./assets/whatever.xml + -- usedname : assets/whatever.xml + -- filename : assets/whatever.xml + + local root = file.dirname(filename) + local relativepaths = nil + local paths = nil + if resources then local names = configuration.Assets.Names - local root = file.dirname(filename) - local prefix = format("^%s/",root) - local function add(filename,strip) - local filename = gsub(filename,"%./","") - local usedname = strip and gsub(filename,prefix,"") -- always when relative + local prefix = false + if root ~= "" and root ~= "." then + prefix = format("^%s/",string.escapedpattern(root,true)) + end + if prefix and trace_swf then + report_swf("using strip pattern '%s'",prefix) + end + local function add(fullname,strip) + local filename = gsub(fullname,"^%./","") + local usedname = strip and prefix and gsub(filename,prefix,"") or filename local embeddedreference = codeinjections.embedfile { - file = filename, + file = fullname, usedname = usedname, keepdir = true, } names[#names+1] = pdfstring(filename) names[#names+1] = embeddedreference if trace_swf then - if usedname == filename then - report_swf("embedding file '%s'",filename) - else - report_swf("embedding file '%s' as '%s'",filename,usedname) - end + report_swf("embedding file '%s' as '%s'",fullname,usedname) end end - local relativepaths = resources.relativepaths + relativepaths = resources.relativepaths if relativepaths then if trace_swf then report_swf("checking %s relative paths",#relativepaths) @@ -125,17 +137,17 @@ local function insertswf(spec) if trace_swf then report_swf("checking path '%s' relative to '%s'",relativepath,root) end - local path = file.join(root,relativepath) + local path = file.join(root == "" and "." or root,relativepath) local files = dir.glob(path .. "/**") for i=1,#files do add(files[i],true) end end end - local paths = resources.paths + paths = resources.paths if paths then if trace_swf then - report_swf("checking %s paths",#paths) + report_swf("checking absolute %s paths",#paths) end for i=1,#paths do local path = paths[i] @@ -160,7 +172,7 @@ local function insertswf(spec) local files = resources.files if files then if trace_swf then - report_swf("checking %s files",#files) + report_swf("checking absolute %s files",#files) end for i=1,#files do add(files[i],false) @@ -229,10 +241,42 @@ local function insertswf(spec) local appearance if preview then + preview = gsub(preview,"%*",file.nameonly(filename)) local figure = codeinjections.getpreviewfigure { name = preview, width = width, height = height } + if relativepaths and not figure then + for i=1,#relativepaths do + local path = file.join(root == "" and "." or root,relativepaths[i]) + if trace_swf then + report_swf("checking preview on relative path %s",path) + end + local p = file.join(path,preview) + figure = codeinjections.getpreviewfigure { name = p, width = width, height = height } + if figure then + preview = p + break + end + end + end + if paths and not figure then + for i=1,#paths do + local path = paths[i] + if trace_swf then + report_swf("checking preview on absolute path %s",path) + end + local p = file.join(path,preview) + figure = codeinjections.getpreviewfigure { name = p, width = width, height = height } + if figure then + preview = p + break + end + end + end if figure then local image = img.package(figure.status.private) appearance = pdfdictionary { N = pdfreference(image.objnum) } + if trace_swf then + report_swf("using preview %s",preview) + end end end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 6f26315ab..6f9d48ae4 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 71187c33d..efb9e501a 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv index 6e3a8f157..269ab83a1 100644 --- a/tex/context/base/typo-mar.mkiv +++ b/tex/context/base/typo-mar.mkiv @@ -165,7 +165,7 @@ \edef\currentmargindatastrut{\margindataparameter\c!strut}% \the\everymargindatacontent \dostarttagged\t!margintext\currentmargindata - \ifcsname\currentmargindatahash\s!parent\endcsname + \ifcsname\currentmarginframedhash\s!parent\endcsname \setbox\nextbox\hbox\bgroup \the\everymargindatacontent \dosetmargindataattributes\c!style\c!color |