惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
T
Troy Hunt's Blog
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
V
V2EX
I
InfoQ
量子位
Hugging Face - Blog
Hugging Face - Blog
The Register - Security
The Register - Security
J
Java Code Geeks
V
Visual Studio Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
爱范儿
爱范儿
Hacker News: Ask HN
Hacker News: Ask HN
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
V2EX - 技术
V2EX - 技术
罗磊的独立博客
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
IT之家
IT之家
O
OpenAI News
W
WeLiveSecurity
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
The Hacker News
The Hacker News
Attack and Defense Labs
Attack and Defense Labs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
雷峰网
雷峰网
Scott Helme
Scott Helme
B
Blog RSS Feed
有赞技术团队
有赞技术团队
Recent Announcements
Recent Announcements
L
LangChain Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog
Help Net Security
Help Net Security
NISL@THU
NISL@THU
A
About on SuperTechFans
L
LINUX DO - 最新话题
博客园 - 司徒正美
博客园 - 聂微东
博客园 - 三生石上(FineUI控件)
Spread Privacy
Spread Privacy
P
Proofpoint News Feed

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
5x5 Pixel Font for Tiny Screens: The Complete Developer Guide to Micro Typography
佐藤玲 · 2026-04-24 · via DEV Community

5x5 Pixel Font for Tiny Screens: The Complete Developer Guide to Micro Typography

You're staring at a 128×64 OLED display, a tiny e-ink badge, or a retro game screen — and suddenly you realize your fancy TrueType font is completely useless. You need every pixel to count.

Welcome to the world of the 5×5 pixel font: the unsung hero of embedded development, retro gaming, and wearable tech. In this guide, we'll break down everything you need to know — from the theory behind micro typography to rendering your own characters in code.


Why a 5×5 Pixel Font?

When working with tiny screens — think SSD1306 OLEDs, Nokia 5110 LCDs, or even low-resolution LED matrix panels — standard fonts simply don't fit. A typical 8×8 bitmap font already feels large on a 32-pixel-tall display. A 5×5 font gives you:

  • More characters per line — on a 128-pixel-wide screen, you can fit ~25 characters vs. ~16 with an 8×8 font
  • More lines per screen — critical for data-dense UIs like sensor dashboards
  • Retro aesthetic — perfect for indie games, pixel art tools, and demoscene projects
  • Minimal memory footprint — each glyph fits in as few as 3–5 bytes

The tradeoff? Readability is a craft. Every pixel decision is intentional, and designing or choosing the right 5×5 font requires understanding the constraints deeply.


Anatomy of a 5×5 Glyph

A 5×5 pixel font means each character fits inside a 5-column by 5-row grid. With a 1-pixel gap added between characters, you effectively work with a 6×5 cell per character in horizontal layout.

Here's what the letter A might look like in a 5×5 grid:

. X X X .
 X . . . X
 X X X X X
 X . . . X
 X . . . X

Enter fullscreen mode Exit fullscreen mode

Translated to binary rows (1 = lit pixel, 0 = dark):

Row 0: 0 1 1 1 0  → 0x0E
Row 1: 1 0 0 0 1  → 0x11
Row 2: 1 1 1 1 1  → 0x1F
Row 3: 1 0 0 0 1  → 0x11
Row 4: 1 0 0 0 1  → 0x11

Enter fullscreen mode Exit fullscreen mode

This gives us a compact 5-byte representation per glyph — incredibly efficient for microcontrollers with limited flash storage.


Storing the Font in Code

Let's look at how to store a basic 5×5 font in C, suitable for Arduino, STM32, or any embedded platform.

// Each character is stored as 5 bytes (one per row)
// Bit 4 (MSB of 5-bit value) = leftmost pixel

const uint8_t font5x5[][5] = {
  // Space (ASCII 32)
  { 0x00, 0x00, 0x00, 0x00, 0x00 },
  // ! (ASCII 33)
  { 0x04, 0x04, 0x04, 0x00, 0x04 },
  // A (ASCII 65)
  { 0x0E, 0x11, 0x1F, 0x11, 0x11 },
  // B (ASCII 66)
  { 0x1E, 0x11, 0x1E, 0x11, 0x1E },
  // C (ASCII 67)
  { 0x0F, 0x10, 0x10, 0x10, 0x0F },
  // ... continue for full ASCII range
};

Enter fullscreen mode Exit fullscreen mode

To render a character at position (x, y) on a pixel buffer:

void draw_char(uint8_t *framebuffer, int fb_width, char c, int x, int y, uint8_t color) {
  int idx = c - 32; // offset from ASCII space
  for (int row = 0; row < 5; row++) {
    uint8_t row_data = font5x5[idx][row];
    for (int col = 0; col < 5; col++) {
      if (row_data & (0x10 >> col)) {
        int px = x + col;
        int py = y + row;
        framebuffer[py * fb_width + px] = color;
      }
    }
  }
}

void draw_string(uint8_t *fb, int fb_width, const char *str, int x, int y, uint8_t color) {
  while (*str) {
    draw_char(fb, fb_width, *str++, x, y, color);
    x += 6; // 5px glyph + 1px spacing
  }
}

Enter fullscreen mode Exit fullscreen mode

This is clean, portable, and works on any device where you can write pixels to a buffer.


Python Example for Prototyping

Before burning code to hardware, prototype your font rendering in Python with Pillow:

from PIL import Image, ImageDraw

font5x5 = {
    'A': [0x0E, 0x11, 0x1F, 0x11, 0x11],
    'B': [0x1E, 0x11, 0x1E, 0x11, 0x1E],
    'C': [0x0F, 0x10, 0x10, 0x10, 0x0F],
    ' ': [0x00, 0x00, 0x00, 0x00, 0x00],
}

