From b155eafa1e2d73692eed08ecabeb5ad589ac11dc Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 15 Apr 2022 20:34:40 +0200 Subject: 2022-04-15 20:15:00 --- metapost/context/base/mpiv/mp-tool.mpiv | 12 +++++++----- metapost/context/base/mpxl/mp-cont.mpxl | 11 +++++++++++ metapost/context/base/mpxl/mp-tool.mpxl | 29 ++++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 10 deletions(-) (limited to 'metapost') diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv index f41811413..6c02323c3 100644 --- a/metapost/context/base/mpiv/mp-tool.mpiv +++ b/metapost/context/base/mpiv/mp-tool.mpiv @@ -3754,13 +3754,15 @@ numeric mfun_dash_on, mfun_dash_off ; primarydef p withdashes len = hide ( - save l, t, n, m ; pair t ; + save l, t, n, m, don, doff; pair t ; l := arclength p ; - t := paired(len) ; + t := paired (len) ; m := xpart t + ypart t ; - n := l / (l div m) / m ; - mfun_dash_on := n * xpart t ; - mfun_dash_off := n * ypart t ; + n := (l if not cycle p : - xpart t fi) div m ; + (n if not cycle p : + 1 fi) * don + n * doff = l ; + don*(ypart t) = doff*(xpart t) ; + mfun_dash_on := don ; + mfun_dash_off := doff ; ) p dashed dashpattern (on mfun_dash_on off mfun_dash_off) enddef ; diff --git a/metapost/context/base/mpxl/mp-cont.mpxl b/metapost/context/base/mpxl/mp-cont.mpxl index a89265224..d08a24272 100644 --- a/metapost/context/base/mpxl/mp-cont.mpxl +++ b/metapost/context/base/mpxl/mp-cont.mpxl @@ -199,3 +199,14 @@ immutable % permanent InnerMarginDistance, OuterEdgeWidth, InnerEdgeWidth, OuterEdgeDistance, InnerEdgeDistance, OuterSpaceWidth, InnerSpaceWidth, OuterMargin, InnerMargin, OuterEdge, InnerEdge ; + +% see typo-ada.* + +newscriptindex mfid_AdaptiveWidth ; mfid_AdaptiveWidth := scriptindex "AdaptiveWidth" ; vardef AdaptiveWidth = runscript mfid_AdaptiveWidth enddef ; +newscriptindex mfid_AdaptiveHeight ; mfid_AdaptiveHeight := scriptindex "AdaptiveHeight" ; vardef AdaptiveHeight = runscript mfid_AdaptiveHeight enddef ; +newscriptindex mfid_AdaptiveDepth ; mfid_AdaptiveDepth := scriptindex "AdaptiveDepth" ; vardef AdaptiveDepth = runscript mfid_AdaptiveDepth enddef ; +newscriptindex mfid_AdaptiveThickness ; mfid_AdaptiveThickness := scriptindex "AdaptiveThickness" ; vardef AdaptiveThickness = runscript mfid_AdaptiveThickness enddef ; +newscriptindex mfid_AdaptiveColor ; mfid_AdaptiveColor := scriptindex "AdaptiveColor" ; vardef AdaptiveColor = runscript mfid_AdaptiveColor enddef ; + +immutable % permanent + AdaptiveWidth, AdaptiveHeight, AdaptiveDepth, AdaptiveThickness, AdaptiveColor ; diff --git a/metapost/context/base/mpxl/mp-tool.mpxl b/metapost/context/base/mpxl/mp-tool.mpxl index d99439c5b..749f3d657 100644 --- a/metapost/context/base/mpxl/mp-tool.mpxl +++ b/metapost/context/base/mpxl/mp-tool.mpxl @@ -3932,15 +3932,30 @@ permanent hatched ; numeric mfun_dash_on, mfun_dash_off ; +% primarydef p withdashes len = +% hide ( +% save l, t, n, m ; pair t ; +% l := arclength p ; +% t := paired(len) ; +% m := xpart t + ypart t ; +% n := l / (l div m) / m ; +% mfun_dash_on := n * xpart t ; +% mfun_dash_off := n * ypart t ; +% ) +% p dashed dashpattern (on mfun_dash_on off mfun_dash_off) +% enddef ; + primarydef p withdashes len = hide ( - save l, t, n, m ; pair t ; + save l, t, n, m, don, doff; pair t ; l := arclength p ; - t := paired(len) ; + t := paired (len) ; m := xpart t + ypart t ; - n := l / (l div m) / m ; - mfun_dash_on := n * xpart t ; - mfun_dash_off := n * ypart t ; + n := (l if not cycle p : - xpart t fi) div m ; + (n if not cycle p : + 1 fi) * don + n * doff = l ; + don*(ypart t) = doff*(xpart t) ; + mfun_dash_on := don ; + mfun_dash_off := doff ; ) p dashed dashpattern (on mfun_dash_on off mfun_dash_off) enddef ; @@ -3952,6 +3967,10 @@ permanent withdashes ; path mfun_b ; pair mfun_k ; +tertiarydef p sortedintersectiontimes q = + sortedpath (p intersectiontimeslist q) +enddef ; + tertiarydef p intersectionpath q = begingroup ; save mfun_b ; path mfun_b ; mfun_b := sortedpath (p intersectiontimeslist q) ; -- cgit v1.2.3