Astrelis Text - Text rendering with cosmic-text
This crate provides modular text rendering capabilities:
- Font management with system fonts and custom fonts
- Text builder with styling (size, color, alignment, etc.)
- GPU-accelerated text rendering with FontRenderer
Quick Start
use ;
use GraphicsContext;
use Vec2;
let context = new_sync;
let font_system = with_system_fonts;
let mut renderer = new;
// Create styled text with builder pattern
let text = new
.size
.color
.bold;
// Prepare and draw
let mut buffer = renderer.prepare;
renderer.draw_text;
// Render to a render pass
// renderer.render(render_pass, viewport_size);
Features
- System Fonts: Automatically loads all system fonts
- Custom Fonts: Load .ttf and .otf files from disk or memory
- Rich Styling: Font size, weight, style, color, alignment, wrapping
- Builder Pattern: Fluent API for text configuration
- GPU Accelerated: WGPU-based rendering with texture atlas
- Text Layout: Multi-line text with automatic wrapping
- Asset Integration: Load fonts through the asset system (with
assetfeature)
Examples
Run the examples to see text rendering in action: