diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-10-08 20:46:55 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-10-08 20:46:55 +0200 |
commit | 778f381ba6a448ab00d67994a412dd4226d43238 (patch) | |
tree | d9dade45016a572e6c22521bfb165f9829ac3192 /scripts | |
parent | 2073fe5d88215dddd9a9e6421afaea7ab7db955a (diff) | |
download | context-778f381ba6a448ab00d67994a412dd4226d43238.tar.gz |
2021-10-08 20:07:00
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-context.lua | 12 | ||||
-rw-r--r-- | scripts/context/lua/mtx-fonts.lua | 4 | ||||
-rw-r--r-- | scripts/context/lua/mtx-pdf.lua | 25 |
3 files changed, 33 insertions, 8 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index d2e63640a..5a67f4f2a 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -111,8 +111,10 @@ local engine_new = filenameonly(getargument("engine") or directives.value("syste local engine_old = filenameonly(environment.ownmain) or filenameonly(environment.ownbin) local function restart(engine_old,engine_new) - local ownname = filejoinname(filepathpart(environment.ownname),"mtxrun.lua") - local command = format("%s --luaonly %q %s --redirected",engine_new,ownname,environment.reconstructcommandline()) + local generate = environment.arguments.generate and (engine_new == "luatex" or engine_new == "luajittex") + local arguments = generate and "--generate" or environment.reconstructcommandline() + local ownname = filejoinname(filepathpart(environment.ownname),"mtxrun.lua") + local command = format("%s --luaonly %q %s --redirected",engine_new,ownname,arguments) report(format("redirect %s -> %s: %s",engine_old,engine_new,command)) local result = os.execute(command) os.exit(result == 0 and 0 or 1) @@ -1720,6 +1722,12 @@ end -- getting it done +if getargument("pdftex") then + setargument("engine","pdftex") +elseif getargument("xetex") then + setargument("engine","xetex") +end + if getargument("timedlog") then logs.settimedlog() end diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index feefdeada..bf37b069a 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -295,7 +295,7 @@ local function showfeatures(tag,specification) else done = true end - report(" % -8s % -8s % -8s",f,s,concat(table.sortedkeys(ss), " ")) -- todo: padd 4 + report(" %-8s %-8s %-8s",f,s,concat(table.sortedkeys(ss), " ")) -- todo: padd 4 end end end @@ -317,7 +317,7 @@ local function showfeatures(tag,specification) report(" method feature formats") report() for k, v in table.sortedhash(methods) do - report(" % -8s % -14s %s",k,v.feature,v.format) + report(" %-8s %-14s %s",k,v.feature,v.format) end end end diff --git a/scripts/context/lua/mtx-pdf.lua b/scripts/context/lua/mtx-pdf.lua index fbb1a3995..201d73623 100644 --- a/scripts/context/lua/mtx-pdf.lua +++ b/scripts/context/lua/mtx-pdf.lua @@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['mtx-pdf'] = { } local tonumber = tonumber -local format, gmatch, gsub = string.format, string.gmatch, string.gsub +local format, gmatch, gsub, match, find = string.format, string.gmatch, string.gsub, string.match, string.find local utfchar = utf.char local concat = table.concat local setmetatableindex, sortedhash, sortedkeys = table.setmetatableindex, table.sortedhash, table.sortedkeys @@ -27,11 +27,13 @@ local helpinfo = [[ <flag name="metadata"><short>show metadata xml blob</short></flag> <flag name="pretty"><short>replace newlines in metadata</short></flag> <flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag> + <flag name="object"><short>show object"/></short></flag> </subcategory> <subcategory> <example><command>mtxrun --script pdf --info foo.pdf</command></example> <example><command>mtxrun --script pdf --metadata foo.pdf</command></example> <example><command>mtxrun --script pdf --metadata --pretty foo.pdf</command></example> + <example><command>mtxrun --script pdf --stream=4 foo.pdf</command></example> </subcategory> </category> </flags> @@ -46,10 +48,14 @@ local application = logs.application { local report = application.report -if pdfe then - dofile(resolvers.findfile("lpdf-pde.lua","tex")) -else +if not pdfe then dofile(resolvers.findfile("lpdf-epd.lua","tex")) +elseif CONTEXTLMTXMODE then + dofile(resolvers.findfile("util-dim.lua","tex")) + dofile(resolvers.findfile("lpdf-ini.lmt","tex")) + dofile(resolvers.findfile("lpdf-pde.lmt","tex")) +else + dofile(resolvers.findfile("lpdf-pde.lua","tex")) end scripts = scripts or { } @@ -349,6 +355,15 @@ function scripts.pdf.fonts(filename) end end +function scripts.pdf.object(filename,n) + if n then + local pdffile = loadpdffile(filename) + if pdffile then + print(lpdf.epdf.verboseobject(pdffile,n) or "no object with number " .. n) + end + end +end + -- scripts.pdf.info("e:/tmp/oeps.pdf") -- scripts.pdf.metadata("e:/tmp/oeps.pdf") -- scripts.pdf.fonts("e:/tmp/oeps.pdf") @@ -364,6 +379,8 @@ elseif environment.argument("metadata") then scripts.pdf.metadata(filename,environment.argument("pretty")) elseif environment.argument("fonts") then scripts.pdf.fonts(filename) +elseif environment.argument("object") then + scripts.pdf.object(filename,tonumber(environment.argument("object"))) elseif environment.argument("exporthelp") then application.export(environment.argument("exporthelp"),filename) else |