summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-grph.mp2
-rw-r--r--metapost/context/base/mp-mlib.mp29
-rw-r--r--metapost/context/base/mp-text.mp8
-rw-r--r--metapost/context/base/mp-tool.mp6
4 files changed, 36 insertions, 9 deletions
diff --git a/metapost/context/base/mp-grph.mp b/metapost/context/base/mp-grph.mp
index 1ff2a9ec2..243b45318 100644
--- a/metapost/context/base/mp-grph.mp
+++ b/metapost/context/base/mp-grph.mp
@@ -94,7 +94,7 @@ enddef ;
def doloadfigure (expr filename) text figureattributes =
begingroup ;
save figurenumber, figurepicture, number, fixedplace ;
- numeric figurenumber ; figurenumber := 0 ;
+ numeric figurenumber ; figurenumber := 0 ;
boolean figureshift ; figureshift := true ;
picture figurepicture ; figurepicture := currentpicture ;
def number primary n = hide(figurenumber := n) enddef ;
diff --git a/metapost/context/base/mp-mlib.mp b/metapost/context/base/mp-mlib.mp
index 893222473..aeacb3e9c 100644
--- a/metapost/context/base/mp-mlib.mp
+++ b/metapost/context/base/mp-mlib.mp
@@ -36,10 +36,10 @@ vardef rawtextext(expr str) =
image (
_tt_n_ := _tt_n_ + 1 ;
_tt_p_ := image (
- draw _tt_p_ ;
+ addto currentpicture also _tt_p_ ;
addto currentpicture doublepath unitsquare withprescript "tf" withpostscript decimal _tt_n_ & ":" & str ;
) ;
- draw unitsquare withpen pencircle scaled 0 ;
+ addto currentpicture doublepath unitsquare withpen pencircle scaled 0 ;
)
else :
image (
@@ -68,8 +68,13 @@ labtype.urt := 6 ; labtype.llft := 7 ; labtype.lrt := 8 ;
labtype.d := 10 ; labtype.dlft := 11 ; labtype.drt := 12 ;
labtype.origin := 0 ; labtype.raw := 0 ;
-laboff.origin = (infinity,infinity) ; labxf.origin := 0 ; labyf.origin := 0 ;
-laboff.raw = (infinity,infinity) ; labxf.raw := 0 ; labyf.raw := 0 ;
+% laboff.origin = (infinity,infinity) ; labxf.origin := 0 ; labyf.origin := 0 ;
+% laboff.raw = (infinity,infinity) ; labxf.raw := 0 ; labyf.raw := 0 ;
+
+% todo: thelabel.origin("xxxx",origin) (overflows)
+
+laboff.origin = (0,0) ; labxf.origin := 0 ; labyf.origin := 0 ;
+laboff.raw = (0,0) ; labxf.raw := 0 ; labyf.raw := 0 ;
pair laboff.l ; laboff.l = laboff.lft ;
pair laboff.r ; laboff.r = laboff.rt ;
@@ -131,7 +136,7 @@ vardef thetextext@#(expr p,z) = % adapted copy of thelabel@
if (labtype@# >= 10) : shifted (0,ypart center p) fi
shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p + labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p))
fi
-enddef;
+enddef ;
vardef textext@#(expr txt) =
interim labeloffset := textextoffset ;
@@ -161,7 +166,11 @@ vardef thelabel@#(expr s, z) =
enddef;
primarydef str infont name = % very naughty !
- textext("\definedfont[" & name & "]" & str)
+ if name = "" :
+ textext(str)
+ else :
+ textext("\definedfont[" & name & "]" & str)
+ fi
enddef ;
def circular_shade (expr p, n, ca, cb) =
@@ -252,9 +261,17 @@ def doexternalfigure (expr filename) text transformation =
draw unitsquare transformation withprescript "fg" withpostscript filename ;
enddef ;
+def register (expr label, width, height, offset) =
+ draw unitsquare xscaled width yscaled height shifted offset withprescript "ps" withpostscript label ;
+enddef ;
+
extra_beginfig := extra_beginfig & "currentgraphictext := 0 ; " ;
extra_endfig := extra_endfig & "finishsavingdata ; " ;
extra_endfig := extra_endfig & "resettextexts ; " ;
boolean cmykcolors ; cmykcolors := true ;
boolean spotcolors ; spotcolors := true ;
+
+vardef verbatim(expr str) =
+ ditto & "\detokenize{" & str & "}" & ditto
+enddef ;
diff --git a/metapost/context/base/mp-text.mp b/metapost/context/base/mp-text.mp
index 292b79b4f..a76458144 100644
--- a/metapost/context/base/mp-text.mp
+++ b/metapost/context/base/mp-text.mp
@@ -104,8 +104,8 @@ vardef textextstr(expr s, a) =
scantokens ss
enddef ;
-pair laboff.origin ; laboff.origin = (infinity,infinity) ;
-pair laboff.raw ; laboff.raw = (infinity,infinity) ;
+pair laboff.origin ; laboff.origin = (0,0) ; % (infinity,infinity) ;
+pair laboff.raw ; laboff.raw = (0,0) ; % (infinity,infinity) ;
vardef thelabel@#(expr s, z) =
save p ; picture p ;
@@ -259,3 +259,7 @@ def build_parshape (expr p, offset_or_path, dx, dy,
endgroup ;
enddef ;
+
+vardef verbatim(expr str) =
+ ditto & "\detokenize{" & str & "}" & ditto
+enddef ;
diff --git a/metapost/context/base/mp-tool.mp b/metapost/context/base/mp-tool.mp
index 817f237b0..3ba5923ea 100644
--- a/metapost/context/base/mp-tool.mp
+++ b/metapost/context/base/mp-tool.mp
@@ -1054,6 +1054,12 @@ enddef ;
let normaldraw = draw ;
let normalfill = fill ;
+% bugged in mplib so ...
+
+def normalfill expr c = addto currentpicture contour c _op_ enddef ;
+def normaldraw expr p = addto currentpicture if picture p: also p else: doublepath p withpen currentpen fi _op_ enddef ;
+
+
def drawlineoptions (text t) = def _lin_opt_ = t enddef ; enddef ;
def drawpointoptions (text t) = def _pnt_opt_ = t enddef ; enddef ;
def drawcontroloptions(text t) = def _ctr_opt_ = t enddef ; enddef ;