summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-core.mpiv19
1 files changed, 10 insertions, 9 deletions
diff --git a/metapost/context/base/mp-core.mpiv b/metapost/context/base/mp-core.mpiv
index 509801b02..c0718397d 100644
--- a/metapost/context/base/mp-core.mpiv
+++ b/metapost/context/base/mp-core.mpiv
@@ -1139,30 +1139,31 @@ vardef do_draw_par (expr p) =
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 width ; width := bbwidth(pxy) ;
+ save height ; height := bbheight(pxy) ;
+ if (par_line_height>0) and (height>1) and (width>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
- boxfilloptions ;
+ draw start -- start shifted (width,0)
+ withpen pencircle scaled boxgridwidth
+ boxfilloptions ;
fi ;
- draw start -- start shifted (bbwidth(pxy),0)
+ draw start -- start shifted (width,0)
if boxdashtype > 0 :
dashed evenly
fi
withpen pencircle scaled boxgridwidth
boxgridoptions ;
enddef ;
- grid := image ( %fails with inlinespace
+ grid := image ( % fails with inlinespace
if pdir=up :
- for i = if at_baseline : par_strut_depth else : 0 fi step par_line_height until max(bbheight(pxy),par_line_height) :
+ for i = if at_baseline : par_strut_depth else : 0 fi step par_line_height until max(height,par_line_height) :
_do_ (llcorner pxy shifted (0,+i)) ;
endfor ;
else :
- for i = if at_baseline : par_strut_height else : 0 fi step par_line_height until bbheight(pxy) :
+ for i = if at_baseline : par_strut_height else : 0 fi step par_line_height until height :
_do_ (ulcorner pxy shifted (0,-i)) ;
endfor ;
fi ;