ESPHome’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/esphome/esphome.io/llms.txt
Use this file to discover all available pages before exploring further.
font component integrates directly with the display rendering engine and LVGL to give you full typographic control over how text appears on your screens. You can load any OpenType/TrueType (.ttf, .otf, .woff) font at any size, use fixed bitmap fonts (.bdf, .pcf), pull fonts directly from Google Fonts, or even embed Material Design icon glyphs alongside regular characters — all at compile time, with the resulting bitmaps stored in flash memory.
Minimal Example
Configuration Variables
The font source. Can be:
- A local path relative to your YAML file:
"fonts/Roboto.ttf" - A Google Fonts shorthand:
"gfonts://Roboto"or"gfonts://Material+Symbols+Outlined" - A web URL:
"https://example.com/font.ttf" - A structured object (see below for
local,gfonts, andwebtypes).
The ID used to reference this font in your display lambda (e.g.
id(font_20)).The desired font height in pixels. Defaults to
20 for scalable fonts. For bitmap fonts, must match an available size in the file.Bits per pixel for anti-aliasing. Values:
1 (no anti-aliasing, default), 2, 4, 8. Higher values produce smoother text but use more flash and require specifying background color when drawing.Additional characters to include, beyond the default glyph set. Accepts single characters, strings, or Unicode escape sequences. Reduce this list to save flash space.
Named glyph sets to include. Defaults to
GF_Latin_Kernel (basic ASCII + punctuation). Options include GF_Latin_Core, GF_Cyrillic_Core, GF_Greek_Core, GF_Arabic_Core, and many more.Additional TrueType/OpenType files to pull specific glyphs from (e.g. icon fonts mixed into a text font). Each entry needs
file and glyphs.If
true, suppresses warnings for glyphs in glyphsets that are absent from the font file. Missing manually specified glyphs are always errors. Defaults to false.Font Source Types
Local File
Google Fonts (auto-downloaded and cached)
Web Font (downloaded at build time)
Bitmap Fonts (BDF / PCF)
Mixing Text and Icons
Useextras: to embed icon font glyphs at the same size as your text font. This lets you render icons inline with text in a single print() call.
For icon codepoints above
0xFFFF, use capital \U followed by exactly 8 hex digits (e.g. \U000F02D1). For codepoints up to 0xFFFF, use lowercase \u followed by exactly 4 hex digits.Anti-Aliasing
Higherbpp values produce smoother text but require specifying a background color when drawing so the renderer can blend correctly.
Glyph Sets for International Text
Reduce flash usage by loading only the character ranges you need. The defaultGF_Latin_Kernel covers basic ASCII.
Font Metrics API
Query font dimensions from lambdas for precise layout calculations.Advanced Example: Multi-Font Dashboard
The
pillow Python package must be installed for ESPHome to render font files at build time. It is pre-installed in the official ESPHome add-on and Docker images. For manual installs: pip install "pillow==10.4.0".