summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/context/base/mp-core.mp
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/metapost/context/base/mp-core.mp')
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-core.mp24
1 files changed, 18 insertions, 6 deletions
diff --git a/Master/texmf-dist/metapost/context/base/mp-core.mp b/Master/texmf-dist/metapost/context/base/mp-core.mp
index 92036febfc9..2b62559b8bc 100644
--- a/Master/texmf-dist/metapost/context/base/mp-core.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-core.mp
@@ -1000,12 +1000,14 @@ color boxfillcolor ; boxfillcolor := .8white ;
numeric boxgridtype ; boxgridtype := 0 ;
numeric boxlinetype ; boxlinetype := 1 ;
numeric boxfilltype ; boxfilltype := 1 ;
+numeric boxdashtype ; boxdashtype := 0 ;
pair boxgriddirection ; boxgriddirection := up ;
numeric boxgridwidth ; boxgridwidth := 1pt ;
numeric boxlinewidth ; boxlinewidth := 1pt ;
numeric boxlineradius ; boxlineradius := 0pt ;
numeric boxfilloffset ; boxfilloffset := 0pt ;
numeric boxgriddistance ; boxgriddistance := .5cm ;
+numeric boxgridshift ; boxgridshift := 0pt ;
def draw_box =
draw pxy withcolor boxlinecolor withpen pencircle scaled boxlinewidth ;
@@ -1112,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 :
@@ -1162,9 +1164,16 @@ enddef ;
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 ; picture grid ; pair start ;
+ 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 > 0 : dashed evenly fi
withpen pencircle scaled boxgridwidth
withcolor boxgridcolor ;
enddef ;
@@ -1186,6 +1195,9 @@ vardef baseline_grid (expr pxy, pdir, at_baseline) =
fi ;
) ;
clip grid to pxy ;
+ bb := boundingbox grid ;
+ grid := grid shifted (0,boxgridshift) ;
+ setbounds grid to bb ;
grid
else :
nullpicture