summaryrefslogtreecommitdiff
path: root/tex/context/base/mlib-pps.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-06-04 22:20:00 +0200
committerHans Hagen <pragma@wxs.nl>2009-06-04 22:20:00 +0200
commit2ccf824cf6614b771c4dd47bd09e7d4f1a59f271 (patch)
treea757114aa5d23f13d459b6319c36c1cb4fe2611a /tex/context/base/mlib-pps.lua
parente9990ae7c22295e59c1d2c80c7e2717738b5c120 (diff)
downloadcontext-2ccf824cf6614b771c4dd47bd09e7d4f1a59f271.tar.gz
beta 2009.06.04 22:20
Diffstat (limited to 'tex/context/base/mlib-pps.lua')
-rw-r--r--tex/context/base/mlib-pps.lua64
1 files changed, 32 insertions, 32 deletions
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index 077bf1539..eaaf1fc17 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -221,6 +221,7 @@ function metapost.specials.fg(specification,object,result,flusher) -- graphics
local before = specification and function()
flusher.flushfigure(result)
sprint(ctxcatcodes,format("\\MPLIBfigure{%f}{%f}{%f}{%f}{%f}{%f}{%s}",sx,rx,ry,sy,tx,ty,specification))
+ object.path = nil
return object, { }
end
return { } , before, nil, nil -- replace { } by object for tracing
@@ -232,7 +233,10 @@ function metapost.specials.ps(specification,object,result) -- positions
local x, y = first.x_coord, first.y_coord
local w, h = third.x_coord - x, third.y_coord - y
local label = specification
- logs.report("mplib", "todo: position '%s' at (%s,%s) with (%s,%s)",label,x,y,w,h)
+ x = x - metapost.llx
+ y = metapost.ury - y
+ -- logs.report("mplib", "todo: position '%s' at (%s,%s) with (%s,%s)",label,x,y,w,h)
+ sprint(ctxcatcodes,format("\\dosavepositionwhd{%s}{0}{%sbp}{%sbp}{%sbp}{%sbp}{0pt}",label,x,y,w,h))
return { }, nil, nil, nil
end
@@ -810,41 +814,37 @@ do -- only used in graphictexts
end
-do -- not that beautiful but ok, we could save a md5 hash in the tui file !
+local graphics = { }
+local start = [[\starttext]]
+local preamble = [[\long\def\MPLIBgraphictext#1{\startTEXpage[scale=10000]#1\stopTEXpage}]]
+local stop = [[\stoptext]]
- local graphics = { }
- local start = [[\starttext]]
- local preamble = [[\long\def\MPLIBgraphictext#1{\startTEXpage[scale=10000]#1\stopTEXpage}]]
- local stop = [[\stoptext]]
+function metapost.specials.gt(specification,object) -- number, so that we can reorder
+ graphics[#graphics+1] = format("\\MPLIBgraphictext{%s}",specification)
+ metapost.intermediate.needed = true
+ metapost.multipass = true
+ return { }, nil, nil, nil
+end
- function metapost.specials.gt(specification,object) -- number, so that we can reorder
- graphics[#graphics+1] = format("\\MPLIBgraphictext{%s}",specification)
- metapost.intermediate.needed = true
- metapost.multipass = true
- return { }, nil, nil, nil
- end
-
- function metapost.intermediate.actions.makempy()
- if #graphics > 0 then
- local mpofile = tex.jobname .. "-mpgraph"
- local mpyfile = file.replacesuffix(mpofile,"mpy")
- local pdffile = file.replacesuffix(mpofile,"pdf")
- local texfile = file.replacesuffix(mpofile,"tex")
- io.savedata(texfile, { start, preamble, metapost.tex.get(), concat(graphics,"\n"), stop }, "\n")
- os.execute(format("context --once %s", texfile))
- if io.exists(pdffile) then
- os.execute(format("pstoedit -ssp -dt -f mpost %s %s", pdffile, mpyfile))
- local result = { }
- if io.exists(mpyfile) then
- local data = io.loaddata(mpyfile)
- for figure in gmatch(data,"beginfig(.-)endfig") do
- result[#result+1] = format("begingraphictextfig%sendgraphictextfig ;\n", figure)
- end
- io.savedata(mpyfile,concat(result,""))
+function metapost.intermediate.actions.makempy()
+ if #graphics > 0 then
+ local mpofile = tex.jobname .. "-mpgraph"
+ local mpyfile = file.replacesuffix(mpofile,"mpy")
+ local pdffile = file.replacesuffix(mpofile,"pdf")
+ local texfile = file.replacesuffix(mpofile,"tex")
+ io.savedata(texfile, { start, preamble, metapost.tex.get(), concat(graphics,"\n"), stop }, "\n")
+ os.execute(format("context --once %s", texfile))
+ if io.exists(pdffile) then
+ os.execute(format("pstoedit -ssp -dt -f mpost %s %s", pdffile, mpyfile))
+ local result = { }
+ if io.exists(mpyfile) then
+ local data = io.loaddata(mpyfile)
+ for figure in gmatch(data,"beginfig(.-)endfig") do
+ result[#result+1] = format("begingraphictextfig%sendgraphictextfig ;\n", figure)
end
+ io.savedata(mpyfile,concat(result,""))
end
- graphics = { }
end
+ graphics = { }
end
-
end