Text bounding box
Hi, Sometimes, the bounding box returned by gp:get-string-extent doesn't match the actual size of the drawn text. Is this expected behavior? (Could be due to kerning or other font stuff that I don't know enough about) Otherwise, is it a bug in GP/CAPI or in the underlying rendering system? I've only tested this on OS X so far, so I don't know yet if the problem is present on other platforms as well. Below is example code to reproduce the problem. Thanks Erik (defun display-output-pane (display-callback &rest args &key (visible-min-width 200) (visible-min-height 100) &allow-other-keys) (capi:contain (apply 'make-instance 'capi:output-pane :display-callback display-callback :input-model (list (list '(:button-1 :press) #'(lambda (pane x y) (declare (ignore x y)) (gp:invalidate-rectangle pane)))) args))) (defmacro with-output-pane ((sym &rest args) &body display-callback) `(display-output-pane (lambda (,sym &rest r) ,@display-callback) ,@args)) (with-output-pane (port) (loop for font-desc in (list (gp:make-font-description :family "Arial" :size 14 :weight :normal) (gp:make-font-description :family "Arial Narrow" :size 14 :weight :normal) (gp:make-font-description :family "Source Sans Pro" :size 12 :weight :light) (gp:make-font-description :family "Times New Roman" :size 14 :weight :normal :slant :italic)) with y = 10 do (let ((font (gp:find-best-font port font-desc)) (text "Synchronize now")) (multiple-value-bind (left top right bottom) (gp:get-string-extent port text font) (gp:draw-rectangle port (- 10 left) y (- right left) (- bottom top) :filled t :foreground :yellow) (gp:draw-string port text (- 10 left) (- y top) :font font) (incf y (+ (- bottom top) 10)))))) _______________________________________________ Lisp Hug - the mailing list for LispWorks users lisp-hug@lispworks.com http://www.lispworks.com/support/lisp-hug.html