Skip to main content

Fonts and Text

Dear ImGui provides a powerful and flexible font system supporting TTF/OTF fonts, icon fonts, Unicode, and dynamic font sizing.
New in 1.92 (June 2025): Fonts now support dynamic sizing! You can change font size at runtime without pre-loading multiple sizes. Glyph ranges are also automatic with updated backends.

Quick Start

Using Default Font

Setting Base Font Size

Loading Custom Fonts

Basic Font Loading

Since 1.92 (with updated backend):
Before 1.92 (or without updated backend):

Loading Multiple Fonts

Using Fonts

Changing Active Font

Dynamic Font Sizing (1.92+)

Font size parameter changes in 1.92:
  • Before 1.92: PushFont(font) used the size passed to AddFontXXX()
  • Since 1.92: PushFont(font) requires explicit size parameter
  • Use PushFont(font, font->LegacySize) to match old behavior

Font Configuration

Advanced Font Options

Merging Fonts

Combine multiple fonts into one:

Unicode Support

Using Unicode Text

Since 1.92: You don’t need to specify glyph ranges anymore with updated backends! Glyphs are loaded on-demand automatically.

Loading Fonts with Specific Ranges (Pre-1.92)

Icon Fonts

Use icon fonts like FontAwesome for visual icons:

Setup

Using Icons

Common Icon Font Libraries

Loading Fonts from Memory

From Memory Buffer

Embedded Compressed Font

Font Atlas

Atlas Configuration

Atlas Flags

Text Rendering

Measuring Text Size

Colored Text

Wrapped Text

DPI Scaling

Global DPI Scale (1.92+)

Per-Platform Scaling

Troubleshooting

Debug Tools

Complete Example

Reference