summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-08-24 04:00:26 +0300
committerMarius <mariausol@gmail.com>2013-08-24 04:00:26 +0300
commit369306fd56a4ec12b2dd648fc398bdf7c1d05793 (patch)
tree27ededbef723a09dded6c5eeb511a1fa74aa7b27 /metapost
parentd2f353840917bc4f4036db4ca5028165d46b98b0 (diff)
downloadcontext-369306fd56a4ec12b2dd648fc398bdf7c1d05793.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 ;