summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-26 17:00:36 +0300
committerMarius <mariausol@gmail.com>2013-04-26 17:00:36 +0300
commitb2d6e3f2d74984616ec498cf03500f608eea37aa (patch)
tree19007447133cd09b282b0e720b72d8addc0fd474
parent975b65fc1939187bb6493a47da5cfabb77d70a3e (diff)
downloadcontext-b2d6e3f2d74984616ec498cf03500f608eea37aa.tar.gz
beta 2013.04.26 15:13
-rw-r--r--doc/context/scripts/mkiv/mtx-pdf.html1
-rw-r--r--doc/context/scripts/mkiv/mtx-pdf.man3
-rw-r--r--doc/context/scripts/mkiv/mtx-pdf.xml1
-rw-r--r--metapost/context/base/mp-core.mpii29
-rw-r--r--metapost/context/base/mp-core.mpiv3
-rw-r--r--scripts/context/lua/mtx-pdf.lua46
-rw-r--r--scripts/context/lua/mtxrun.lua16
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua16
-rw-r--r--scripts/context/stubs/unix/mtxrun16
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4136 -> 4134 bytes
-rw-r--r--tex/context/base/context-version.pngbin40499 -> 40309 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/node-inj.lua9
-rw-r--r--tex/context/base/status-files.pdfbin24726 -> 24733 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin211579 -> 211433 bytes
-rw-r--r--tex/context/base/util-lib.lua12
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua7
18 files changed, 114 insertions, 49 deletions
diff --git a/doc/context/scripts/mkiv/mtx-pdf.html b/doc/context/scripts/mkiv/mtx-pdf.html
index be923581f..ddb4929d6 100644
--- a/doc/context/scripts/mkiv/mtx-pdf.html
+++ b/doc/context/scripts/mkiv/mtx-pdf.html
@@ -36,6 +36,7 @@
<tr><th>--info</th><td></td><td>show some info about the given file</td></tr>
<tr><th>--metadata</th><td></td><td>show metadata xml blob</td></tr>
<tr><th>--fonts</th><td></td><td>show used fonts (--detail)</td></tr>
+ <tr><th>--linearize</th><td></td><td>linearize given file</td></tr>
</table>
<br/>
</div>
diff --git a/doc/context/scripts/mkiv/mtx-pdf.man b/doc/context/scripts/mkiv/mtx-pdf.man
index 7ac50df0d..4967e93c7 100644
--- a/doc/context/scripts/mkiv/mtx-pdf.man
+++ b/doc/context/scripts/mkiv/mtx-pdf.man
@@ -19,6 +19,9 @@ show metadata xml blob
.TP
.B --fonts
show used fonts (--detail)
+.TP
+.B --linearize
+linearize given file
.SH AUTHOR
More information about ConTeXt and the tools that come with it can be found at:
diff --git a/doc/context/scripts/mkiv/mtx-pdf.xml b/doc/context/scripts/mkiv/mtx-pdf.xml
index 22e85988b..bc4a9d795 100644
--- a/doc/context/scripts/mkiv/mtx-pdf.xml
+++ b/doc/context/scripts/mkiv/mtx-pdf.xml
@@ -11,6 +11,7 @@
<flag name="info"><short>show some info about the given file</short></flag>
<flag name="metadata"><short>show metadata xml blob</short></flag>
<flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag>
+ <flag name="linearize"><short>linearize given file</short></flag>
</subcategory>
</category>
</flags>
diff --git a/metapost/context/base/mp-core.mpii b/metapost/context/base/mp-core.mpii
index c07f0976f..33e9b386e 100644
--- a/metapost/context/base/mp-core.mpii
+++ b/metapost/context/base/mp-core.mpii
@@ -346,6 +346,9 @@ boolean check_multi_par_chain ; check_multi_par_chain := true ; % extra page
boolean multi_column_first_page_hack; multi_column_first_page_hack := true ; % seems to work ok
+if unknown NOfTextColumns : numeric NOfTextColumns ; NOfTextColumns := 0 ; fi ;
+if unknown NOfTextAreas : numeric NOfTextAreas ; NOfTextAreas := 0 ; fi ;
+
def simplify_multi_pars = % boundingbox ipv shape als optie
for i := 1 upto nofmultipars :
multipars[i] := boundingbox multipars[i] ;
@@ -365,15 +368,15 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
pn,px,py,pw,ph,pd,
rw,rl,rr,rh,ra,ri) =
- if span_multi_column_pars :
- begingroup ;
- save TextAreas ; path TextAreas[] ;
- save NOfTextAreas ; numeric NOfTextAreas ;
- for i=1 upto NOfTextColumns :
- TextAreas[i] := TextColumns[i] ;
- endfor ;
- NOfTextAreas := NOfTextColumns ;
- fi ;
+% if span_multi_column_pars :
+% begingroup ;
+% save TextAreas ; path TextAreas[] ;
+% save NOfTextAreas ; numeric NOfTextAreas ;
+% for i=1 upto NOfTextColumns :
+% TextAreas[i] := TextColumns[i] ;
+% endfor ;
+% NOfTextAreas := NOfTextColumns ;
+% fi ;
last_multi_par_shift := origin ;
@@ -894,7 +897,7 @@ enddef ;
save_multipar (i,3,multipar) ;
- elseif multi_column_first_page_hack and ((nxy[fpos]=RealPageNumber) and (nxy[tpos]>=RealPageNumber) and (NOfTextColumns>1)) :
+ elseif multi_column_first_page_hack and ((nxy[fpos]=RealPageNumber) and (nxy[tpos]>=RealPageNumber) : % and (NOfTextColumns>1)) :
save_multipar (i,2,multipar) ;
@@ -943,9 +946,9 @@ enddef ;
fi ;
- if span_multi_column_pars :
- endgroup ;
- fi ;
+% if span_multi_column_pars :
+% endgroup ;
+% fi ;
% potential safeguard:
diff --git a/metapost/context/base/mp-core.mpiv b/metapost/context/base/mp-core.mpiv
index 3dba4a004..9b7182908 100644
--- a/metapost/context/base/mp-core.mpiv
+++ b/metapost/context/base/mp-core.mpiv
@@ -17,6 +17,9 @@ boolean context_core ; context_core := true ;
%D Copied to here .. not used any more.
+if unknown NOfTextColumns : numeric NOfTextColumns ; NOfTextColumns := 1 ; fi ;
+if unknown NOfTextAreas : numeric NOfTextAreas ; NOfTextAreas := 1 ; fi ;
+
def SaveTextAreas =
path SavedTextAreas [] ;
path SavedTextColumns[] ;
diff --git a/scripts/context/lua/mtx-pdf.lua b/scripts/context/lua/mtx-pdf.lua
index 3e4130344..551aa5b37 100644
--- a/scripts/context/lua/mtx-pdf.lua
+++ b/scripts/context/lua/mtx-pdf.lua
@@ -26,6 +26,7 @@ local helpinfo = [[
<flag name="info"><short>show some info about the given file</short></flag>
<flag name="metadata"><short>show metadata xml blob</short></flag>
<flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag>
+ <flag name="linearize"><short>linearize given file</short></flag>
</subcategory>
</category>
</flags>
@@ -213,9 +214,50 @@ function scripts.pdf.fonts(filename)
end
end
+-- this is a quick hack ... proof of concept .. will change (derived from luigi's example) ...
+-- i will make a ctx wrapper
+
+local qpdf
+
+function scripts.pdf.linearize(filename)
+ qpdf = qpdf or swiglib("qpdf.core")
+ local oldfile = filename or environment.files[1]
+ if not oldfile then
+ return
+ end
+ file.addsuffix(oldfile,"pdf")
+ if not lfs.isfile(oldfile) then
+ return
+ end
+ local newfile = environment.files[2]
+ if not newfile or file.removesuffix(oldfile) == file.removesuffix(newfile)then
+ newfile = file.addsuffix(file.removesuffix(oldfile) .. "-linearized","pdf")
+ end
+ local password = environment.arguments.password
+ local instance = qpdf.qpdf_init()
+ if bit32.band(qpdf.qpdf_read(instance,oldfile,password),qpdf.QPDF_ERRORS) ~= 0 then
+ report("unable to open input file")
+ elseif bit32.band(qpdf.qpdf_init_write(instance,newfile),qpdf.QPDF_ERRORS) ~= 0 then
+ report("unable to open output file")
+ else
+ report("linearizing %a into %a",oldfile,newfile)
+ qpdf.qpdf_set_static_ID(instance,qpdf.QPDF_TRUE)
+ qpdf.qpdf_set_linearization(instance,qpdf.QPDF_TRUE)
+ qpdf.qpdf_write(instance)
+ end
+ while qpdf.qpdf_more_warnings(instance) ~= 0 do
+ report("warning: %s",qpdf.qpdf_get_error_full_text(instance,qpdf.qpdf_next_warning(qpdf)))
+ end
+ if qpdf.qpdf_has_error(instance) ~= 0 then
+ report("error: %s",qpdf.qpdf_get_error_full_text(instance,qpdf.qpdf_get_error(qpdf)))
+ end
+ qpdf.qpdf_cleanup_p(instance)
+end
+
-- scripts.pdf.info("e:/tmp/oeps.pdf")
-- scripts.pdf.metadata("e:/tmp/oeps.pdf")
-- scripts.pdf.fonts("e:/tmp/oeps.pdf")
+-- scripts.pdf.linearize("e:/tmp/oeps.pdf")
local filename = environment.files[1] or ""
@@ -227,8 +269,10 @@ elseif environment.argument("metadata") then
scripts.pdf.metadata(filename)
elseif environment.argument("fonts") then
scripts.pdf.fonts(filename)
+elseif environment.argument("linearize") then
+ scripts.pdf.linearize(filename)
elseif environment.argument("exporthelp") then
- application.export(environment.argument("exporthelp"),environment.files[1])
+ application.export(environment.argument("exporthelp"),filename)
else
application.help()
end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 2daf44906..80489902b 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -15577,7 +15577,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lib"] = package.loaded["util-lib"] or true
--- original size: 11094, stripped down to: 5516
+-- original size: 11136, stripped down to: 5549
if not modules then modules={} end modules ['util-lib']={
version=1.001,
@@ -15657,10 +15657,10 @@ local function requireswiglib(required,version)
end
end
if trace_swiglib then
- report_swiglib("checking clib paths")
+ report_swiglib("checking lib paths")
end
- package.extraclibpath(environment.ownpath)
- local paths=package.clibpaths()
+ package.extralibpath(environment.ownpath)
+ local paths=package.libpaths()
for i=1,#paths do
local found=check(lfs.isfile)
if found and (not checkpattern or find(found,checkpattern)) then
@@ -15732,7 +15732,9 @@ function swiglib(name,version)
local library=swiglibs[name]
if not library then
statistics.starttiming(swiglibs)
- report_swiglib("loading %a",name)
+ if trace_swiglib then
+ report_swiglib("loading %a",name)
+ end
library=requireswiglib("swiglib."..name,version)
swiglibs[name]=library
statistics.stoptiming(swiglibs)
@@ -15989,8 +15991,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 667160
--- stripped bytes : 244299
+-- original bytes : 667202
+-- stripped bytes : 244308
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 2daf44906..80489902b 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -15577,7 +15577,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lib"] = package.loaded["util-lib"] or true
--- original size: 11094, stripped down to: 5516
+-- original size: 11136, stripped down to: 5549
if not modules then modules={} end modules ['util-lib']={
version=1.001,
@@ -15657,10 +15657,10 @@ local function requireswiglib(required,version)
end
end
if trace_swiglib then
- report_swiglib("checking clib paths")
+ report_swiglib("checking lib paths")
end
- package.extraclibpath(environment.ownpath)
- local paths=package.clibpaths()
+ package.extralibpath(environment.ownpath)
+ local paths=package.libpaths()
for i=1,#paths do
local found=check(lfs.isfile)
if found and (not checkpattern or find(found,checkpattern)) then
@@ -15732,7 +15732,9 @@ function swiglib(name,version)
local library=swiglibs[name]
if not library then
statistics.starttiming(swiglibs)
- report_swiglib("loading %a",name)
+ if trace_swiglib then
+ report_swiglib("loading %a",name)
+ end
library=requireswiglib("swiglib."..name,version)
swiglibs[name]=library
statistics.stoptiming(swiglibs)
@@ -15989,8 +15991,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 667160
--- stripped bytes : 244299
+-- original bytes : 667202
+-- stripped bytes : 244308
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 2daf44906..80489902b 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -15577,7 +15577,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["util-lib"] = package.loaded["util-lib"] or true
--- original size: 11094, stripped down to: 5516
+-- original size: 11136, stripped down to: 5549
if not modules then modules={} end modules ['util-lib']={
version=1.001,
@@ -15657,10 +15657,10 @@ local function requireswiglib(required,version)
end
end
if trace_swiglib then
- report_swiglib("checking clib paths")
+ report_swiglib("checking lib paths")
end
- package.extraclibpath(environment.ownpath)
- local paths=package.clibpaths()
+ package.extralibpath(environment.ownpath)
+ local paths=package.libpaths()
for i=1,#paths do
local found=check(lfs.isfile)
if found and (not checkpattern or find(found,checkpattern)) then
@@ -15732,7 +15732,9 @@ function swiglib(name,version)
local library=swiglibs[name]
if not library then
statistics.starttiming(swiglibs)
- report_swiglib("loading %a",name)
+ if trace_swiglib then
+ report_swiglib("loading %a",name)
+ end
library=requireswiglib("swiglib."..name,version)
swiglibs[name]=library
statistics.stoptiming(swiglibs)
@@ -15989,8 +15991,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 667160
--- stripped bytes : 244299
+-- original bytes : 667202
+-- stripped bytes : 244308
-- end library merge
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index e53a2201d..2628ed729 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2013.04.25 18:50}
+\newcontextversion{2013.04.26 15:13}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 9d1236a83..cbfbbd551 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 6e4197107..a1b580233 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 4d9101353..b35c8d445 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2013.04.25 18:50}
+\edef\contextversion{2013.04.26 15:13}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua
index a53b5df50..91c5d1414 100644
--- a/tex/context/base/node-inj.lua
+++ b/tex/context/base/node-inj.lua
@@ -385,10 +385,10 @@ function injections.handler(head,where,keep)
local w = k[4]
if w then
if rlmode and rlmode >= 0 then
- -- kern(x) glyph(p) kern(w-x)
- n.xoffset = p.xoffset - p.width + d[1] - x
+ -- kern(x) glyph(p) kern(w-x) mark(n)
+ n.xoffset = p.xoffset - p.width + d[1] - (w-x)
else
- -- kern(w-x) glyph(p) kern(x)
+ -- kern(w-x) glyph(p) kern(x) mark(n)
n.xoffset = p.xoffset - d[1] - x
end
else
@@ -432,7 +432,8 @@ function injections.handler(head,where,keep)
if next(wx) then
for n, k in next, wx do
-- only w can be nil (kernclasses), can be sped up when w == nil
- local x, w = k[2] or 0, k[4]
+ local x = k[2]
+ local w = k[4]
if w then
local rl = k[1] -- r2l = k[6]
local wx = w - x
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 63a039b77..045dc3eb1 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 0464bf88c..3839f0116 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/util-lib.lua b/tex/context/base/util-lib.lua
index 2ec3d395c..c5c999113 100644
--- a/tex/context/base/util-lib.lua
+++ b/tex/context/base/util-lib.lua
@@ -160,12 +160,12 @@ local function requireswiglib(required,version)
return found
end
end
- -- Check clib paths using name and version.
+ -- Check lib paths using name and version.
if trace_swiglib then
- report_swiglib("checking clib paths")
+ report_swiglib("checking lib paths")
end
- package.extraclibpath(environment.ownpath)
- local paths = package.clibpaths()
+ package.extralibpath(environment.ownpath)
+ local paths = package.libpaths()
for i=1,#paths do
local found = check(lfs.isfile)
if found and (not checkpattern or find(found,checkpattern)) then
@@ -258,7 +258,9 @@ function swiglib(name,version)
local library = swiglibs[name]
if not library then
statistics.starttiming(swiglibs)
- report_swiglib("loading %a",name)
+ if trace_swiglib then
+ report_swiglib("loading %a",name)
+ end
library = requireswiglib("swiglib." .. name,version)
swiglibs[name] = library
statistics.stoptiming(swiglibs)
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index bb89e3902..0cf2ce466 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 04/25/13 18:50:39
+-- merge date : 04/26/13 15:13:48
do -- begin closure to overcome local limits and interference
@@ -7705,7 +7705,7 @@ function injections.handler(head,where,keep)
local w=k[4]
if w then
if rlmode and rlmode>=0 then
- n.xoffset=p.xoffset-p.width+d[1]-x
+ n.xoffset=p.xoffset-p.width+d[1]-(w-x)
else
n.xoffset=p.xoffset-d[1]-x
end
@@ -7745,7 +7745,8 @@ function injections.handler(head,where,keep)
end
if next(wx) then
for n,k in next,wx do
- local x,w=k[2] or 0,k[4]
+ local x=k[2]
+ local w=k[4]
if w then
local rl=k[1]
local wx=w-x