Dumo (/ˈduːmoʊ/, pronounced doo-mo;
from dumó, meaning back, tail-end, end-piece of a bread loaf) is an embedded-graphics backend
for ratatui v0.30.0 “Bryndza” built on the ratatui-core crate.
Build terminal-style user interfaces for small low-resolution displays, such as this 160×80 screen…
M+ Code font in a Ratatui Tabs widget.
An e-Paper display with only black and white pixels, showing three ingredients:
- Ratatui List widget (left ⅓)
- Ratatui Calendar widget (lower-right ⅔)
tui-big-textfromtui-widgets
… or how about a display with a lot of pixels — for an SPI interface, at least — like the one found on this 4.2″ EPD module, which has a resolution of 400×300?
The dumo crate and its fonts module contains preconfigured mplusfonts bitmap fonts with
six line heights, for starters: 6×18, 8×24, 10×30, 12×36, 14×42, and 16×48. The calendar above uses
a character cell size of 12×30 pixels since, in addition to the six basic ones, there are three
presets for 125% width bitmap fonts: 8×20, 12×30, 16×40; and one that has a width of 115%, the 6×16
bitmap font, which can be seen in the first example with the Ratatui tabs.
There are two additional bold presets for the 8×24 and 12×36 bitmap fonts, making it a total of 12.
Although it would be possible, there are no presets for cell sizes smaller than 6×16 pixels because
mplusfonts creates glyph images from TrueType fonts. The designer of these fonts, Coji Morishita,
has done an excellent job aligning glyph outlines with the pixel grid at the font size/width values
used in the presets, but if you have less pixels to work with or would prefer another font, a pixel
font, check out mousefood, the première Ratatui backend for embedded-graphics.
While pixel fonts are optimized for 1 bit per pixel and take up less storage space, dumo supports
1, 2, 4, and 8 bits per pixel in its glyph images; therefore, font anti-aliasing is possible if the
display also has a high enough bit depth. This is the recommended use case for dumo, even though,
as shown in the calendar example, 1 bit per pixel is supported, the uneven line thickness — as seen
in the letter R for Ratatui — is unavoidable, given that the current edition of M+
FONTS is not a per-pixel-drawn bitmap font.
Bit depth aside, there’s an option to reduce the amount of flash memory that a bitmap font occupies
either by not enabling the subsets of glyphs that are not required — for example, Braille patterns,
which are one type of Marker in Ratatui and a popular choice of characters for a throbber —
or through the use of a macro in the dumo crate root, bypassing the fonts module and adding
character ranges and strings that need to be made renderable. The font widths used as parameters to
mpluscode! have been pre-calculated, balancing out the left and right halves of glyph images such
that anti-aliasing artifacts would appear symmetrical; therefore, bypassing also the font_* macro
set and calling mpluscode! or even mplusfonts::mplus! is only recommended when the predefined
BitmapFont instances are inadequate.
See USAGE, which is also available as crate-level documentation: https://docs.rs/dumo
The minimum supported Rust version for dumo is 1.89.
The source code of dumo is dual-licensed under:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.