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

<<attachment: draw-text.png>>

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Reply via email to