From feeb3d0be42786dc4e4458e0a95741134bc877fb Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 10 May 2011 20:40:17 +0300 Subject: beta 2011.05.10 19:20 --- tex/context/base/back-pdf.lua | 33 +++++++++++++++- tex/context/base/back-u3d.mkiv | 25 ++++++------ tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/lpdf-ini.lua | 4 +- tex/context/base/lpdf-swf.lua | 59 ++++++---------------------- tex/context/base/lpdf-u3d.lua | 4 ++ tex/context/base/status-files.pdf | Bin 23551 -> 23537 bytes tex/context/base/status-lua.pdf | Bin 154316 -> 154323 bytes tex/generic/context/luatex-fonts-merged.lua | 2 +- 12 files changed, 70 insertions(+), 65 deletions(-) diff --git a/tex/context/base/back-pdf.lua b/tex/context/base/back-pdf.lua index 294a7b05c..325888785 100644 --- a/tex/context/base/back-pdf.lua +++ b/tex/context/base/back-pdf.lua @@ -482,7 +482,7 @@ function codeinjections.setfigurealternative(data,figure) end end -function codeinjections.getdisplayfigure(request) +function codeinjections.getpreviewfigure(request) local figure = figures.initialize(request) if not figure then return @@ -541,4 +541,35 @@ function codeinjections.getoutputfilename() return outputfilename end +-- temp hack + +local factor = number.dimenfactors.bp + +function img.package(image) + local boundingbox = image.bbox + local imagetag = "Im" .. image.index + local resources = pdfdictionary { + ProcSet = pdfarray { + pdfconstant("PDF"), + pdfconstant("ImageC") + }, + Resources = pdfdictionary { + XObject = pdfdictionary { + [imagetag] = pdfreference(image.objnum) + } + } + } + local width = boundingbox[3] + local height = boundingbox[4] + local xform = img.scan { + attr = resources(), + stream = format("%s 0 0 %s 0 0 cm /%s Do",width,height,imagetag), + bbox = { 0, 0, width/factor, height/factor }, + } + img.immediatewrite(xform) + return xform +end + +-- till here + backends.install("pdf") diff --git a/tex/context/base/back-u3d.mkiv b/tex/context/base/back-u3d.mkiv index 398159feb..e26094496 100644 --- a/tex/context/base/back-u3d.mkiv +++ b/tex/context/base/back-u3d.mkiv @@ -124,28 +124,31 @@ toolbar = true, preview = 'cloudq.png' \stopluaparameterset + \startluaparameterset[u3d:myset:display:3] toolbar = true, - tree = false, + tree = false, preview = 'area.png' \stopluaparameterset + \startluaparameterset[u3d:myset:display:4] toolbar = true, - tree = false, - view = { - name = 'view', - bg = {0.1,0.1,0.1}, - c2c = {-1,-1,0}, - roo = 50, - aac = 2.5, - roll = 45, + tree = false, + view = { + name = 'view', + bg = {0.1,0.1,0.1}, + c2c = {-1,-1,0}, + roo = 50, + aac = 2.5, + roll = 45, lights = 'Red' } \stopluaparameterset + \startluaparameterset[u3d:myset:display:5] toolbar = true, - tree = false, - view = 'ortho' + tree = false, + view = 'ortho' \stopluaparameterset \placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]} diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 1722e31d7..dabf23b77 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{2011.05.10 18:34} +\newcontextversion{2011.05.10 19:20} %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 8ace480f0..f18429a55 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{2011.05.10 18:34} +\newcontextversion{2011.05.10 19:20} %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.mkii b/tex/context/base/context.mkii index 393b1f555..5c71cd25b 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{2011.05.10 18:34} +\edef\contextversion{2011.05.10 19:20} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index b45400857..4e616920d 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.05.10 18:34} +\edef\contextversion{2011.05.10 19:20} %D For those who want to use this: diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 8b86ae921..74ecb36de 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -711,9 +711,9 @@ function lpdf.checkedkey(t,key,variant) local tn = type(pn) if tn == variant then if variant == "string" then - return pn ~= "" and pn + return pn ~= "" and pn or nil elseif variant == "table" then - return next(pn) and pn + return next(pn) and pn or nil else return pn end diff --git a/tex/context/base/lpdf-swf.lua b/tex/context/base/lpdf-swf.lua index ef1855526..04825446c 100644 --- a/tex/context/base/lpdf-swf.lua +++ b/tex/context/base/lpdf-swf.lua @@ -23,7 +23,7 @@ local pdfnull = lpdf.null local pdfreference = lpdf.reference local pdfimmediateobject = lpdf.immediateobject -local variables = interfaces.variables +local checkedkey = lpdf.checkedkey local codeinjections = backends.pdf.codeinjections local nodeinjections = backends.pdf.nodeinjections @@ -45,34 +45,6 @@ local deactivations = { table.setmetatableindex(activations, function() return activations .click end) table.setmetatableindex(deactivations,function() return deactivations.focus end) -local factor = number.dimenfactors.bp - -function img.package(image) - local boundingbox = image.bbox - local imagetag = "Im" .. image.index - local resources = pdfdictionary { - ProcSet = pdfarray { - pdfconstant("PDF"), - pdfconstant("ImageC") - }, - Resources = pdfdictionary { - XObject = pdfdictionary { - [imagetag] = pdfreference(image.objnum) - } - } - } - local width = boundingbox[3] - local height = boundingbox[4] - local xform = img.scan { - attr = resources(), - stream = format("%s 0 0 %s 0 0 cm /%s Do",width,height,imagetag), - bbox = { 0, 0, width/factor, height/factor }, - } - img.immediatewrite(xform) - return xform -end - - local function insertswf(spec) local width = spec.width @@ -83,15 +55,11 @@ local function insertswf(spec) local controls = spec.controls local resources = resources and parametersets[resources] + local display = display and parametersets[display] + local controls = controls and parametersets[controls] -- not yet used - if display == nil or display == "" then - display = resources.display - end - if controls == nil or controls == "" then - controls = resources.controls - end - - controls = toboolean(variables[controls] or controls,true) + local preview = checkedkey(display,"preview","string") + local toolbar = checkedkey(display,"toolbar","boolean") local embeddedreference = codeinjections.embedfile { file = filename } @@ -148,7 +116,7 @@ local function insertswf(spec) local activation = pdfdictionary { Type = pdfconstant("RichMediaActivation"), - Condition = pdfconstant(activations[resources.open]), + Condition = pdfconstant(activations[display.open]), Configuration = flashreference, Animation = pdfdictionary { Subtype = pdfconstant("Linear"), @@ -158,7 +126,7 @@ local function insertswf(spec) Presentation = pdfdictionary { PassContextClick = false, Style = pdfconstant("Embedded"), - Toolbar = controls or false, + Toolbar = toolbar, NavigationPane = false, Transparent = true, Window = pdfdictionary { @@ -188,7 +156,7 @@ local function insertswf(spec) local deactivation = pdfdictionary { Type = pdfconstant("RichMediaDeactivation"), - Condition = pdfconstant(deactivations[resources.close]), + Condition = pdfconstant(deactivations[display.close]), } local richmediasettings = pdfdictionary { @@ -201,12 +169,11 @@ local function insertswf(spec) local appearance - if display and display ~= "" then - local figure = codeinjections.getdisplayfigure { name = display, width = width, height = height } + if preview then + local figure = codeinjections.getpreviewfigure { name = preview, width = width, height = height } if figure then local image = img.package(figure.status.private) - local reference = image.objnum - appearance = reference and pdfdictionary { N = pdfreference(reference) } or nil + appearance = pdfdictionary { N = pdfreference(image.objnum) } end end @@ -226,11 +193,11 @@ function backends.pdf.nodeinjections.insertswf(spec) foundname = spec.foundname, width = spec.width, height = spec.height, - -- factor = spec.factor, display = spec.display, controls = spec.controls, - -- label = spec.label, resources = spec.resources, + -- factor = spec.factor, + -- label = spec.label, } node.write(pdfannotation_node(spec.width,spec.height,0,annotation())) end diff --git a/tex/context/base/lpdf-u3d.lua b/tex/context/base/lpdf-u3d.lua index 60df2e2ab..f5a2bc2fa 100644 --- a/tex/context/base/lpdf-u3d.lua +++ b/tex/context/base/lpdf-u3d.lua @@ -13,6 +13,10 @@ if not modules then modules = { } end modules ['lpdf-u3d'] = { -- an overhaul. There are some messy leftovers that will be -- removed in future versions. +-- For some reason no one really tested this code so at some +-- point we will end up with a reimplementation. For instance +-- it makes sense to add the same activation code as with swf. + local format, find = string.format, string.find local cos, sin, sqrt, pi, atan2, abs = math.cos, math.sin, math.sqrt, math.pi, math.atan2, math.abs diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 575e68449..944fbabf4 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 236ec43d3..0b6881929 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 22a56ec40..224ca24c7 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 : 05/10/11 18:34:20 +-- merge date : 05/10/11 19:20:23 do -- begin closure to overcome local limits and interference -- cgit v1.2.3