anchor.diff:  (defclass typeface ()
     ((%font-loader :initarg :font-loader :reader font-loader)
      (%name :initarg :name :reader name)
  -   (%lock :reader typeface-lock)
  -   (%refcount :initform 1)))
  +   (%lock :reader typeface-lock)))
   
   (defmethod initialize-instance :after ((instance typeface) &key &allow-other-keys)
     (setf (slot-value instance '%lock) (mezzano.supervisor:make-mutex (format nil "Typeface ~A lock" (name instance)))))
  
positive.code:   (let* ((typeface-key (string-downcase name))
           (font-key (cons typeface-key (float size))))
      (mezzano.supervisor:with-mutex (*font-lock*)
        (let ((font (gethash font-key *font-cache*)))
          (when font
            (incf (slot-value font '%refcount))
            (return-from open-font font))
          ;; No font object, create a new one.
          (let ((typeface (gethash typeface-key *typeface-cache*)))
            (when typeface
              (incf (slot-value typeface '%refcount))
              (setf font (make-instance 'font
                                        :typeface typeface
                                        :size (float size))
                    (gethash font-key *font-cache*) font)
              #+(or)(format t "Creating new font ~S with typeface ~S.~%" font typeface)
              (return-from open-font font)))))
      ;; Neither font nor typeface in cache. Open the TTF outside the lock
      ;; to signalling lock held.
      (let ((loader (zpb-ttf:open-font-loader (find-font name))))
        (mezzano.supervisor:with-mutex (*font-lock*)
          ;; Repeat font test.
          (let ((font (gethash font-key *font-cache*)))
            (when font
              (incf (slot-value font '%refcount))
              (return-from open-font font)))
          (let ((typeface (gethash typeface-key *typeface-cache*)))
            (cond (typeface
                   ;; A typeface was created for this font while the lock
                   ;; was dropped. Forget our font loader and use this one.
                   (zpb-ttf:close-font-loader loader)
                   (incf (slot-value typeface '%refcount)))
                  (t (setf typeface (make-instance 'typeface :name (format nil "~:(~A~)" name) :font-loader loader)
                           (gethash typeface-key *typeface-cache*) typeface)
                     #+(or)(format t "Creating new typeface ~S.~%" typeface)))
            (let ((font (make-instance 'font
                                       :typeface typeface
                                       :size (float size))))
              #+(or)(format t "Creating new font ~S with typeface ~S.~%" font typeface)
              (setf (gethash font-key *font-cache*) font)
              font))))))
  
  (defun close-font (font)
    (mezzano.supervisor:with-mutex (*font-lock*)
      (decf (slot-value font '%refcount))
      (when (zerop (slot-value font '%refcount))
        ;; Flush this font, and release the typeface.
        (remhash (cons (string-downcase (name font)) (size font)) *font-cache*)
        (let ((typeface (typeface font)))
          (decf (slot-value typeface '%refcount))
          (when (zerop (slot-value typeface '%refcount))
            (remhash (string-downcase (name font)) *typeface-cache*))))))
  
  (defmacro with-font ((font name size) &body body)
    `(let (,font)
      (unwind-protect
           (progn
             (setf ,font (open-font ,name ,size))
             ,@body)
        (when ,font
          (close-font ,font)))))
  
negative.code: (defvar *font-lock* (mezzano.supervisor:make-mutex "Font lock")
    "Lock protecting the typeface and font caches.")
  
  ;; TODO: Replace these when weak hash-tables are implemented.
  ;; font-name (lowercase) -> [weak-pointer typeface]
  (defvar *typeface-cache* (make-hash-table :test 'equal))
  ;; (lowercase font name . single-float size) -> [weak-pointer font]
  (defvar *font-cache* (make-hash-table :test 'equal))
  
  (defun path-map-line (path function)
  