GlyphWeave is a fast Rust CLI + library for generating bold SVG word clouds inside text and shape masks with multiple layout engines, reproducible runs, and palette control.
- Fast by default
- Visual by design
- CLI + library
Generated with fixed seeds, fast-grid, and fonts/Roboto-Regular.ttf.
RUST (auto) |
AI (complementary) |
|---|---|
DATA (analogous) |
CODE (vibrant) |
|---|---|
Reproduce these assets:
bash docs/examples/generate.sh- Fast layouts out of the box with
fast-grid, plusmcts,simulated-annealing,spiral-greedy, andrandom-baseline - Strong visual control with palette strategies, weighted words, rotations, and SVG output
- Reproducible runs through
--seed, config files, and library integration for automation
cargo install glyphweaveOptional: include embedded Noto Sans SC at build time.
cargo install glyphweave --features embedded_fontsglyphweave \
--text "RUST" \
--words "cloud,speed,layout,mask,svg,grid" \
--canvas-size 1400,800 \
--algorithm fast-grid \
--palette auto \
--seed 42 \
--output output.svgUse weighted input from file:
# words.txt
rust,3
cloud,2
layout,2
mask
svg
glyphweave --text "AI" --word-file words.txt --algorithm spiral-greedy --rotations 0,90 --output ai.svgShow all flags:
glyphweave --help- Design assets and posters with text-shaped SVG output that stays easy to post-process
- Data storytelling visuals where the shape matters as much as the words
- Scripted and batch generation pipelines through the Rust API or CLI configs
use glyphweave::{
generate, load_font_from_file, AlgorithmKind, CanvasConfig, CloudRequest, FontSizeSpec,
RenderOptions, ShapeConfig, StyleConfig, WordEntry,
};
use std::{path::Path, sync::Arc};
let font = load_font_from_file(Path::new("fonts/NotoSansSC-Regular.ttf"))?;
let result = generate(CloudRequest {
canvas: CanvasConfig { width: 1200, height: 700, margin: 12 },
shape: ShapeConfig { text: "DATA".into(), font_size: FontSizeSpec::AutoFit },
words: vec![WordEntry::new("rust", 2.0), WordEntry::new("svg", 1.0)],
style: StyleConfig::default(),
algorithm: AlgorithmKind::FastGrid,
ratio_threshold: 0.85,
max_try_count: 10_000,
seed: Some(7),
font: Arc::new(font),
render: RenderOptions::default(),
})?;
std::fs::write("cloud.svg", result.svg)?;
# Ok::<(), Box<dyn std::error::Error>>(())| Algorithm | Speed | Fill Quality | Best Use Case |
|---|---|---|---|
fast-grid |
High | High | Default production choice |
mcts |
Medium-Low | High | Search-driven quality improvements |
simulated-annealing |
Medium-Low | Medium-High | Stochastic optimization and exploration |
spiral-greedy |
Medium | Medium-High | Center-focused, stable visual structure |
random-baseline |
Low | Medium | Baseline and regression comparison |
- Default behavior: try system fonts automatically
- Use
--font <path>to pin a.ttf/.otf - Use
--choose-system-fontfor interactive font selection - Embedded font feature:
embedded_fonts(off by default) - Embedded font: Noto Sans SC, SIL Open Font License 1.1
- License text:
fonts/OFL-NotoSansSC.txt
Config precedence (later overrides earlier):
~/.config/glyphweave/config.toml(or$XDG_CONFIG_HOME/glyphweave/config.toml).glyphweave.tomlin current directory--config <path>- CLI flags
Minimal example:
canvas_size = [1600, 900]
algorithm = "fast-grid"
palette = "analogous"
palette_base = "#0EA5E9"
ratio = 0.85
max_tries = 12000
rotations = [0, 90]The Release workflow supports tag-driven and manual publishing to GitHub Releases, crates.io, and the Acture/homebrew-ac tap.
- Secrets:
HOMEBREW_TAP_TOKEN - Manual inputs:
tag,upload_assets,publish_cargo,update_homebrew - crates.io publishing uses Trusted Publishing via GitHub OIDC; configure
Acture/glyphweave, workflowrelease.yml, and environmentreleaseas a trusted publisher on crates.io - The first publish of a brand-new crate can be done locally; once the crate exists, rerun the workflow or use future tags for Trusted Publishing
- Use the
releaseenvironment if you gate publishing with environment approvals
AGPL-3.0. See LICENSE.