summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/grph-inc.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-13 16:15:06 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-13 16:15:06 +0100
commiteb827e1f7e0b7c69fb4f5ac106be63e346f06de5 (patch)
tree6096ea095185477f83f4c53aefe7fc471c68a7bf /tex/context/base/mkiv/grph-inc.lua
parentc813b4d16dd51bd181736729517ad422980e3fc6 (diff)
downloadcontext-eb827e1f7e0b7c69fb4f5ac106be63e346f06de5.tar.gz
2016-01-13 15:12:00
Diffstat (limited to 'tex/context/base/mkiv/grph-inc.lua')
-rw-r--r--tex/context/base/mkiv/grph-inc.lua26
1 files changed, 22 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index 03557e370..af74efbfa 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -132,7 +132,7 @@ function images.check(figure)
report_inclusion("limiting natural dimensions of %a, old %p * %p, new %p * %p",
figure.filename,width,height,figure.width,figure.height)
end
- if width >=maxdimen or height >= maxdimen then
+ if width >= maxdimen or height >= maxdimen then
report_inclusion("image %a is too large (%p,%p), discarding",
figure.filename,width,height)
return false, "dimensions too large"
@@ -582,7 +582,23 @@ local function get(category,tag,default)
end
end
+local function setdimensions(box)
+ local status = lastfiguredata and lastfiguredata.status
+ local used = lastfiguredata and lastfiguredata.used
+ if status and used then
+ local b = texgetbox(box)
+ local w = b.width
+ local h = b.height + b.depth
+ status.width = w
+ status.height = h
+ used.width = w
+ used.height = h
+ status.status = 10
+ end
+end
+
figures.get = get
+figures.set = setdimensions
implement { name = "figurestatus", actions = { get, context }, arguments = { "'status'", "string", "string" } }
implement { name = "figurerequest", actions = { get, context }, arguments = { "'request'", "string", "string" } }
@@ -592,6 +608,8 @@ implement { name = "figurefilepath", actions = { get, file.dirname, context },
implement { name = "figurefilename", actions = { get, file.nameonly, context }, arguments = { "'used'", "'fullname'" } }
implement { name = "figurefiletype", actions = { get, file.extname, context }, arguments = { "'used'", "'fullname'" } }
+implement { name = "figuresetdimensions", actions = setdimensions, arguments = { "integer" } }
+
-- todo: local path or cache path
local function forbiddenname(filename)
@@ -1345,13 +1363,13 @@ local function checkers_nongeneric(data,command) -- todo: macros and context.*
local hash = name
if dr.object then
-- hm, bugged ... waiting for an xform interface
- if not job.objects.get("FIG::"..hash) then
+ if not objects.data["FIG"][hash] then
if type(command) == "function" then
command()
end
- context.dosetfigureobject(hash)
+ context.dosetfigureobject("FIG",hash)
end
- context.doboxfigureobject(hash)
+ context.doboxfigureobject("FIG",hash)
elseif type(command) == "function" then
command()
end