# TTF\_SetFontHinting question

**URL:** <https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299>\
**Category:** SDL Development\
**Created:** [January 6, 2022, 6:06pm UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299 "2022-01-06T18:06:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtrussell](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/rtrussell/32/4768_2.png) [@rtrussell](https://discourse.libsdl.org/u/rtrussell)\
**Post date:** [January 6, 2022, 6:06pm UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299/1 "2022-01-06T18:06:22Z")

</div>

I don’t entirely understand why `TTF_SetFontHinting()` is having the effect it is, and I wonder whether I’m doing something wrong.

Here are the results I’m getting from the four hinting types (NORMAL, LIGHT, MONO and NONE) for three different fonts. In each case TTF\_HINTING\_LIGHT is giving subjectively identical results to TTF\_HINTING\_NONE, which is not what I would have expected:

![font_hinting](https://discourse.libsdl.org/uploads/default/original/2X/a/ab98a2b02946d9b03633ccac3d4e2444104e7623.png)

---

<div class="post-metadata">

**Author:** ![Sylvain\_Becker](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sylvain\_Becker](https://discourse.libsdl.org/u/Sylvain_Becker)\
**Post date:** [January 6, 2022, 7:36pm UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299/2 "2022-01-06T19:36:31Z")

</div>

This is the description of FreeType’s hinting :

> <https://github.com/libsdl-org/SDL_ttf/blob/main/external/freetype-2.10.4/include/freetype/freetype.h#L3051>

Which should be used with a FreeType render mode:

> <https://github.com/libsdl-org/SDL_ttf/blob/main/external/freetype-2.10.4/include/freetype/freetype.h#L3201>

If you use the \*Solid function, SDL\_ttf picks FT\_RENDER\_MODE\_MONO, otherwise it uses FT\_RENDER\_MODE\_NORMAL.

---

<div class="post-metadata">

**Author:** ![rtrussell](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/rtrussell/32/4768_2.png) [@rtrussell](https://discourse.libsdl.org/u/rtrussell)\
**Post date:** [January 6, 2022, 10:16pm UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299/3 "2022-01-06T22:16:18Z")

</div>

> [@Sylvain\_Becker](#):
>
> If you use the \*Solid function, SDL\_ttf picks FT\_RENDER\_MODE\_MONO, otherwise it uses FT\_RENDER\_MODE\_NORMAL.

I’m always using `TTF_RenderUNICODE_Blended()`, the differences I’m seeing are from changing the `TTF_SetFontHinting()` mode and nothing else.

Does it not surprise you that TTF\_HINTING\_LIGHT and TTF\_HINTING\_NONE seem to be giving identical results?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Becker](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sylvain\_Becker](https://discourse.libsdl.org/u/Sylvain_Becker)\
**Post date:** [January 7, 2022, 7:30am UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299/4 "2022-01-07T07:30:47Z")

</div>

@rtrussell if you zoom in, with some graphic editor, you can see some small difference in gray values even between light and none. This is the hinting !

---

<div class="post-metadata">

**Author:** ![rtrussell](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/rtrussell/32/4768_2.png) [@rtrussell](https://discourse.libsdl.org/u/rtrussell)\
**Post date:** [January 7, 2022, 9:40am UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299/5 "2022-01-07T09:40:04Z")

</div>

> [@Sylvain\_Becker](#):
>
> if you zoom in, with some graphic editor, you can see some small difference in gray values even between light and none.

Indeed there are small differences, here is an animated GIF for comparison:

![font_hinting_compare](https://discourse.libsdl.org/uploads/default/original/2X/0/0801633e0b492db2dbd9baaa5682588702945ad0.gif)  
But given that the [documentation](https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf_57.html) says: “the font may become very blurry or messy at smaller sizes” I would have expected a much greater difference. And it surprises me that TTF\_HINTING\_NONE is most similar to LIGHT rather than NORMAL.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Becker](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sylvain\_Becker](https://discourse.libsdl.org/u/Sylvain_Becker)\
**Post date:** [January 7, 2022, 10:28am UTC](https://discourse.libsdl.org/t/ttf-setfonthinting-question/34299/6 "2022-01-07T10:28:17Z")

</div>

this is what suggests the freetype documentation:

> Many generated glyphs are fuzzier but better resemble their original shape.

So _Light_ looks like _None_.  
Then, there is _normal_ which is optimized for standard gray-level rendering.

```auto
   * FT_LOAD_TARGET_NORMAL ::
   * The default hinting algorithm, optimized for standard gray-level
   * rendering. For monochrome output, use @FT_LOAD_TARGET_MONO instead.
   *
   * FT_LOAD_TARGET_LIGHT ::
   * A lighter hinting algorithm for gray-level modes. Many generated
   * glyphs are fuzzier but better resemble their original shape. This
   * is achieved by snapping glyphs to the pixel grid only vertically
   * (Y-axis), as is done by FreeType's new CFF engine or Microsoft's
   * ClearType font renderer. This preserves inter-glyph spacing in
   * horizontal text. The snapping is done either by the native font
   * driver, if the driver itself and the font support it, or by the
   * auto-hinter.

```
