Skip to content

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

@samth

Description

@samth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions