1if not modules then modules = { } end modules ['grph-u3d'] = {
2 version = 1.001,
3 comment = "companion to grph-inc.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9
10
11
12
13local trace_inclusion = false trackers.register("figures.inclusion", function(v) trace_inclusion = v end)
14
15local report_u3d = logs.reporter("graphics","u3d")
16
17local figures = figures
18local context = context
19local nodeinjections = backends.nodeinjections
20local todimen = string.todimen
21
22function figures.checkers.u3d(data)
23 local dr, du, ds = data.request, data.used, data.status
24 local width = todimen(dr.width or figures.defaultwidth)
25 local height = todimen(dr.height or figures.defaultheight)
26 local foundname = du.fullname
27 dr.width, dr.height = width, height
28 du.width, du.height, du.foundname = width, height, foundname
29 if trace_inclusion then
30 report_u3d("including u3d %a, width %p, height %p",foundname,width,height)
31 end
32 context.startfoundexternalfigure(width .. "sp",height .. "sp")
33 context(function()
34 nodeinjections.insertu3d {
35 foundname = foundname,
36 width = width,
37 height = height,
38 factor = number.dimenfactors.bp,
39 display = dr.display,
40 controls = dr.controls,
41 label = dr.label,
42 }
43 end)
44 context.stopfoundexternalfigure()
45 return data
46end
47
48figures.includers.u3d = figures.includers.nongeneric
49
50
51
52
53figures.registersuffix("u3d","u3d")
54figures.registersuffix("prc","u3d")
55 |