[racket-dev] draw-text sensitive to scale when first called
I've pushed a repair. Thanks for the report!
At Thu, 05 Dec 2013 16:08:45 -0500, David Vanderson wrote:
> 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
>
> ------------------------------------------------------------------------------
> [image/png "draw-text.png"] [~/Desktop & open] [~/Temp & open]
> .
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/dev