lemon/graph_to_eps.h
changeset 1930 92b70deed0c5
parent 1910 f95eea8c34b0
child 1936 0722ea2b0907
equal deleted inserted replaced
16:77c09294d8e3 17:10f1eb9da5ea
   849       bb = BoundingBox<double>(xy<double>(0,0));
   849       bb = BoundingBox<double>(xy<double>(0,0));
   850     }
   850     }
   851     
   851     
   852     if(_scaleToA4)
   852     if(_scaleToA4)
   853       os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
   853       os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
   854     else os << "%%BoundingBox: "
   854     else {
   855 	    << bb.left()   * _scale - _xBorder << ' '
   855       //Rescale so that BoundingBox won't be neither to big nor too small.
   856 	    << bb.bottom() * _scale - _yBorder << ' '
   856       while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10;
   857 	    << bb.right()  * _scale + _xBorder << ' '
   857       while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10;
   858 	    << bb.top()    * _scale + _yBorder << '\n';
   858     
       
   859       os << "%%BoundingBox: "
       
   860 	 << int(floor(bb.left()   * _scale - _xBorder)) << ' '
       
   861 	 << int(floor(bb.bottom() * _scale - _yBorder)) << ' '
       
   862 	 << int(ceil(bb.right()  * _scale + _xBorder)) << ' '
       
   863 	 << int(ceil(bb.top()    * _scale + _yBorder)) << '\n';
       
   864     }
   859     
   865     
   860     os << "%%EndComments\n";
   866     os << "%%EndComments\n";
   861     
   867     
   862     //x1 y1 x2 y2 x3 y3 cr cg cb w
   868     //x1 y1 x2 y2 x3 y3 cr cg cb w
   863     os << "/lb { setlinewidth setrgbcolor newpath moveto\n"
   869     os << "/lb { setlinewidth setrgbcolor newpath moveto\n"