summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/picture.cc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-05-28 02:18:52 +0000
committerKarl Berry <karl@freefriends.org>2011-05-28 02:18:52 +0000
commitc59fe5fe4739f0c61560f05d4e42b4e552219b27 (patch)
tree8cf79e85e394b3177a28d374415840a4e0a025ad /Build/source/utils/asymptote/picture.cc
parent771db15706dbf3f4af8b630dcb15646a3e5fda00 (diff)
asy 2.10
git-svn-id: svn://tug.org/texlive/trunk@22633 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/picture.cc')
-rw-r--r--Build/source/utils/asymptote/picture.cc76
1 files changed, 55 insertions, 21 deletions
diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc
index 3ebdf94e6db..dd2352d756b 100644
--- a/Build/source/utils/asymptote/picture.cc
+++ b/Build/source/utils/asymptote/picture.cc
@@ -241,6 +241,18 @@ void texinit()
} else {
if(!dir.empty())
cmd.push_back("-output-directory="+dir.substr(0,dir.length()-1));
+ if(getSetting<bool>("inlinetex")) {
+ string name=stripDir(stripExt((outname())));
+ size_t pos=name.rfind("-");
+ if(pos < string::npos) {
+ name=stripExt(name).substr(0,pos);
+ unlink((name+".aux").c_str());
+ cmd.push_back("-jobname="+name.substr(0,pos));
+#ifdef __CYGWIN__
+ cmd.push_back("NUL"); // For MikTeX
+#endif
+ }
+ }
cmd.push_back("\\scrollmode");
}
@@ -366,27 +378,48 @@ bool picture::texprocess(const string& texname, const string& outname,
bool first=true;
transform t=shift(bboxshift)*T;
bool shift=!t.isIdentity();
- string beginspecial="TeXDict begin @defspecial";
- string endspecial="@fedspecial end";
+
+ const string beginspecial="TeXDict begin @defspecial";
+ const size_t beginlength=beginspecial.size();
+ const string endspecial="@fedspecial end";
+ const size_t endlength=endspecial.size();
+
while(getline(fin,s)) {
- if(s.find("%%DocumentPaperSizes:") == 0) continue;
- if(s.find("%!PS-Adobe-") == 0) {
- fout.header();
- } else if(first && s.find("%%BoundingBox:") == 0) {
- bbox box=b;
- box.shift(bboxshift);
- if(verbose > 2) BoundingBox(cout,box);
- fout.BoundingBox(box);
- first=false;
- } else if(shift && s.find(beginspecial) == 0) {
- fout.verbatimline(s);
- fout.gsave();
- fout.concat(t);
- } else if(shift && s.find(endspecial) == 0) {
- fout.grestore();
- fout.verbatimline(s);
- } else
- fout.verbatimline(s);
+ if (s[0] == '%') {
+ if (s.find("%%DocumentPaperSizes:") == 0)
+ continue;
+
+ if(s.find("%!PS-Adobe-") == 0) {
+ fout.header();
+ continue;
+ }
+
+ if (first && s.find("%%BoundingBox:") == 0) {
+ bbox box=b;
+ box.shift(bboxshift);
+ if(verbose > 2) BoundingBox(cout,box);
+ fout.BoundingBox(box);
+ first=false;
+ continue;
+ }
+ }
+
+ if (shift) {
+ if (s.compare(0, beginlength, beginspecial) == 0) {
+ fout.verbatimline(s);
+ fout.gsave();
+ fout.concat(t);
+ continue;
+ }
+ if (s.compare(0, endlength, endspecial) == 0) {
+ fout.grestore();
+ fout.verbatimline(s);
+ continue;
+ }
+ }
+
+ // For the default line, output it unchanged.
+ fout.verbatimline(s);
}
}
if(!keep) {
@@ -430,6 +463,7 @@ int picture::epstopdf(const string& epsname, const string& pdfname)
cmd.push_back("-dMaxSubsetPct=100");
cmd.push_back("-dPDFSETTINGS=/prepress");
cmd.push_back("-dCompatibilityLevel=1.4");
+ cmd.push_back("-P");
if(safe)
cmd.push_back("-dSAFER");
if(!getSetting<bool>("autorotate"))
@@ -878,7 +912,7 @@ bool picture::shipout(picture *preamble, const string& Prefix,
}
if(status) {
if(xobject) {
- if(transparency)
+ if(pdf || transparency)
status=(epstopdf(prename,Outname(prefix,"pdf",standardout)) == 0);
} else {
if(context) prename=stripDir(prename);