diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-06-08 10:23:49 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-06-08 10:23:49 +0200 |
commit | 86bfea5faac983d15c47eec27f43ec56e75c69ef (patch) | |
tree | 69a37851a9b8beeb625110f4fc51ff1ef188d7e4 /metapost/context/base/mpiv/mp-grph.mpiv | |
parent | c2d2236242c95f4753e7b197d576102c6fc20446 (diff) | |
download | context-86bfea5faac983d15c47eec27f43ec56e75c69ef.tar.gz |
2018-06-08 09:38:00
Diffstat (limited to 'metapost/context/base/mpiv/mp-grph.mpiv')
-rw-r--r-- | metapost/context/base/mpiv/mp-grph.mpiv | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/metapost/context/base/mpiv/mp-grph.mpiv b/metapost/context/base/mpiv/mp-grph.mpiv index 04d4920f6..2fc000b9d 100644 --- a/metapost/context/base/mpiv/mp-grph.mpiv +++ b/metapost/context/base/mpiv/mp-grph.mpiv @@ -128,33 +128,52 @@ picture mfun_gt_picture ; % this is the old version: -def old_graphictext primary t = - hide ( - if mfun_trial_run : - let mfun_graphic_text = mfun_no_graphic_text ; - else : - let mfun_graphic_text = mfun_do_graphic_text ; - fi - ) - mfun_graphic_text(t) -enddef ; +if mfun_use_one_pass : -def mfun_do_graphic_text (expr t) = - % withprescript "gt_stage=final" - begingroup ; - save figurepicture ; picture figurepicture ; - figurepicture := currentpicture ; currentpicture := nullpicture ; - currentgraphictext := currentgraphictext + 1 ; - mfun_finish_graphic_text % picks up directives -enddef ; + def old_graphictext primary t = + mfun_do_graphic_text(t) + enddef ; -def mfun_no_graphic_text (expr t) text rest = - currentgraphictext := currentgraphictext + 1 ; - draw unitsquare - withprescript "gt_stage=trial" - withprescript "gt_index=" & decimal currentgraphictext - withpostscript t -enddef ; + def mfun_do_graphic_text (expr t) = + begingroup ; + save figurepicture ; picture figurepicture ; + figurepicture := currentpicture ; currentpicture := nullpicture ; + currentgraphictext := currentgraphictext + 1 ; + lua.mp.GraphicText(currentgraphictext,t) ; + mfun_finish_graphic_text % picks up directives + enddef ; + +else : + + def old_graphictext primary t = + hide ( + if mfun_trial_run : + let mfun_graphic_text = mfun_no_graphic_text ; + else : + let mfun_graphic_text = mfun_do_graphic_text ; + fi + ) + mfun_graphic_text(t) + enddef ; + + def mfun_do_graphic_text (expr t) = + % withprescript "gt_stage=final" + begingroup ; + save figurepicture ; picture figurepicture ; + figurepicture := currentpicture ; currentpicture := nullpicture ; + currentgraphictext := currentgraphictext + 1 ; + mfun_finish_graphic_text % picks up directives + enddef ; + + def mfun_no_graphic_text (expr t) text rest = + currentgraphictext := currentgraphictext + 1 ; + draw unitsquare + withprescript "gt_stage=trial" + withprescript "gt_index=" & decimal currentgraphictext + withpostscript t + enddef ; + +fi ; def mfun_finish_graphic_text text rest = protectgraphicmacros ; % resets currentpicture |