summaryrefslogtreecommitdiff
path: root/metapost/context/base/mpiv/mp-grph.mpiv
diff options
context:
space:
mode:
Diffstat (limited to 'metapost/context/base/mpiv/mp-grph.mpiv')
-rw-r--r--metapost/context/base/mpiv/mp-grph.mpiv69
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