summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-08-24 02:40:00 +0200
committerHans Hagen <pragma@wxs.nl>2013-08-24 02:40:00 +0200
commit710bc1b1db31b0d14c37c85922350b2b47a8bf8c (patch)
tree2534f0aa26ce392e8665154578f78c400fc6889f /metapost
parentd1ee576345717d670c5ee5297222fab3a38762dc (diff)
downloadcontext-710bc1b1db31b0d14c37c85922350b2b47a8bf8c.tar.gz
beta 2013.08.24 02:40
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-mlib.mpiv31
-rw-r--r--metapost/context/base/mp-tool.mpii13
-rw-r--r--metapost/context/base/mp-tool.mpiv13
3 files changed, 57 insertions, 0 deletions
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv
index e768efaec..81b09d6dc 100644
--- a/metapost/context/base/mp-mlib.mpiv
+++ b/metapost/context/base/mp-mlib.mpiv
@@ -264,6 +264,37 @@ vardef installlabel@# (expr type, x, y, offset) =
numeric labyf @# ; labyf @# := y ;
enddef ;
+% we save the plain variant
+
+vardef plain_thelabel@#(expr p,z) =
+ if string p :
+ plain_thelabel@#(rawtextext("\definedfont[" & defaultfont & "]" & p) scaled defaultscale,z)
+ else :
+ p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p + labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p))
+ fi
+enddef;
+
+def plain_label = % takes two arguments, contrary to textext that takes one
+ draw plain_thelabel
+enddef ;
+
+let mfun_label = label ;
+let mfun_thelabel = thelabel ;
+
+def useplainlabels =
+ let label = plain_label ;
+ let thelabel = plain_thelabel ;
+enddef ;
+
+def usemetafunlabels =
+ let label = mfun_label ;
+ let thelabel = mfun_thelabel ;
+enddef ;
+
+plain_compatibity_data := plain_compatibity_data & "save label, thelabel ;" & "useplainlabels ;" ;
+
+% next comes own own:
+
vardef thetextext@#(expr p,z) =
% interim labeloffset := textextoffset ;
if string p :
diff --git a/metapost/context/base/mp-tool.mpii b/metapost/context/base/mp-tool.mpii
index 8ec3fab9d..2819a1f66 100644
--- a/metapost/context/base/mp-tool.mpii
+++ b/metapost/context/base/mp-tool.mpii
@@ -98,6 +98,19 @@ vardef ddecimal primary p =
decimal xpart p & " " & decimal ypart p
enddef ;
+%D Plain compatibility
+
+string plain_compatibity_data ; plain_compatibity_data := "" ;
+
+def startplaincompatibity =
+ begingroup ;
+ scantokens plain_compatibity_data ;
+enddef ;
+
+def stopplaincompatibity =
+ endgroup ;
+enddef ;
+
% is now built in
% extra_endfig := extra_endfig
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv
index 10549468f..b47f5e8bf 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mp-tool.mpiv
@@ -64,6 +64,19 @@ vardef ddecimal primary p =
decimal xpart p & " " & decimal ypart p
enddef ;
+%D Plain compatibility:
+
+string plain_compatibity_data ; plain_compatibity_data := "" ;
+
+def startplaincompatibity =
+ begingroup ;
+ scantokens plain_compatibity_data ;
+enddef ;
+
+def stopplaincompatibity =
+ endgroup ;
+enddef ;
+
%D Colors:
newinternal nocolormodel ; nocolormodel := 1 ;