lemon/graph_to_eps.h
changeset 1930 92b70deed0c5
parent 1910 f95eea8c34b0
child 1936 0722ea2b0907
     1.1 --- a/lemon/graph_to_eps.h	Mon Jan 30 09:32:52 2006 +0000
     1.2 +++ b/lemon/graph_to_eps.h	Mon Jan 30 09:37:41 2006 +0000
     1.3 @@ -851,11 +851,17 @@
     1.4      
     1.5      if(_scaleToA4)
     1.6        os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
     1.7 -    else os << "%%BoundingBox: "
     1.8 -	    << bb.left()   * _scale - _xBorder << ' '
     1.9 -	    << bb.bottom() * _scale - _yBorder << ' '
    1.10 -	    << bb.right()  * _scale + _xBorder << ' '
    1.11 -	    << bb.top()    * _scale + _yBorder << '\n';
    1.12 +    else {
    1.13 +      //Rescale so that BoundingBox won't be neither to big nor too small.
    1.14 +      while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10;
    1.15 +      while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10;
    1.16 +    
    1.17 +      os << "%%BoundingBox: "
    1.18 +	 << int(floor(bb.left()   * _scale - _xBorder)) << ' '
    1.19 +	 << int(floor(bb.bottom() * _scale - _yBorder)) << ' '
    1.20 +	 << int(ceil(bb.right()  * _scale + _xBorder)) << ' '
    1.21 +	 << int(ceil(bb.top()    * _scale + _yBorder)) << '\n';
    1.22 +    }
    1.23      
    1.24      os << "%%EndComments\n";
    1.25