U8x8 Fonts ((link))
The U8x8 font system is a specialized, text-only sub-component of the U8g2 graphics library designed for monochrome OLED and LCD displays. It is built for extreme efficiency, requiring virtually no microcontroller RAM because it writes directly to the display's hardware memory instead of maintaining a local frame buffer. Key Technical Features
Fixed Dimension: By default, each character in a U8x8 font is exactly 8x8 pixels.
Scaling Options: While based on 8x8 blocks, the library supports "large fonts" where glyph sizes are multiples of 8 (e.g., 2x3 fonts are 16x24 pixels).
Direct-to-Display: Characters are drawn to specific columns and rows. On a standard 128x64 display, this translates to a grid of 16 columns and 8 rows.
Zero RAM Overhead: Unlike graphics-heavy modes, U8x8 can be used on microcontrollers with very limited memory, such as the ATtiny series. Available Font Groups
Fonts in this library use a specific naming convention (prefixed with u8x8_) to distinguish them from standard U8g2 fonts. Common categories include: u8x8 fonts
Monospaced (m): All characters have identical width and height. Character Sets: f: Full set containing up to 256 glyphs. r: Basic ASCII range (codes 32 to 127). u: Uppercase characters only (codes 32 to 95). n: Numbers and symbols for date/time strings only. Essential API Commands
For developers using the library, these are the primary functions for handling text:
setFont(font) : Selects the active 8x8 font for subsequent text operations.
drawString(x, y, s) : Renders a text string s starting at column x and row y.
drawGlyph(x, y, char) : Draws a single character at the specified grid position. The U8x8 font system is a specialized, text-only
setInverseFont(mode) : Toggles between normal and inverted (white-on-black) text. Customization and Tools
If built-in fonts are insufficient, you can create or modify them using community tools:
Font Editors: The U8x8 Font Editor and Glyph Editor allow for manual design of 8x8 bitmapped characters.
bdfconv: A command-line tool used to convert standard BDF font sources into the compressed U8x8 format. Home · olikraus/u8g2 Wiki - GitHub
Pitfall 2: "Special characters (Ä, Ö, ß) show as garbage."
Cause: The font only includes ASCII 32-127. Extended characters require specific fonts with "extended" or "cyrillic" in the name.
Fix: Use u8x8_font_8x8_cyrillic or u8x8_font_cp437 for IBM Code Page 437 symbols. 1KB RAM for the buffer ~2KB Flash for
U8x8 vs. U8g2: Why Not Just Use Graphics?
A common beginner mistake is using U8g2 (graphics) for everything because it "can do more." However, U8g2 requires a framebuffer. On a 128x64 display, U8g2 consumes:
- 1KB RAM for the buffer
- ~2KB Flash for a proportional font
- Slower refresh rates (due to per-pixel drawing)
U8x8, by contrast:
- Uses 0 bytes of RAM for the buffer (writes directly to display pages)
- ~800 bytes Flash for an 8x8 font
- Extremely fast (writes characters at bus speed)
Verdict: If you are displaying text only — menus, debugging output, sensor readouts, terminal logs — U8x8 is always superior. If you need to draw circles, bitmaps, or graphs, you must use U8g2.
"I want bigger text."
Do not try to scale U8x8 fonts manually with loops. Use the pre-scaled versions (e.g., _2x2_r or _3x3_r) or use the u8x8.draw2x2String() function, which duplicates pixels for you.
3. The "Grid" System (8x8 Tiles)
U8x8 treats the screen as a grid of tiles.
- A standard u8x8 font character is 8 pixels wide and 8 pixels tall.
- When you use
u8x8.drawString(0, 0, "A"), you are not placing the character at pixel coordinate (0,0). You are placing it in Tile Column 0, Tile Row 0. - Example: On a 128x64 display:
- You have 16 columns (128 / 8).
- You have 8 rows (64 / 8).
- Coordinates for
drawStringmust be within these bounds (0-15 for x, 0-7 for y).
Real-World Applications of U8x8 Fonts
U8x8 Fonts Report
U8x8 vs U8g2 Fonts – When to Use Which?
| Feature | U8x8 Fonts | U8g2 Fonts | |------------------------|--------------------------|---------------------------| | Width | Fixed (monospaced) | Proportional (variable) | | Pixel size | Usually 8x8 or 8x16 | Any size (e.g., 6x10, 12x16) | | RAM buffer | None (direct render) | Required (full frame buffer) | | Speed | Very fast | Slower (more data) | | Graphics drawing | No (text only) | Yes (lines, circles, bitmaps) | | Display orientation | Fixed grid | Pixel-perfect positioning | | Typical use | Menus, logs, terminals | Graphics, mixed text/shapes |
Rule of thumb: Use U8x8 for text-heavy, low-memory projects. Use U8g2 when you need graphics or precise positioning.