summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-core.mp18
-rw-r--r--metapost/context/base/mp-grph.mp30
-rw-r--r--metapost/context/base/mp-mlib.mp59
3 files changed, 57 insertions, 50 deletions
diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp
index 7967b718f..2b62559b8 100644
--- a/metapost/context/base/mp-core.mp
+++ b/metapost/context/base/mp-core.mp
@@ -1114,16 +1114,16 @@ def draw_multi_pars =
for i=1 upto nofmultipars :
do_draw_par(multipars[i]) ;
if boxgridtype= 1 :
- draw baseline_grid (multipars[i],up,true ) withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],up,true ) ; % withcolor boxgridcolor ;
elseif boxgridtype= 2 :
- draw baseline_grid (multipars[i],up,false) withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],up,false) ; % withcolor boxgridcolor ;
elseif boxgridtype= 3 :
- draw baseline_grid (multipars[i],up,true ) withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],up,true ) ; % withcolor boxgridcolor ;
draw baseline_grid (multipars[i],up,true )
- shifted (0,ExHeight) withcolor boxgridcolor ;
+ shifted (0,ExHeight) ; % withcolor boxgridcolor ;
elseif boxgridtype= 4 :
draw baseline_grid (multipars[i],up,true )
- shifted (0,ExHeight/2) withcolor boxgridcolor ;
+ shifted (0,ExHeight/2) ; % withcolor boxgridcolor ;
elseif boxgridtype=11 :
draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ;
elseif boxgridtype=12 :
@@ -1166,8 +1166,14 @@ vardef baseline_grid (expr pxy, pdir, at_baseline) =
if (par_line_height>0) and (bbheight(pxy)>1) and (bbwidth(pxy)>1) and (boxgridwidth>0) :
save i, grid, bb ; picture grid ; pair start ; path bb ;
def _do_ (expr start) =
+ % 1 = normal, 2 = with background (i.e. no shine-through)
+ if boxdashtype = 2 :
+ draw start -- start shifted (bbwidth(pxy),0)
+ withpen pencircle scaled boxgridwidth
+ withcolor boxfillcolor ;
+ fi ;
draw start -- start shifted (bbwidth(pxy),0)
- if boxdashtype = 1 : dashed evenly fi
+ if boxdashtype > 0 : dashed evenly fi
withpen pencircle scaled boxgridwidth
withcolor boxgridcolor ;
enddef ;
diff --git a/metapost/context/base/mp-grph.mp b/metapost/context/base/mp-grph.mp
index e2e7e7529..87a179677 100644
--- a/metapost/context/base/mp-grph.mp
+++ b/metapost/context/base/mp-grph.mp
@@ -59,21 +59,21 @@ string graphictextfile ; graphictextfile := "dummy.mpo" ;
def data_mpo_file = job_name & "-mp.mpo" enddef ;
def data_mpy_file = job_name & "-mp.mpy" enddef ;
-% def savegraphictext (expr str) =
-% if (graphictextstring<>"") :
-% write graphictextstring to data_mpo_file ;
-% graphictextstring := "" ;
-% fi ;
-% write str to data_mpo_file ;
-% let erasegraphictextfile = relax ;
-% enddef ;
-
-% def erasegraphictextfile =
-% write EOF to data_mpo_file ;
-% let erasegraphictextfile = relax ;
-% enddef ;
-
-% extra_beginfig := extra_beginfig & " erasegraphictextfile ;" ;
+def savegraphictext (expr str) =
+ if (graphictextstring<>"") :
+ write graphictextstring to data_mpo_file ;
+ graphictextstring := "" ;
+ fi ;
+ write str to data_mpo_file ;
+ let erasegraphictextfile = relax ;
+enddef ;
+
+def erasegraphictextfile =
+ write EOF to data_mpo_file ;
+ let erasegraphictextfile = relax ;
+enddef ;
+
+extra_beginfig := extra_beginfig & " erasegraphictextfile ;" ;
def begingraphictextfig (expr n) =
foundpicture := n ; scratchpicture := nullpicture ;
diff --git a/metapost/context/base/mp-mlib.mp b/metapost/context/base/mp-mlib.mp
index 520e49b06..dad7ab787 100644
--- a/metapost/context/base/mp-mlib.mp
+++ b/metapost/context/base/mp-mlib.mp
@@ -18,27 +18,36 @@ boolean context_mlib ; context_mlib := true ;
numeric _tt_w_[], _tt_h_[], _tt_d_[] ;
numeric _tt_n_ ; _tt_n_ := 0 ;
+picture _tt_p_ ; _tt_p_ := nullpicture ;
boolean _trial_run_ ; _trial_run_ := false ;
def resettextexts =
_tt_n_ := 0 ;
+ _tt_p_ := nullpicture ;
enddef ;
+extra_endfig := ";draw _tt_p_; " & extra_endfig ;
+extra_beginfig := extra_beginfig & "resettextexts;";
+
vardef textext(expr str) =
if _trial_run_ :
image (
- draw unitsquare
- withprescript "tf"
- withpostscript str ;
+ _tt_n_ := _tt_n_ + 1 ;
+ _tt_p_ := image (
+ draw _tt_p_ ;
+ draw unitsquare withprescript "tf" withpostscript decimal _tt_n_ & ":" & str ;
+ ) ;
+ draw unitsquare ;
)
else :
image (
_tt_n_ := _tt_n_ + 1 ;
+ show _tt_n_ ;
draw unitsquare
xscaled _tt_w_[_tt_n_]
yscaled (_tt_h_[_tt_n_] + _tt_d_[_tt_n_])
withprescript "ts"
- withpostscript decimal _tt_n_ ;
+ withpostscript decimal _tt_n_ & ":" & str ;
)
fi
enddef ;
@@ -82,47 +91,35 @@ def withlinearshade (expr a, b, ca, cb) =
enddef ;
string _defined_cs_pre_[], _defined_cs_post_[] ; numeric _defined_cs_ ; _defined_cs_:= 0 ;
vardef define_circular_shade (expr a, b, ra, rb, ca, cb) =
- _defined_cs_ = _defined_cs_ + 1 ;
- _defined_cs_pre_ [_defined_cs_] = "cs" ;
- _defined_cs_post_[_defined_cs_] = "0 1 " & decimal shadefactor & " " &
+ _defined_cs_ := _defined_cs_ + 1 ;
+ _defined_cs_pre_ [_defined_cs_] := "cs" ;
+ _defined_cs_post_[_defined_cs_] := "0 1 " & decimal shadefactor & " " &
colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " " & decimal ra & " " &
colordecimals cb & " " & ddecimal (b shifted shadeoffset) & " " & decimal rb ;
_defined_cs_
enddef ;
vardef define_linear_shade (expr a, b, ca, cb) =
- _defined_cs_ = _defined_cs_ + 1 ;
- _defined_cs_pre_ [_defined_cs_] = "ls" ;
- _defined_cs_post_[_defined_cs_] = "0 1 " & decimal shadefactor & " " &
- colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " "
+ _defined_cs_ := _defined_cs_ + 1 ;
+ _defined_cs_pre_ [_defined_cs_] := "ls" ;
+ _defined_cs_post_[_defined_cs_] := "0 1 " & decimal shadefactor & " " &
+ colordecimals ca & " " & ddecimal (a shifted shadeoffset) & " " &
colordecimals cb & " " & ddecimal (b shifted shadeoffset) ;
_defined_cs_
enddef ;
-def withshade(expr sc) =
- withprescript _defined_cs_pre_[sc] withpostscript _defined_cs_post_[sc]
+primarydef p withshade sc =
+ p withprescript _defined_cs_pre_[sc] withpostscript _defined_cs_post_[sc]
enddef ;
def shadecolor(expr sc) = % obsolete
1 withprescript _defined_cs_pre_[sc] withpostscript _defined_cs_post_[sc]
enddef ;
-% def _graphic_text_f_(expr t) text rest =
-% draw unitsquare withprescript "gt" withpostscript t ;
-% enddef ;
-% def _graphic_text_s_(expr t) =
-% begingroup ;
-% save figurepicture ; picture figurepicture ;
-% figurepicture := currentpicture ; currentpicture := nullpicture ;
-% currentgraphictext := currentgraphictext + 1 ;
-% dofinishgraphictext
-% enddef ;
-
-vardef graphictext primary t =
- save next ;
+def graphictext primary t =
if _trial_run_ :
- let next = nographictext ;
+ let dographictextindeed = nographictext ;
else :
- let next = dographictext ;
+ let dographictextindeed = dographictext ;
fi
- next(t)
+ dographictextindeed(t)
enddef ;
def dographictext (expr t) =
begingroup ;
@@ -134,6 +131,10 @@ enddef ;
def nographictext (expr t) text rest =
draw unitsquare withprescript "gt" withpostscript t ;
enddef ;
+def savegraphictext (expr str) =
+enddef ;
+def erasegraphictextfile =
+enddef ;
def doexternalfigure (expr filename) text transformation =
draw unitsquare transformation withprescript "fg" withpostscript filename ;