[racket] Interpretation of font information

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Nov 16 21:06:18 EST 2013

At Fri, 15 Nov 2013 23:03:21 +0100, Jens Axel Søgaard wrote:
> Anyways, since pict-height didn't return the correct height, I tried:
>     (send (dc-for-text-size) get-text-extent "√" font))
> but I am not able to make sense of the results. For most fonts
> I get a height of 30, but others give the height 34 (a number that I didn't
> see from pict-height.
>
> [...]
>
> 2) Why are the numbers from pict-height and get-text-extent different?

Provide `#t` as the third argument to `get-text-extent` to enable
"combine" mode, which is what `text` uses by default.

Since there's only one character to measure, you might expect that
"combine" mode has no effect, but measuring for non-combine mode
triggers rounding that is intended to preserve pixel alignment. In your
examples, when the height was 34 in non-"combined" mode, the height was
between 33 and 34 in "combine" mode.



Posted on the users mailing list.