From 7e78c92b74e8b01d721befd8b1668a88c4bf8319 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 5 Sep 2011 19:28:00 +0200 Subject: beta 2011.09.05 19:28 --- tex/context/base/anch-pgr.mkiv | 21 +++++++------ tex/context/base/colo-ini.lua | 19 +++++++++--- tex/context/base/colo-ini.mkiv | 5 +--- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4092 -> 4091 bytes tex/context/base/context-version.png | Bin 105679 -> 105741 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/data-env.lua | 4 +-- tex/context/base/mlib-pps.lua | 23 +++++++++----- tex/context/base/mlib-run.lua | 33 ++++++++++++++++----- tex/context/base/status-files.pdf | Bin 23922 -> 23919 bytes tex/context/base/status-lua.pdf | Bin 162216 -> 162240 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 15 files changed, 74 insertions(+), 41 deletions(-) (limited to 'tex') diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv index ebfd67083..f052b4ddb 100644 --- a/tex/context/base/anch-pgr.mkiv +++ b/tex/context/base/anch-pgr.mkiv @@ -440,8 +440,8 @@ \startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth} initialize_box(\MPpos{\MPvar{self}}) ; - boxfillcolor := \MPvar{fillcolor} ; - boxlinecolor := \MPvar{linecolor} ; + def boxfilloptions = withcolor \MPvar{fillcolor} enddef ; + def boxlineoptions = withcolor \MPvar{linecolor} enddef ; boxlinewidth := \MPvar{linewidth} ; boxfilloffset := \MPvar{filloffset} ; draw_box ; @@ -457,8 +457,8 @@ \startMPpositiongraphic{mpos:area}{fillcolor,linecolor,linewidth} initialize_area(\MPpos{b:\MPvar{self}},\MPpos{e:\MPvar{self}}) ; - boxfillcolor := \MPvar{fillcolor} ; - boxlinecolor := \MPvar{linecolor} ; + def boxfilloptions = withcolor \MPvar{fillcolor} enddef ; + def boxlineoptions = withcolor \MPvar{linecolor} enddef ; boxlinewidth := \MPvar{linewidth} ; boxfilloffset := \MPvar{filloffset} ; draw_area ; @@ -497,9 +497,9 @@ boxlinetype := \MPvar{linetype} ; boxfilltype := \MPvar{filltype} ; boxdashtype := \MPvar{dashtype} ; - boxgridcolor := \MPvar{gridcolor} ; - boxlinecolor := \MPvar{linecolor} ; - boxfillcolor := \MPvar{fillcolor} ; + def boxgridoptions = withcolor \MPvar{gridcolor} enddef ; + def boxlineoptions = withcolor \MPvar{linecolor} enddef ; + def boxfilloptions = withcolor \MPvar{fillcolor} enddef ; boxfilloffset := \MPvar{filloffset} ; boxlinewidth := \MPvar{linewidth} ; boxgridwidth := \MPvar{gridwidth} ; @@ -1058,13 +1058,12 @@ % these might become macros in mp-page \startuseMPgraphic{mpos:common:ec} - path pa ; pair ca ; color lc ; numeric lw ; + path pa ; pair ca ; numeric lw ; lw := \MPvar{linewidth} ; - lc := \MPvar{linecolor} ; initialize_box(\MPpos{\MPvar{self}}) ; pa := pxy ; ca := cxy ; pa := boundingbox pa enlarged 2lw ; - pa := llcorner pa...lrcorner pa...urcorner pa...ulcorner pa...cycle ; - drawoptions (withpen pencircle scaled lw withcolor lc) ; + pa := llcorner pa ... lrcorner pa ... urcorner pa ... ulcorner pa ... cycle ; + drawoptions (withpen pencircle scaled lw withcolor \MPvar{linecolor}) ; \stopuseMPgraphic \startMPpositiongraphic{mpos:encircle}{linecolor,fillcolor,linewidth} diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index 1389eb71f..4ad564213 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -433,7 +433,7 @@ function colors.definemultitonecolor(name,multispec,colorspec,selfspec) end end -function colors.mpcolor(model,ca,ta,default) -- will move to mlib-col +local function mpcolor(model,ca,ta,default) -- will move to mlib-col local cv = colors.supported and colors.value(ca) -- faster when direct colors.values[ca] if cv then local tv = transparencies.supported and transparencies.value(ta) @@ -468,7 +468,7 @@ function colors.mpcolor(model,ca,ta,default) -- will move to mlib-col end end ---~ function colors.mpcolor(model,ca,ta,default) -- will move to mlib-col +--~ local function mpcolor(model,ca,ta,default) -- will move to mlib-col --~ local cv = colors.supported and colors.value(ca) -- faster when direct colors.values[ca] --~ if cv then --~ local tv = transparencies.supported and transparencies.value(ta) @@ -503,6 +503,13 @@ end --~ end --~ end +local function mpoptions(model,ca,ta,default) -- will move to mlib-col + return format("withcolor %s",mpcolor(model,ca,ta,default)) +end + +colors.mpcolor = mpcolor +colors.mpoptions = mpoptions + function colors.formatcolor(ca,separator) local cv = colors.value(ca) if cv then @@ -752,7 +759,7 @@ function colors.usecolors(name) } end --- interface +-- interface (todo: use locals) local setcolormodel = colors.setmodel @@ -783,7 +790,11 @@ function commands.formatcolor (...) context(colors.formatcolor function commands.formatgray (...) context(colors.formatgray (...)) end function commands.mpcolor(model,ca,ta,default) - context(colors.mpcolor(model,ca,ta,default)) + context(mpcolor(model,ca,ta,default)) +end + +function commands.mpoptions(model,ca,ta,default) + context(mpoptions(model,ca,ta,default)) end function commands.doifblackelse(a) diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv index 9b1f37521..80be9619c 100644 --- a/tex/context/base/colo-ini.mkiv +++ b/tex/context/base/colo-ini.mkiv @@ -669,10 +669,6 @@ \newif\ifMPcmykcolors % \MPcmykcolorsfalse \newif\ifMPspotcolors % \MPspotcolorsfalse -\ifx\MPcolor\undefined - \def\MPcolor#1{(0,0,0)} -\fi - %D For the moment we keep the next downward compatibility %D switch, i.e.\ expanded colors. However, predefined colors %D and palets are no longer expanded (which is what I wanted @@ -1022,6 +1018,7 @@ \let\colorformatseparator\space \def\MPcolor #1{\ctxcommand{mpcolor(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1})}} +\def\MPoptions #1{\ctxcommand{mpoptions(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1})}} \def\thecolorattribute #1{\number\csname(ca:\ifcsname(ca:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ca:#1)\endcsname#1\fi\fi)\endcsname} \def\thetransparencyattribute#1{\number\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname} diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index e7ca44ef5..f00ce074f 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.09.05 12:54} +\newcontextversion{2011.09.05 19:28} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 2f892eae1..d4898e038 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{2011.09.05 12:54} +\newcontextversion{2011.09.05 19:28} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 900d76a23..574205d6f 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 81513ef96..a28dc928d 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 74a27402b..22577f103 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.09.05 12:54} +\edef\contextversion{2011.09.05 19:28} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 017f29af3..896cad28b 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.09.05 12:54} +\edef\contextversion{2011.09.05 19:28} %D For those who want to use this: diff --git a/tex/context/base/data-env.lua b/tex/context/base/data-env.lua index 7d12f8d5f..2d9787b91 100644 --- a/tex/context/base/data-env.lua +++ b/tex/context/base/data-env.lua @@ -89,12 +89,12 @@ local relations = allocate { -- todo: handlers also here mp = { names = { "mp" }, variable = 'MPINPUTS', - suffixes = { 'mp' }, + suffixes = { 'mp', 'mpvi', 'mpiv', 'mpii' }, }, tex = { names = { "tex" }, variable = 'TEXINPUTS', - suffixes = { 'tex', "mkiv", "mkiv", "mkii" }, + suffixes = { 'tex', "mkvi", "mkiv", "mkii" }, }, icc = { names = { "icc", "icc profile", "icc profiles" }, diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index 3dd90ab50..8034fbc32 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -937,6 +937,8 @@ local value = Cs ( ( + P(","))^1 ) +-- should be codeinjections + local function tr_process(object,prescript,before,after) -- before can be shortcut to t local tr_alternative = prescript.tr_alternative @@ -947,9 +949,12 @@ local function tr_process(object,prescript,before,after) end local cs = object.color if cs and #cs > 0 then - local sp_name = prescript.sp_name local b, a - if sp_name then + local sp_type = prescript.sp_type + if not sp_type then + b, a = colorconverter(cs) + elseif sp_type == "spot" or sp_type == "multitone" then + local sp_name = prescript.sp_name or "black" local sp_fractions = prescript.sp_fractions or 1 local sp_components = prescript.sp_components or "" local sp_value = prescript.sp_value or "1" @@ -958,14 +963,18 @@ local function tr_process(object,prescript,before,after) -- beware, we do scale the spotcolors but not the alternative representation sp_value = lpeg.match(value,sp_value,1,cf) or sp_value end - -- should be codeinjections b, a = spotcolorconverter(sp_name,sp_fractions,sp_components,sp_value) - else - -- should be codeinjections + elseif sp_type == "named" then +--~ local sp_name = prescript.sp_name or "black" +--~ local c = attributes.list[attributes.private('color')][sp_name] -- string or attribute +--~ local r = attributes.colors.registered[r] +--~ local v = attributes.colors.value(r) b, a = colorconverter(cs) end - before[#before+1] = b - after[#after+1] = a + if a and b then + before[#before+1] = b + after[#after+1] = a + end end end diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua index 900f466e2..f8c0456a1 100644 --- a/tex/context/base/mlib-run.lua +++ b/tex/context/base/mlib-run.lua @@ -224,7 +224,7 @@ else if not mpx then result = { status = 99, error = "out of memory"} else - result = mpx:execute(format(preamble, file.replacesuffix(name,"mp"))) + result = mpx:execute(format(preamble, file.addsuffix(name,"mp"))) end stoptiming(mplib) metapost.reporterror(result) @@ -233,14 +233,31 @@ else function metapost.checkformat(mpsinput) local mpsversion = environment.version or "unset version" - local mpsinput = file.addsuffix(mpsinput or "metafun", "mp") - report_metapost("loading '%s' (experimental metapost version two)",mpsinput) - local mpx, result = metapost.load(mpsinput) - if mpx then - return mpx + local mpsinput = mpsinput or "metafun" + local foundfile = "" + if file.suffix(mpsinput) ~= "" then + foundfile = finder(mpsinput) or "" + end + if foundfile == "" then + foundfile = finder(file.replacesuffix(mpsinput,"mpvi")) or "" + end + if foundfile == "" then + foundfile = finder(file.replacesuffix(mpsinput,"mpiv")) or "" + end + if foundfile == "" then + foundfile = finder(file.replacesuffix(mpsinput,"mp")) or "" + end + if foundfile == "" then + report_metapost("loading '%s' fails, format not found",mpsinput) else - report_metapost("error in loading '%s'",mpsinput) - metapost.reporterror(result) + report_metapost("loading '%s': %s",mpsinput,foundfile) + local mpx, result = metapost.load(foundfile) + if mpx then + return mpx + else + report_metapost("error in loading '%s'",mpsinput) + metapost.reporterror(result) + end end end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 520f214af..0571a3e77 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index ca6ebc34e..bc371c7ac 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e493ba948..6221d92a8 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 : 09/05/11 12:54:46 +-- merge date : 09/05/11 19:28:27 do -- begin closure to overcome local limits and interference -- cgit v1.2.3