From 86ff33d64111468aadfd769a26d759b69b5f6eb0 Mon Sep 17 00:00:00 2001 From: Adrian Papari Date: Sun, 25 Jan 2026 20:17:23 +0100 Subject: [PATCH 1/6] update backend comparison --- src/backend/mod.rs | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index a674fdb5..1f884740 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -4,11 +4,11 @@ //! each with different performance characteristics and trade-offs: //! //! - [`WebGl2Backend`]: GPU-accelerated rendering powered by [beamterm][beamterm]. Uses prebuilt -//! font atlases. Best performance, capable of 60fps on large terminals (300x100+). +//! or runtime generated font atlases. Best performance, capable of 60fps on large terminals. //! //! - [`CanvasBackend`]: Canvas 2D API with full Unicode support via browser font rendering. -//! Good fallback when WebGL2 isn't available or when dynamic character support is required. -//! Does not support hyperlinks or text selection, but can render dynamic Unicode/emoji. +//! Good fallback when WebGL2. Does not support hyperlinks or text selection, but can render +//! dynamic Unicode/emoji. //! //! - [`DomBackend`]: Renders cells as HTML elements. Most compatible and accessible, //! supports hyperlinks, but slowest for large terminals. @@ -17,24 +17,29 @@ //! //! ## Backend Comparison //! -//! | Feature | DomBackend | CanvasBackend | WebGl2Backend | -//! |------------------------------|------------|---------------|------------------| -//! | **60fps on large terminals** | ✗ | ✗ | ✓ | -//! | **Memory Usage** | Highest | Medium | Lowest | -//! | **Hyperlinks** | ✓ | ✗ | ✓ | -//! | **Text Selection** | ✓ | ✗ | ✓ | -//! | **Accessibility** | ✓ | Limited | Limited | -//! | **Unicode/Emoji Support** | Full | Full | Limited to atlas | -//! | **Dynamic Characters** | ✓ | ✓ | ✗ | -//! | **Font Variants** | ✓ | Regular only | ✓ | -//! | **Underline** | ✓ | ✗ | ✓ | -//! | **Strikethrough** | ✓ | ✗ | ✓ | -//! | **Browser Support** | All | All | Modern (2017+) | +//! | Feature | DomBackend | CanvasBackend | WebGl2Backend | +//! |------------------------------|------------|---------------|----------------| +//! | **60fps on large terminals** | ✗ | ✗ | ✓ | +//! | **Memory Usage** | Highest | Medium | Lowest | +//! | **Hyperlinks** | ✓ | ✗ | ✓ | +//! | **Text Selection** | ✓ | ✗ | ✓ | +//! | **Accessibility** | ✓ | Limited | Limited | +//! | **Unicode/Emoji Support** | Full | Full | Full¹ | +//! | **Dynamic Characters** | ✓ | ✓ | ✓¹ | +//! | **Font Variants** | ✓ | Regular only | ✓ | +//! | **Underline** | ✓ | ✗ | ✓ | +//! | **Strikethrough** | ✓ | ✗ | ✓ | +//! | **Browser Support** | All | All | Modern (2017+) | +//! +//! ¹: The [dynamic font atlas](webgl2::WebGl2BackendOptions::dynamic_font_atlas) rasterizes +//! glyphs on demand with full Unicode/emoji and font variant support. The +//! [static font atlas](webgl2::WebGl2BackendOptions::font_atlas) is limited to glyphs +//! included at atlas build time. //! //! ## Choosing a Backend //! //! - **WebGl2Backend**: Preferred for most applications - consumes the least amount of resources -//! - **CanvasBackend**: When you need dynamic Unicode/emoji or must support non-WebGL2 browsers +//! - **CanvasBackend**: When you must support non-WebGL2 browsers //! - **DomBackend**: When you need better accessibility or CSS styling /// Canvas backend. From d60aaf3f2f48ded7ad7aa82fc67deb61d35f1372 Mon Sep 17 00:00:00 2001 From: Adrian Papari Date: Wed, 28 Jan 2026 09:40:04 +0100 Subject: [PATCH 2/6] update comparison --- src/backend/mod.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 1f884740..b9583588 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -4,14 +4,15 @@ //! each with different performance characteristics and trade-offs: //! //! - [`WebGl2Backend`]: GPU-accelerated rendering powered by [beamterm][beamterm]. Uses prebuilt -//! or runtime generated font atlases. Best performance, capable of 60fps on large terminals. +//! or runtime generated font atlases. Very low overhead, typically under 1ms CPU time per frame, +//! even for fullscreen terminals with all cells changing. //! -//! - [`CanvasBackend`]: Canvas 2D API with full Unicode support via browser font rendering. -//! Good fallback when WebGL2. Does not support hyperlinks or text selection, but can render -//! dynamic Unicode/emoji. +//! - [`CanvasBackend`]: Canvas 2D API with Unicode support via browser font rendering. +//! Good fallback for the `WebGl2Backend`, if webgl2 isn't available. Does not support hyperlinks +//! or text selection, but can render dynamic Unicode and single-cell emoji. //! -//! - [`DomBackend`]: Renders cells as HTML elements. Most compatible and accessible, -//! supports hyperlinks, but slowest for large terminals. +//! - [`DomBackend`]: Renders cells as HTML elements. Most compatible, but slowest for large +//! terminals. //! //! [beamterm]: https://github.com/junkdog/beamterm //! @@ -24,17 +25,19 @@ //! | **Hyperlinks** | ✓ | ✗ | ✓ | //! | **Text Selection** | ✓ | ✗ | ✓ | //! | **Accessibility** | ✓ | Limited | Limited | -//! | **Unicode/Emoji Support** | Full | Full | Full¹ | +//! | **Unicode/Emoji Support** | Full | Limited² | Full¹ | //! | **Dynamic Characters** | ✓ | ✓ | ✓¹ | //! | **Font Variants** | ✓ | Regular only | ✓ | //! | **Underline** | ✓ | ✗ | ✓ | //! | **Strikethrough** | ✓ | ✗ | ✓ | //! | **Browser Support** | All | All | Modern (2017+) | //! -//! ¹: The [dynamic font atlas](webgl2::WebGl2BackendOptions::dynamic_font_atlas) rasterizes +//! ¹: The [dynamic font atlas](webgl2::FontAtlasConfig::Dynamic) rasterizes //! glyphs on demand with full Unicode/emoji and font variant support. The -//! [static font atlas](webgl2::WebGl2BackendOptions::font_atlas) is limited to glyphs -//! included at atlas build time. +//! [static font atlas](webgl2::FontAtlasConfig::Static) is limited to glyphs +//! compiled into the `.atlas` file. +//! ²: Unicode is supported, but emoji only render correctly when it spans one cell. +//! Most emoji occupy two cells. //! //! ## Choosing a Backend //! From 42adbc7e007c8be52918ae046b695163b1382997 Mon Sep 17 00:00:00 2001 From: Adrian Papari Date: Wed, 28 Jan 2026 09:49:11 +0100 Subject: [PATCH 3/6] improve docs --- src/backend/webgl2.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/backend/webgl2.rs b/src/backend/webgl2.rs index 11dec5b1..b688cb86 100644 --- a/src/backend/webgl2.rs +++ b/src/backend/webgl2.rs @@ -23,7 +23,7 @@ use std::{ }; use web_sys::{wasm_bindgen::JsCast, window, Element}; -/// Re-export beamterm's atlas data type. Used by [`WebGl2BackendOptions::font_atlas`]. +/// Re-export beamterm's atlas data type. Used by [`FontAtlasConfig::Static`]. pub use beamterm_renderer::FontAtlasData; /// Font atlas configuration. @@ -104,9 +104,9 @@ impl WebGl2BackendOptions { self } - /// Sets the fallback glyph to use for characters not in the font atlas. + /// Sets the fallback glyph for missing characters. /// - /// If not set, defaults to a space character (` `). + /// Used when a glyph is missing from the font atlas. Defaults to a space character. pub fn fallback_glyph(mut self, glyph: &str) -> Self { self.fallback_glyph = Some(glyph.into()); self @@ -231,12 +231,13 @@ impl WebGl2BackendOptions { /// /// WebGL2 is supported in all modern browsers (Chrome 56+, Firefox 51+, Safari 15+). /// -/// ## Font Atlas Limitation +/// ## Font Atlas Options /// -/// [`WebGl2Backend`] uses prebuilt font atlases for performance. Characters not in the atlas -/// will display as ` `. Use [`CanvasBackend`] if you need dynamic Unicode/emoji support. +/// [`WebGl2Backend`] supports two font atlas modes via [`FontAtlasConfig`]: /// -/// [`CanvasBackend`]: crate::backend::canvas::CanvasBackend +/// - **Dynamic**: Rasterizes glyphs on demand with full Unicode/emoji and font variant support. +/// - **Static** (default): Uses pre-generated `.atlas` files. The default atlas is embedded +/// in beamterm. Characters not in the atlas display as the fallback glyph (space by default). /// /// # Performance Measurement /// From 09ce5888308be8e2ac2228527559aa8bf0703cf0 Mon Sep 17 00:00:00 2001 From: Adrian Papari Date: Wed, 28 Jan 2026 09:52:21 +0100 Subject: [PATCH 4/6] update feature comparison --- src/backend/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index b9583588..1d412f23 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -22,8 +22,8 @@ //! |------------------------------|------------|---------------|----------------| //! | **60fps on large terminals** | ✗ | ✗ | ✓ | //! | **Memory Usage** | Highest | Medium | Lowest | -//! | **Hyperlinks** | ✓ | ✗ | ✓ | -//! | **Text Selection** | ✓ | ✗ | ✓ | +//! | **Hyperlinks** | ✗ | ✗ | ✓ | +//! | **Text Selection** | Linear | ✗ | Linear/Block | //! | **Accessibility** | ✓ | Limited | Limited | //! | **Unicode/Emoji Support** | Full | Limited² | Full¹ | //! | **Dynamic Characters** | ✓ | ✓ | ✓¹ | From 27254ec002092f47383c635b7d9ae96003412d10 Mon Sep 17 00:00:00 2001 From: Adrian Papari Date: Wed, 28 Jan 2026 17:26:16 +0100 Subject: [PATCH 5/6] Update src/backend/mod.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Orhun Parmaksız --- src/backend/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 1d412f23..9139ef62 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -8,7 +8,7 @@ //! even for fullscreen terminals with all cells changing. //! //! - [`CanvasBackend`]: Canvas 2D API with Unicode support via browser font rendering. -//! Good fallback for the `WebGl2Backend`, if webgl2 isn't available. Does not support hyperlinks +//! Good fallback for the `WebGl2Backend`, if WebGL2 isn't available. Does not support hyperlinks //! or text selection, but can render dynamic Unicode and single-cell emoji. //! //! - [`DomBackend`]: Renders cells as HTML elements. Most compatible, but slowest for large From 8f82ed5a1bdeaca862cbc624eb59cd923d343309 Mon Sep 17 00:00:00 2001 From: Adrian Papari Date: Thu, 29 Jan 2026 20:26:39 +0100 Subject: [PATCH 6/6] remove misleading feature --- src/backend/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 9139ef62..75d12a92 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -24,7 +24,6 @@ //! | **Memory Usage** | Highest | Medium | Lowest | //! | **Hyperlinks** | ✗ | ✗ | ✓ | //! | **Text Selection** | Linear | ✗ | Linear/Block | -//! | **Accessibility** | ✓ | Limited | Limited | //! | **Unicode/Emoji Support** | Full | Limited² | Full¹ | //! | **Dynamic Characters** | ✓ | ✓ | ✓¹ | //! | **Font Variants** | ✓ | Regular only | ✓ |