Skip to content

gold-silver-copper/soft_ratatui

Repository files navigation

soft_ratatui

Crates.io Documentation License Downloads

Software rendering backend for ratatui. No GPU required. TUI everywhere.

Fast, portable, no-bloat.

  • Optimized for speed, generally faster than running ratatui inside a terminal with crossterm. 120+ fps on normal workloads.
  • Choose your own rendering backend: embedded-graphics, embedded-ttf, cosmic-text, bdf-parser
  • Custom portable pixel rasterizer, outputs RGB/RGBA pixmaps, color-to-alpha support

Feature Flags

soft_ratatui is highly modular. Enable only the backends and features you need to reduce binary size and dependencies.

Feature Enables Description
unicodefonts [embedded_graphics_unicodefonts] Embedded-graphics fonts with Unicode support. Automatically enables embedded-graphics. Enabled by default.
embedded-graphics [EmbeddedGraphics] Uses embedded-graphics font atlases for TUI rendering.
bdf-parser [Bdf] Bitmap Distribution Format font support.
embedded-ttf [EmbeddedTTF] TrueType font rendering via RustType. Automatically enables embedded-graphics.
cosmic-text [CosmicText] Advanced text shaping, layout, and Unicode support using CosmicText engine.

Minimal example

use soft_ratatui::embedded_graphics_unicodefonts::{
    mono_8x13_atlas, mono_8x13_bold_atlas, mono_8x13_italic_atlas,
};
use ratatui::Terminal;
use ratatui::widgets::{Block, Borders, Paragraph, Wrap};
use soft_ratatui::{EmbeddedGraphics, SoftBackend};

fn main() {
    let font_regular = mono_8x13_atlas();
    let font_italic = mono_8x13_italic_atlas();
    let font_bold = mono_8x13_bold_atlas();
    let backend = SoftBackend::<EmbeddedGraphics>::new(
        100,
        50,
        font_regular,
        Some(font_bold),
        Some(font_italic),
    );
    let mut terminal = Terminal::new(backend).unwrap();
    terminal.clear();

    terminal.draw(|frame| {
        let area = frame.area();
        let textik = format!("Hello soft! The window area is {}", area);
        frame.render_widget(
            Paragraph::new(textik)
                .block(Block::new().title("Ratatui").borders(Borders::ALL))
                .wrap(Wrap { trim: false }),
            area,
        );
    });
}

Integrations

  • egui integration provided by egui_ratatui. Have a TUI inside your GUI!
  • bevy_ratatui integration allows you to turn an existing terminal app built with bevy_ratatui into a native or web app. The best way to build a terminal app!!
  • bevy game engine examples provided in the repo, so you can create your own game UI or world textures with ratatui
  • WASM compatible, deploy your ratatui application on the web!

See also

  • mousefood - a no-std embedded-graphics backend for Ratatui!
  • ratzilla - Build terminal-themed web applications with Rust and WebAssembly.
  • ratatui-wgpu - A wgpu based rendering backend for ratatui.
  • bevy_ratatui_camera - A bevy plugin for rendering your bevy app to the terminal using ratatui.

Cool BDF fonts

License

Dual-licensed under MIT or Apache 2.0. Pick whichever suits you.

Status

Comments and suggestions are appreciated.

About

Software renderer for ratatui

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages