anchor.diff:                                                                   free-rects)))))
   
   (defun pack (dimensions &key width height)
  +  (labels ((largest-side (el)
  +             (max (second el) (third el)))
  +           (shortest-side (el)
  +             (min (second el) (third el)))
  +           (short-side-last ()
  +             (sort dimensions #'> :key #'shortest-side))
  +           (double-sorted-dimensions ()
  +             (sort (short-side-last) #'> :key #'largest-side)))
  +
     (loop with free-rects = (list (list 0 0 width height))
  -     for (id rect-width rect-height) in dimensions collect
  +     for (id rect-width rect-height) in (double-sorted-dimensions) collect
          (multiple-value-bind (rect new-free-rects)
              (place-rect rect-width rect-height free-rects)
            (setf free-rects new-free-rects)
  -         (with-rect (x y w h) rect
  -           (list id x y w h)))))
  +         (%with-rect (x y w h) rect
  +           (list id x y w h))))))
   
   
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
positive.code:              :scale 32
               :spread 0.1))
  
  
  
  #++
  (time
   (make-atlas "/tmp/atlas.pnm" "/tmp/font2.met"
               "/Library/Fonts/Arial.ttf" 48
               :scale 32
               :spread 0.1))
  
negative.code:                          min-rect))))
  
  (defun intersectsp (r0 r1)
    (%with-rect (x0 y0 w0 h0) r0
      (%with-rect (x1 y1 w1 h1) r1
        (and (< x0 (+ x1 w1))
             (> (+ x0 w0) x1)
             (< y0 (+ y1 h1))
  