Achieving crisp VGA monochrome output and optimized fonts
In the previous experiment, I successfully displayed text using a Raspberry Pi Pico and the Adafruit DVI Breakout Board. However, with the default settings, the text appeared noticeably jagged, reducing readability.
This time, I challenged myself to see how far the original Pico (not Pico 2) can go in producing clean, readable text output. After experimenting—alongside suggestions from AI (Gemini)—I arrived at a balanced approach that preserves resources while dramatically improving visual quality.
1. Optimizing Resolution and Memory (VGA 640×480)
By intentionally switching to monochrome (1‑bit mode), I significantly reduced RAM usage on the RP2040. This freed memory allows the Pico to maintain a clear full‑screen VGA 640×480 buffer while still rendering text at high speed.
“白黒(1bitモード)に特化することで、RP2040の限られたRAMを節約。”
2. Font Size and the Magic of Bold Typefaces
Using the smallest fontsize=1 often results in thin, faint strokes on LCD monitors, making jaggies even more noticeable.
Limitations of the default Pico font
The commonly used built‑in font in Pico DVI examples is lightweight but visually rough. On VGA resolution, characters appear thin and pixelated.
3. Solution: Using FreeSansBold12pt7b
I adopted the proportional (variable‑width) bold font available in the Adafruit GFX library.
Why this font?
- Bold strokes stand out clearly even in 1‑bit monochrome mode.
- Curves and corners are well‑optimized, producing a far more readable and premium‑looking output compared to the default font.
“Boldなので、1bit表示でも文字が背景に負けず、くっきりと浮かび上がります。”
4. Implementation Details (Memory Management)
Proportional fonts are beautiful but heavier in data size. Switching the framebuffer to 1‑bit freed enough RAM to store and render these richer fonts comfortably.
Tips for Best Results
- Use
setTextSize(1)with a properly sized font Do not shrink large fonts; instead, draw a 12pt font at size=1 for the cleanest edges. - Set the font before calling
getTextBounds()This ensures accurate bounding box calculations.
Example Code
cpp
#include <PicoDVI.h>
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSansBold12pt7b.h>
const dvi_serialiser_cfg my_dvi_cfg = {
.pio = pio0,
.sm_tmds = {0, 1, 2},
.pins_tmds = {12, 16, 18},
.pins_clk = 14,
.invert_diffpairs = false
};
// Double buffering enabled
DVIGFX1 display(DVI_RES_640x480p60, false, my_dvi_cfg, VREG_VOLTAGE_1_30);
void setup() {
if (!display.begin()) {
pinMode(LED_BUILTIN, OUTPUT);
while (1) {
digitalWrite(LED_BUILTIN, HIGH); delay(100);
digitalWrite(LED_BUILTIN, LOW); delay(100);
}
}
display.fillScreen(0);
display.setTextColor(1);
display.setFont(&FreeSansBold12pt7b);
display.setTextSize(1);
String text = "Loading ........ ";
int16_t x1, y1;
uint16_t w, h;
display.getTextBounds(text, 0, 0, &x1, &y1, &w, &h);
int centerX = (640 - w) / 2;
int centerY = (480 + h) / 2;
display.setCursor(centerX, centerY);
display.print(text);
display.drawRect(0, 0, 640, 480, 1);
}
Conclusion
Rather than pushing the Pico’s hardware to its limits, this project demonstrates that smart resource allocation—such as sacrificing color depth to improve font quality—can produce highly practical display output even on the original Raspberry Pi Pico.


コメント