summaryrefslogtreecommitdiff
path: root/tex/context/base/grph-swf.lua
blob: deff3defa85ff93e2ddfd4ba4db6b62de614ca1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if not modules then modules = { } end modules ['grph-swf'] = {
    version   = 1.001,
    comment   = "companion to grph-inc.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

local format = string.format

local texsprint      = tex.sprint
local ctxcatcodes    = tex.ctxcatcodes
local nodeinjections = backends.nodeinjections

local figures = figures

function figures.checkers.swf(data)
    local dr, du, ds = data.request, data.used, data.status
    local width = (dr.width or figures.defaultwidth):todimen()
    local height = (dr.height or figures.defaultheight):todimen()
    local foundname = du.fullname
    dr.width, dr.height = width, height
    du.width, du.height, du.foundname = width, height, foundname
    texsprint(ctxcatcodes,format("\\startfoundexternalfigure{%ssp}{%ssp}",width,height))
    nodeinjections.insertswf {
        foundname = foundname,
        width     = width,
        height    = height,
    --  factor    = number.dimenfactors.bp,
    --  display   = dr.display,
    --  controls  = dr.controls,
    --  label     = dr.label,
    }
    texsprint(ctxcatcodes,"\\stopfoundexternalfigure")
    return data
end

figures.includers.swf = figures.includers.nongeneric

figures.registersuffix("swf","swf")