lemon/graph_to_eps.h
changeset 1492 0d58f0301923
parent 1435 8e85e6bbefdf
child 1494 ae55ba000ebb
equal deleted inserted replaced
0:444257c22ebc 1:6de2e40f2aa7
   773        << "         neg 2 div fosi .35 mul neg rmoveto show pop pop} def\n";
   773        << "         neg 2 div fosi .35 mul neg rmoveto show pop pop} def\n";
   774 
   774 
   775     os << "\ngsave\n";
   775     os << "\ngsave\n";
   776     if(_scaleToA4)
   776     if(_scaleToA4)
   777       if(bb.height()>bb.width()) {
   777       if(bb.height()>bb.width()) {
   778 	double sc= min((A4HEIGHT-2*A4BORDER)/bb.height(),
   778 	double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.height(),
   779 		  (A4WIDTH-2*A4BORDER)/bb.width());
   779 		  (A4WIDTH-2*A4BORDER)/bb.width());
   780 	os << ((A4WIDTH -2*A4BORDER)-sc*bb.width())/2 + A4BORDER << ' '
   780 	os << ((A4WIDTH -2*A4BORDER)-sc*bb.width())/2 + A4BORDER << ' '
   781 	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER << " translate\n"
   781 	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.height())/2 + A4BORDER << " translate\n"
   782 	   << sc << " dup scale\n"
   782 	   << sc << " dup scale\n"
   783 	   << -bb.left() << ' ' << -bb.bottom() << " translate\n";
   783 	   << -bb.left() << ' ' << -bb.bottom() << " translate\n";
   784       }
   784       }
   785       else {
   785       else {
   786 	//\todo Verify centering
   786 	//\todo Verify centering
   787 	double sc= min((A4HEIGHT-2*A4BORDER)/bb.width(),
   787 	double sc= std::min((A4HEIGHT-2*A4BORDER)/bb.width(),
   788 		  (A4WIDTH-2*A4BORDER)/bb.height());
   788 		  (A4WIDTH-2*A4BORDER)/bb.height());
   789 	os << ((A4WIDTH -2*A4BORDER)-sc*bb.height())/2 + A4BORDER << ' '
   789 	os << ((A4WIDTH -2*A4BORDER)-sc*bb.height())/2 + A4BORDER << ' '
   790 	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER  << " translate\n"
   790 	   << ((A4HEIGHT-2*A4BORDER)-sc*bb.width())/2 + A4BORDER  << " translate\n"
   791 	   << sc << " dup scale\n90 rotate\n"
   791 	   << sc << " dup scale\n90 rotate\n"
   792 	   << -bb.left() << ' ' << -bb.top() << " translate\n";	
   792 	   << -bb.left() << ' ' << -bb.top() << " translate\n";