- changed text-center-pos to respect the rectangle's origin

This commit is contained in:
frese 2005-01-16 17:19:19 +00:00
parent 0f7e0eb189
commit 613eb1fe8d
1 changed files with 3 additions and 2 deletions

View File

@ -400,8 +400,9 @@
(define (text-center-pos rect font-struct str)
(let* ((cs (text-extents font-struct str))
(tw (char-struct:width cs)))
(cons (floor* (/ (- (rectangle:width rect) tw) 2))
(+ (floor* (/ (rectangle:height rect) 2))
(cons (+ (rectangle:x rect) (floor* (/ (- (rectangle:width rect) tw) 2)))
(+ (rectangle:y rect)
(floor* (/ (rectangle:height rect) 2))
(font-struct:descent font-struct)))))
;; maximize-window moves and resizes the window fill as much space of