def draw_string(text, scale=8):
    width = len(text) * 6 * scale
    height = 5 * scale
    img = Image.new('1', (width, height), 0)
    draw = ImageDraw.Draw(img)

    for i, char in enumerate(text):
        glyph = font5x5.get(char, font5x5[' '])
        for row, row_data in enumerate(glyph):
            for col in range(5):
                if row_data & (0x10 >> col):
                    x = (i * 6 + col) * scale
                    y = row * scale
                    draw.rectangle([x, y, x+scale-1, y+scale-1], fill=1)
    return img

img = draw_string("ABC")
img.save("font_preview.png")

Enter fullscreen mode Exit fullscreen mode

Run this to generate a scaled-up preview PNG — great for validating your glyph designs before deploying to tiny screens.


Designing Your Own 5×5 Glyphs

If the existing open-source fonts don't match your aesthetic, designing custom glyphs is a satisfying challenge. Here are the key rules:

1. Prioritize Legibility Over Style

At 5 pixels tall, optical illusions are real. What looks balanced in your head may appear lopsided on screen. Always test on the actual hardware or a 1:1 preview.

2. Use Consistent Stroke Width

Most successful 5×5 fonts use a 1-pixel stroke throughout. Two-pixel strokes are possible for bold variants but leave very little negative space.

3. Leverage the Center Row

The middle row (row 2) is your anchor. Characters like E, F, H, and B rely on it heavily. Plan your glyph from the center outward.

4. Numbers Need Special Attention

Digits 0–9 in a 5×5 font are tricky — especially 8 and 3. Consider if your use case is data-heavy (clocks, sensors) and optimize numbers first.

5. Avoid Isolated Single Pixels

A lone lit pixel surrounded by darkness reads as noise, not detail. Every pixel should connect to at least one neighbor — vertically, horizontally, or diagonally.


Notable Open-Source 5×5 Fonts

Before rolling your own, check these battle-tested options:

  • Tom Thumb — One of the most downloaded micro fonts. Designed specifically for tiny screens. Available as a BDF file and easily converted.
  • Mx5x5 — Clean proportional font used in several embedded UI libraries.
  • Pico-8 Font — The built-in font from the PICO-8 fantasy console. 4×6 cells but 5 pixel tall characters — widely cloned and modified.
  • u8g2 library fonts — The u8g2 graphics library ships with a massive collection of bitmap fonts including several 5-pixel-height variants, ready to use on Arduino and ESP32.

Real-World Use Cases

Wearable Displays

Smartwatch DIY projects on tiny 80×160 or 96×64 TFT screens depend on compact fonts. A 5×5 font lets you display heart rate, steps, and time simultaneously without scrolling.

Retro Game Development

Building a game for the Game Boy-style or PICO-8? The 5×5 pixel font fits naturally into 8×8 tile grids and gives your UI a classic feel. pixel art game dev courses often cover custom font design as a foundational skill.

IoT Sensor Dashboards

An ESP32 with a 128×32 OLED showing temperature, humidity, and RSSI needs every pixel. With a 5×5 font and 1px line spacing, you fit 5 lines of 20 characters — more than enough.

LED Matrix Panels

Scrolling text on a 32×8 LED matrix? A 5×5 font with smooth column-by-column scrolling is the standard approach in clock and sign projects worldwide.


Performance Tips for Embedded Rendering

  • Store font data in PROGMEM (Arduino) or flash-mapped memory to avoid eating your tiny RAM budget
  • Cache rendered strings as bitmaps when content doesn't change frame-to-frame
  • Use dirty rectangle tracking — only re-render regions of the screen that changed
  • Precompute character offsets into the font table if you're doing frequent random access
// Arduino PROGMEM example
const uint8_t font5x5[][5] PROGMEM = {
  { 0x0E, 0x11, 0x1F, 0x11, 0x11 }, // A
  // ...
};

// Reading with pgm_read_byte
uint8_t row_data = pgm_read_byte(&font5x5[idx][row]);

Enter fullscreen mode Exit fullscreen mode

This single change can save hundreds of bytes of RAM on an ATmega328 — critical when your total SRAM is only 2KB.


Accessibility Considerations

It's worth acknowledging: 5×5 fonts are not accessible by default. They are purposeful tools for constrained environments, not a first choice for general UIs. If your hardware can support larger text, do it. Reserve 5×5 for situations where the screen physically cannot accommodate anything bigger.

For mixed-size UIs, consider using 5×5 for secondary data (labels, units) and a larger font (8×8 or proportional) for primary values. embedded UI design toolkits like LVGL support multi-font layouts even on resource-constrained hardware.


Wrapping Up

The 5×5 pixel font is one of those elegant engineering constraints that forces creativity. With just 25 pixels, you craft something readable, functional, and often beautiful. Whether you're building a retro game, a wearable sensor node, or an IoT display dashboard, mastering micro typography is a skill that pays dividends every time you stare at a tiny screen.

Key takeaways:

  • Store glyphs as 5-byte row arrays for maximum efficiency
  • Add 1px character spacing for readability
  • Test on real hardware or 1:1 scale previews early
  • Use PROGMEM/flash storage on microcontrollers
  • Start with open-source fonts like Tom Thumb before designing your own

If you found this useful, follow me here on DEV for more embedded systems, graphics programming, and hardware hacking content. Got a 5×5 font you've built or a project using micro typography? Drop it in the comments — I'd love to see what you're working on.