(eval-when (:compile-toplevel :load-toplevel :execute)
  (require :asdf))

(defparameter *default-font-family-name* "xos4-terminus")

(defun update-map-for-face-with-name (map family name)
  (let ((current-face (getf map family)))
    (unless current-face
      (error "family ~A not found!" family))
    (substitute `(,name ,@(cdr current-face)) current-face map)))

(defmethod asdf:perform :after ((o asdf:load-op) (c (eql (asdf:find-system :clim-clx-user))))
  (eval `(defmethod initialize-instance :around ((port ,(intern "CLX-PORT" :clim-clx)) &rest args)
	   (setf (symbol-value (intern "*CLX-TEXT-FAMILY+FACE-MAP*" :clim-clx))
		 (update-map-for-face-with-name
		  (symbol-value (intern "*CLX-TEXT-FAMILY+FACE-MAP*" :clim-clx))
		  :fix *default-font-family-name*))
	   (apply #'call-next-method port args))))