[racket-dev] draw-text sensitive to scale when first called
Hello,
I'm seeing that if the first draw-text on a canvas is at a small scale
(0.1), then later draw-text calls at larger scales (1) show strange
character spacing (see attached image).
This can be worked around by passing #t as the combine? argument to
draw-text, but it seems some state is being shared between draw-text calls.
Does this happen for others? (I'm on Linux)
Thanks,
Dave
#lang racket/gui
(define (draw-screen canvas dc)
(define t (send dc get-transformation))
(send dc scale 0.1 0.1)
(send dc draw-text "small" 1000 1000)
(send dc set-transformation t)
(define t2 (send dc get-transformation))
(send dc translate (+ (/ 500 2)) (/ 500 2))
(send dc scale 1 1)
(send dc draw-text "0.0.0.0" 0 0 #f) ; change #f to #t to fix
(send dc set-transformation t2))
(define frame (new (class frame% (super-new))
(label "Test draw-text when scaled")))
(define canvas
(new canvas%
(parent frame)
(min-width 500)
(min-height 500)
(paint-callback draw-screen)
(style '(no-autoclear))))
(send frame show #t)
;(send (send canvas get-dc) draw-text "" 0 0) ; or uncomment to fix
-------------- next part --------------
A non-text attachment was scrubbed...
Name: draw-text.png
Type: image/png
Size: 7625 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20131205/927ede7d/attachment.png>