diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-02-06 20:42:35 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-02-06 20:42:35 +0100 |
commit | 1687077b0a63417ad4dce58f6c869a6e115d9b72 (patch) | |
tree | ec1d4ac5ea55b732c13c12c0c0e67739afa93ef8 /tex/context/base/mkiv/lpdf-wid.lua | |
parent | 7ce2f30f31421eb46d07ff65cbf9fcbda1d6612a (diff) | |
download | context-1687077b0a63417ad4dce58f6c869a6e115d9b72.tar.gz |
2018-02-06 18:19:00
Diffstat (limited to 'tex/context/base/mkiv/lpdf-wid.lua')
-rw-r--r-- | tex/context/base/mkiv/lpdf-wid.lua | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index d04af20f2..03febbf01 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -25,7 +25,7 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { -- html5 media in pdf then. local tonumber, next = tonumber, next -local gmatch, gsub, find, lower, format = string.gmatch, string.gsub, string.find, string.lower, string.format +local gmatch, gsub, find, lower = string.gmatch, string.gsub, string.find, string.lower local stripstring = string.strip local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash @@ -156,8 +156,8 @@ comment_symbols.Default = Note local function analyzesymbol(symbol,collection) if not symbol or symbol == "" then - return collection.Default, nil - elseif collection[symbol] then + return collection and collection.Default, nil + elseif collection and collection[symbol] then return collection[symbol], nil else local setn, setr, setd @@ -179,6 +179,17 @@ local function analyzesymbol(symbol,collection) end end +local function analyzenormalsymbol(symbol) + local appearance = pdfdictionary { + N = registeredsymbol(symbol), + } + local appearanceref = pdfshareobjectreference(appearance) + return appearanceref +end + +codeinjections.analyzesymbol = analyzesymbol +codeinjections.analyzenormalsymbol = analyzenormalsymbol + local function analyzelayer(layer) -- todo: (specification.layer ~= "" and pdfreference(specification.layer)) or nil, -- todo: ref to layer end @@ -383,7 +394,7 @@ function nodeinjections.attachfile(specification) FS = aref, Contents = pdfunicode(title), Name = name, - NM = pdfstring(format("attachment:%s",nofattachments)), + NM = pdfstring("attachment:"..nofattachments), T = author ~= "" and pdfunicode(author) or nil, Subj = subtitle ~= "" and pdfunicode(subtitle) or nil, C = analyzecolor(specification.colorvalue,specification.colormodel), @@ -391,9 +402,13 @@ function nodeinjections.attachfile(specification) AP = appearance, OC = analyzelayer(specification.layer), } - local width, height, depth = specification.width or 0, specification.height or 0, specification.depth - local box = hpack_node(nodeinjections.annotation(width,height,depth,d())) - box.width, box.height, box.depth = width, height, depth + local width = specification.width or 0 + local height = specification.height or 0 + local depth = specification.depth or 0 + local box = hpack_node(nodeinjections.annotation(width,height,depth,d())) + box.width = width + box.height = height + box.depth = depth return box end end @@ -472,10 +487,12 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice CA = analyzetransparency(specification.transparencyvalue), OC = analyzelayer(specification.layer), Name = name, - NM = pdfstring(format("comment:%s",nofcomments)), + NM = pdfstring("comment:"..nofcomments), AP = appearance, } - local width, height, depth = specification.width or 0, specification.height or 0, specification.depth + local width = specification.width or 0 + local height = specification.height or 0 + local depth = specification.depth or 0 local box if usepopupcomments then -- rather useless as we can hide/vide @@ -493,7 +510,9 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice else box = hpack_node(nodeinjections.annotation(width,height,depth,d())) end - box.width, box.height, box.depth = width, height, depth -- redundant + box.width = width -- redundant + box.height = height -- redundant + box.depth = depth -- redundant return box end |