# Question about text in 2htdp/image teachpack

**URL:** https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054
**Category:** Questions & Answers
**Created:** [December 23, 2025, 3:56am UTC](https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054 "2025-12-23T03:56:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![a-user](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@a-user](https://racket.discourse.group/u/a-user)
#### Post date: [December 23, 2025, 3:56am UTC](https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054/1 "2025-12-23T03:56:51Z")

</div>

In the documentation of `text` [here](https://docs.racket-lang.org/teachpack/2htdpimage.html#(def._((lib._2htdp%252Fimage..rkt)._text))), it says:

`The text size is measured in pixels, not points, so passing 24 to text should result in an image whose height is 24 (which might not be the case if the size were measured in points).`

But the documentation continues with an example where the result of `image-height` is larger than the `font-size` used in `text`.

> ([image-height](https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._image-height%29%29) ([text](https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._text%29%29) "Hello" 24 "olive"))  
> 25

Why is the result from `image-height` larger than the `font-size` argument?

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [December 23, 2025, 12:13pm UTC](https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054/2 "2025-12-23T12:13:08Z")

</div>

Does [Nitty Gritty](https://docs.racket-lang.org/teachpack/2htdpimage-guide.html#%28part._nitty-gritty%29) explain the delta?

---

<div class="post-metadata">

### Author: ![a-user](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@a-user](https://racket.discourse.group/u/a-user)
#### Post date: [December 24, 2025, 7:17am UTC](https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054/3 "2025-12-24T07:17:26Z")

</div>

I understand that when constructing a shape like `rectangle` with `outline` mode, that "additional" pixels will be added to draw the shape. `image-height` seems to know to return the image size without including the line pixels. E.g.

```scheme
> (define a-pen (make-pen "black" 4 "solid" "round" "round"))
> (define a-square (square 20 "outline" a-pen))
> (image-height a-square)
20

```

This much I understand. But if I specify a `text` with `font-size` 24, wouldn't that mean, to achieve height of 24 pixels, pixels from pixel 0 to pixel 23 be colored. In this case, wouldn't `image-height` return the value of `height` given to `text`, same as it returns the value when passed a `square` drawn with `outlne` mode?

```scheme
> (define a-text (text "hello" 24 "black"))
> (image-height a-text)
25

```

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/4e853055ae989ed00f69341cd98bee95980776c4.png) [@system](https://racket.discourse.group/u/system)
#### Post date: [December 29, 2025, 6:59am UTC](https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054/4 "2025-12-29T06:59:36Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/4e853055ae989ed00f69341cd98bee95980776c4.png) [@system](https://racket.discourse.group/u/system)
#### Post date: [December 29, 2025, 8:19am UTC](https://racket.discourse.group/t/question-about-text-in-2htdp-image-teachpack/4054/5 "2025-12-29T08:19:16Z")

</div>


