Chapter 6. Font Rendering

In this chapter, we will cover the following recipes:

  • Generating and rendering bitmap fonts
  • Baking effects into fonts using Hiero
  • Scaling friendly font rendering with distance fields
  • Dynamic font effects using distance fields

Introduction

Depending on the genre of your awesome game project, you may need to show the user more or less text. Role-playing games and some adventures tend to be very text-heavy, while action games … well, they let the guns do the talking. However, in all likeness, all of these will require some font rendering, even if it is just for the menus or the game scores.

This chapter will start with the very basics of how to generate a Libgdx-compatible font and render some text with it on the screen. We will ...

Get Libgdx Cross-platform Game Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.