diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-02-15 11:15:07 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-02-15 11:15:07 +0100 |
commit | a036ac2dd19b592316e1b479360e9e6c6700e935 (patch) | |
tree | 321156a4e2af995a7f401e1b773fd8813e3928da /tex/context/base/mkiv/mlib-run.lua | |
parent | d73f5987ca04dbdf0a134236c3314dadd7a73565 (diff) | |
download | context-a036ac2dd19b592316e1b479360e9e6c6700e935.tar.gz |
2016-02-15 10:29:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-run.lua')
-rw-r--r-- | tex/context/base/mkiv/mlib-run.lua | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index 5ec1f9c6b..f20461bbb 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -525,7 +525,7 @@ end -- goodie -function metapost.quickanddirty(mpxformat,data) +function metapost.quickanddirty(mpxformat,data,plugmode) if not data then mpxformat = "metafun" data = mpxformat @@ -545,7 +545,7 @@ function metapost.quickanddirty(mpxformat,data) end } local data = formatters["; beginfig(1) ;\n %s\n ; endfig ;"](data) - metapost.process(mpxformat, { data }, false, flusher, false, false, "all") + metapost.process(mpxformat, { data }, false, flusher, false, false, "all", plugmode) if code then return { bbox = bbox or { 0, 0, 0, 0 }, @@ -573,3 +573,38 @@ function metapost.getstatistics(memonly) return t end end + +do + + local result = { } + local width = 0 + local height = 0 + local depth = 0 + local mpx = false + + local flusher = { + startfigure = function(n,llx,lly,urx,ury) + result = { } + width = urx - llx + height = ury + depth = -lly + end, + flushfigure = function(t) + for i=1,#t do + result[#result+1] = t[i] + end + end, + stopfigure = function() + end + } + + function metapost.simple(format,code) -- even less than metapost.quickcanddirty + local mpx = metapost.format(format or "metafun","metafun") + -- metapost.setoutercolor(2) + metapost.process(mpx,code,false,flusher,false,false,1,true) -- last true is plugmode ! + local stream = concat(result," ") + result = nil -- cleanup + return stream, width, height, depth + end + +end |