summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-dim.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/util-dim.lua')
-rw-r--r--tex/context/base/mkiv/util-dim.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/util-dim.lua b/tex/context/base/mkiv/util-dim.lua
index fd9351a28..76b5fd20b 100644
--- a/tex/context/base/mkiv/util-dim.lua
+++ b/tex/context/base/mkiv/util-dim.lua
@@ -397,18 +397,22 @@ function dimen(a)
end
function string.todimen(str) -- maybe use tex.sp when available
- if type(str) == "number" then
+ local t = type(str)
+ if t == "number" then
return str
else
local k = known[str]
if not k then
- local value, unit = lpegmatch(dimenpair,str)
- if value and unit then
- k = value/unit -- to be considered: round
+ if t == "string" then
+ local value, unit = lpegmatch(dimenpair,str)
+ if value and unit then
+ k = value/unit -- to be considered: round
+ else
+ k = 0
+ end
else
k = 0
end
- -- print(str,value,unit)
known[str] = k
end
return k