summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-01-04 23:45:44 +0000
committerKarl Berry <karl@freefriends.org>2018-01-04 23:45:44 +0000
commit493c985399debe97d5052f70079307d67d99b080 (patch)
tree9d5eff58fb96c1143d2d064ce96ba254bafa5787 /Master/texmf-dist/tex/luatex
parent5fd4acc1b2e4fc4d65626a5fd525864b5ff849a7 (diff)
luamplib (4jan18)
git-svn-id: svn://tug.org/texlive/trunk@46216 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua210
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty2
2 files changed, 133 insertions, 79 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 3944df1502d..32dbb2131af 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -18,8 +18,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.12.1",
- date = "2017/06/02",
+ version = "2.12.2",
+ date = "2018/01/04",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -415,6 +415,9 @@ end
luamplib.codeinherit = false
local mplibinstances = {}
local process = function (data,indeed,verbatim)
+ if not stringfind(data, begname.."beginfig%s*%([%+%-%s]*%d[%.%d%s]*%)") then
+ data = data .. "beginfig(-1);endfig;"
+ end
local standalone, firstpass = not luamplib.codeinherit, not indeed
local currfmt = currentformat .. (luamplib.numbersystem or "scaled")
currfmt = firstpass and currfmt or (currfmt.."2")
@@ -1069,8 +1072,8 @@ local function flush(result,flusher)
local llx, lly, urx, ury = bbox[1], bbox[2], bbox[3], bbox[4] -- faster than unpack
if urx < llx then
-- invalid
- pdf_startfigure(fignum,0,0,0,0)
- pdf_stopfigure()
+ -- pdf_startfigure(fignum,0,0,0,0)
+ -- pdf_stopfigure()
else
if TeX_code_t[f] then
texsprint(TeX_code_t[f])
@@ -1079,6 +1082,8 @@ local function flush(result,flusher)
pdf_startfigure(fignum,llx,lly,urx,ury)
start_pdf_code()
if objects then
+ local savedpath = nil
+ local savedhtap = nil
for o=1,#objects do
local object = objects[o]
local objecttype = object.type
@@ -1092,9 +1097,10 @@ local function flush(result,flusher)
elseif objecttype == "start_bounds" or objecttype == "stop_bounds" then
-- skip
elseif objecttype == "start_clip" then
+ local evenodd = not object.istext and object.postscript == "evenodd"
start_pdf_code()
flushnormalpath(object.path,t,false)
- pdf_literalcode("W n")
+ pdf_literalcode(evenodd and "W* n" or "W n")
elseif objecttype == "stop_clip" then
stop_pdf_code()
miterlimit, linecap, linejoin, dashed = -1, -1, -1, false
@@ -1110,93 +1116,141 @@ local function flush(result,flusher)
pdf_textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
stop_pdf_code()
else
- local ml = object.miterlimit
- if ml and ml ~= miterlimit then
- miterlimit = ml
- pdf_literalcode("%f M",ml)
- end
- local lj = object.linejoin
- if lj and lj ~= linejoin then
- linejoin = lj
- pdf_literalcode("%i j",lj)
- end
- local lc = object.linecap
- if lc and lc ~= linecap then
- linecap = lc
- pdf_literalcode("%i J",lc)
- end
- local dl = object.dash
- if dl then
- local d = format("[%s] %i d",tableconcat(dl.dashes or {}," "),dl.offset)
- if d ~= dashed then
- dashed = d
- pdf_literalcode(dashed)
+ local evenodd, collect, both = false, false, false
+ local postscript = object.postscript
+ if not object.istext then
+ if postscript == "evenodd" then
+ evenodd = true
+ elseif postscript == "collect" then
+ collect = true
+ elseif postscript == "both" then
+ both = true
+ elseif postscript == "eoboth" then
+ evenodd = true
+ both = true
end
- elseif dashed then
- pdf_literalcode("[] 0 d")
- dashed = false
- end
- local path = object.path
- local transformed, penwidth = false, 1
- local open = path and path[1].left_type and path[#path].right_type
- local pen = object.pen
- if pen then
- if pen.type == 'elliptical' then
- transformed, penwidth = pen_characteristics(object) -- boolean, value
- pdf_literalcode("%f w",penwidth)
- if objecttype == 'fill' then
- objecttype = 'both'
- end
- else -- calculated by mplib itself
- objecttype = 'fill'
- end
- end
- if transformed then
- start_pdf_code()
end
- if path then
- if transformed then
- flushconcatpath(path,open)
+ if collect then
+ if not savedpath then
+ savedpath = { object.path or false }
+ savedhtap = { object.htap or false }
else
- flushnormalpath(path,open)
+ savedpath[#savedpath+1] = object.path or false
+ savedhtap[#savedhtap+1] = object.htap or false
end
- if not shade_no then ----- conflict with shading
- if objecttype == "fill" then
- pdf_literalcode("h f")
- elseif objecttype == "outline" then
- pdf_literalcode((open and "S") or "h S")
- elseif objecttype == "both" then
- pdf_literalcode("h B")
+ else
+ local ml = object.miterlimit
+ if ml and ml ~= miterlimit then
+ miterlimit = ml
+ pdf_literalcode("%f M",ml)
+ end
+ local lj = object.linejoin
+ if lj and lj ~= linejoin then
+ linejoin = lj
+ pdf_literalcode("%i j",lj)
+ end
+ local lc = object.linecap
+ if lc and lc ~= linecap then
+ linecap = lc
+ pdf_literalcode("%i J",lc)
+ end
+ local dl = object.dash
+ if dl then
+ local d = format("[%s] %i d",tableconcat(dl.dashes or {}," "),dl.offset)
+ if d ~= dashed then
+ dashed = d
+ pdf_literalcode(dashed)
end
+ elseif dashed then
+ pdf_literalcode("[] 0 d")
+ dashed = false
end
- end
- if transformed then
- stop_pdf_code()
- end
- local path = object.htap
- if path then
- if transformed then
- start_pdf_code()
+ local path = object.path
+ local transformed, penwidth = false, 1
+ local open = path and path[1].left_type and path[#path].right_type
+ local pen = object.pen
+ if pen then
+ if pen.type == 'elliptical' then
+ transformed, penwidth = pen_characteristics(object) -- boolean, value
+ pdf_literalcode("%f w",penwidth)
+ if objecttype == 'fill' then
+ objecttype = 'both'
+ end
+ else -- calculated by mplib itself
+ objecttype = 'fill'
+ end
end
if transformed then
- flushconcatpath(path,open)
- else
- flushnormalpath(path,open)
+ start_pdf_code()
end
- if objecttype == "fill" then
- pdf_literalcode("h f")
- elseif objecttype == "outline" then
- pdf_literalcode((open and "S") or "h S")
- elseif objecttype == "both" then
- pdf_literalcode("h B")
+ if path then
+ if savedpath then
+ for i=1,#savedpath do
+ local path = savedpath[i]
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ end
+ savedpath = nil
+ end
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ if not shade_no then ----- conflict with shading
+ if objecttype == "fill" then
+ pdf_literalcode(evenodd and "h f*" or "h f")
+ elseif objecttype == "outline" then
+ if both then
+ pdf_literalcode(evenodd and "h B*" or "h B")
+ else
+ pdf_literalcode(open and "S" or "h S")
+ end
+ elseif objecttype == "both" then
+ pdf_literalcode(evenodd and "h B*" or "h B")
+ end
+ end
end
if transformed then
stop_pdf_code()
end
+ local path = object.htap
+ if path then
+ if transformed then
+ start_pdf_code()
+ end
+ if savedhtap then
+ for i=1,#savedhtap do
+ local path = savedhtap[i]
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ end
+ savedhtap = nil
+ evenodd = true
+ end
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ if objecttype == "fill" then
+ pdf_literalcode(evenodd and "h f*" or "h f")
+ elseif objecttype == "outline" then
+ pdf_literalcode(open and "S" or "h S")
+ elseif objecttype == "both" then
+ pdf_literalcode(evenodd and "h B*" or "h B")
+ end
+ if transformed then
+ stop_pdf_code()
+ end
+ end
end
--- if cr then
--- pdf_literalcode(cr)
--- end
end
do_postobj_color(tr_opaq,cr_over,shade_no)
end
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index be9b9507ee9..bc05bf46027 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
@@ -14,7 +14,7 @@
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2017/06/02 v2.12.1 mplib package for LuaTeX]
+ [2018/01/04 v2.12.2 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi