[racket] Interpretation of font information

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sun Nov 17 12:56:46 EST 2013

2013/11/17 Matthew Flatt <mflatt at cs.utah.edu>:
> 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.

Thanks for the tip. I thought "combine" affected the width only.

--
Jens Axel Søgaard


Posted on the users mailing list.