draw icon indicating copy to clipboard operation
draw copied to clipboard

Odd baseline for text drawn with `'swiss` on when that means Nimbus Sans

Open samth opened this issue 3 years ago • 1 comments

When I render the following 2htdp/image expression:

(overlay (text "3" 120 "yellow") (square 120 "solid" "dark brown"))

I get a picture that looks like this: untitled

Note that it's not centered. If an actual Helvetica font is used, it produces a centered 3. Also if I use some other font like 'default, it works correctly: untitled2

To understand why, consider this program:

  (require racket/draw)
  (define text-sizing-bm (make-object bitmap-dc% (make-object bitmap% 1 1)))
  (define ft (send the-font-list find-or-create-font 120 'swiss 'normal 'normal #f 'default #t))
  (send text-sizing-bm get-text-extent "3" ft)

This produces (values 67.0 121.0 33.0 0.0) on my machine but (values 67.0 139.0 27.0 0.0) on a different machine (thanks @ccshan) with Helvetica installed.

It's not clear to me what the bug is here but the drawing definitely seems wrong.

samth avatar Aug 26 '22 17:08 samth

Maybe it helps to mention that my machine has http://ftp.cs.stanford.edu/pub/Windows/HP/4550DN%20CD/FONTS/HELR45W.TTF installed whereas @samth's didn't.

ccshan avatar Aug 26 '22 18:08 ccshan