summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lpdf-fld.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/lpdf-fld.lua')
-rw-r--r--tex/context/base/mkiv/lpdf-fld.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua
index 75d0ba98e..bbafb299b 100644
--- a/tex/context/base/mkiv/lpdf-fld.lua
+++ b/tex/context/base/mkiv/lpdf-fld.lua
@@ -58,9 +58,8 @@ if not modules then modules = { } end modules ['lpdf-fld'] = {
local tostring, next = tostring, next
local gmatch, lower, format, formatters = string.gmatch, string.lower, string.format, string.formatters
local lpegmatch = lpeg.match
-local utfchar = utf.char
local bpfactor, todimen = number.dimenfactors.bp, string.todimen
-
+local sortedhash = table.sortedhash
local trace_fields = false trackers.register("backends.fields", function(v) trace_fields = v end)
local report_fields = logs.reporter("backend","fields")
@@ -88,7 +87,6 @@ local pdfreference = lpdf.reference
local pdfunicode = lpdf.unicode
local pdfstring = lpdf.string
local pdfconstant = lpdf.constant
-local pdftoeight = lpdf.toeight
local pdfflushobject = lpdf.flushobject
local pdfshareobjectreference = lpdf.shareobjectreference
local pdfshareobject = lpdf.shareobject
@@ -249,7 +247,7 @@ local mapping = {
local function fieldactions(specification) -- share actions
local d = nil
- for key, target in next, mapping do
+ for key, target in sortedhash(mapping) do -- sort so that we can compare pdf
local code = specification[key]
if code and code ~= "" then
-- local a = checked(code)
@@ -367,7 +365,8 @@ local function registerfonts()
checkpdfdocencoding() -- already done
local d = pdfdictionary()
local pdffonttype, pdffontsubtype = pdfconstant("Font"), pdfconstant("Type1")
- for tag, name in next, usedfonts do
+ -- for tag, name in next, usedfonts do
+ for tag, name in sortedhash(usedfonts) do
local f = pdfdictionary {
Type = pdffonttype,
Subtype = pdffontsubtype,
@@ -655,7 +654,7 @@ local xfdftemplate = [[
function codeinjections.exportformdata(name)
local result = { }
- for k, v in table.sortedhash(fields) do
+ for k, v in sortedhash(fields) do
result[#result+1] = formatters[" <field name='%s'><value>%s</value></field>"](v.name or k,v.default or "")
end
local base = file.basename(tex.jobname)
@@ -880,7 +879,7 @@ local forceencoding = false
local function finishfields()
local sometext = forceencoding
- for name, field in next, fields do
+ for name, field in sortedhash(fields) do
local kids = field.kids
if kids then
pdfflushobject(field.kidsnum,kids)
@@ -894,7 +893,7 @@ local function finishfields()
sometext = true
end
end
- for name, field in next, radios do
+ for name, field in sortedhash(radios) do
local kids = field.kids
if kids then
pdfflushobject(field.kidsnum,kids)