diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/asymptote/base/labelpath.asy |
Initial commit
Diffstat (limited to 'graphics/asymptote/base/labelpath.asy')
-rw-r--r-- | graphics/asymptote/base/labelpath.asy | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/graphics/asymptote/base/labelpath.asy b/graphics/asymptote/base/labelpath.asy new file mode 100644 index 0000000000..39c1908efd --- /dev/null +++ b/graphics/asymptote/base/labelpath.asy @@ -0,0 +1,28 @@ +usepackage("pstricks"); +usepackage("pst-text"); + +string LeftJustified="l"; +string RightJustified="r"; +string Centered="c"; + +void labelpath(frame f, Label L, path g, string justify=Centered, + pen p=currentpen) +{ + if(latex() && !pdf()) { + _labelpath(f,L.s,L.size,g,justify,(L.T.x,L.T.y+0.5linewidth(p)),p); + return; + } + warning("labelpathlatex","labelpath requires -tex latex"); +} + +void labelpath(picture pic=currentpicture, Label L, path g, + string justify=Centered, pen p=currentpen) +{ + pic.add(new void(frame f, transform t) { + labelpath(f,L,t*g,justify,p); + }); + frame f; + label(f,Label(L.s,L.size)); + real w=size(f).y+L.T.y+0.5linewidth(p); + pic.addBox(min(g),max(g),-w,w); +} |