The current implementation does not handle non-default :align keywords properly except when an +identity-transformation+ is in effect. This can be fixed simply by moving the transform-position form up before the (unlesss (and (eq align-x... ) stuff as shown below.
(multiple-value-bind (x y) (transform-position merged-transform x y) (unless (and (eq align-x :left) (eq align-y :baseline)) (setq x (- x (ecase align-x (:left 0) (:center (round text-width 2)) ; worst case (:right text-width)))) ; worst case (setq y (ecase align-y (:top (+ y baseline)) ; OK (:baseline y) ; OK (:center (+ y baseline (- (floor text-height 2)))) ; change (:bottom (+ y baseline (- text-height)))))) ; change (xlib:draw-glyphs mi gc (truncate (+ x 0.5)) (truncate (+ y 0.5)) string :start start :end end :translate #'translate :size 16))))))