Experimental package to manipulate open source font data.
Dependencies
moon add gmlewis/fonts-b/baloo// Load a font by name
let font = @fonts.Font::load_font("baloo")export MOONBIT_FONTS_DIR=/path/to/your/gmlewis/fonts/repolet y_label = @draw.text_with(
font,
text,
align=Right,
style_fn=@draw.text_with_style_fn(fn(ctx) {
if ctx.grapheme == "*" {
@draw.glyph_style_skip()
} else if ctx.grapheme_index == 1 {
@draw.glyph_style_override(fill=red_fill)
} else {
@draw.glyph_style_override(fill=black_fill)
}
}),
)
.transform(scale=vec2(0.2, 0.2), position=y_tick_pos + vec2(-0.02, 0.05))
graph.push(y_label)# Render "Hello World" using the default font (aaarghnormal)
./scripts/render-to-svg.py "Hello World" -o hello.svg
# Render multi-line text with horizontal centering
./scripts/render-to-svg.py "Line 1\nLine 2 Centered" -a center -o centered.svg
# Render text using a specific font (e.g. baloo)
./scripts/render-to-svg.py "Custom Font" -f baloo -o custom.svg
# List all available font families
./scripts/render-to-svg.py --list-fonts
# Use Markdown-style markers for bold/italic if the font family supports them
./scripts/render-to-svg.py "**Bold Text** and *Italic Text*" -f aileron -o styled.svg# Render text to JSON (defaults to y-up)
./scripts/render-to-json.py "Data Graphic" -f abeezee -o graphic.json
# Render multi-line text with right-alignment and y-down coordinates
./scripts/render-to-json.py "Line 1\nLine 2" -a right --y-down -o down.json# Generate sample SVGs for all fonts (in batches of 221)
./scripts/sample-all-fonts.py -o all-fonts.svg "The quick brown fox"
# Use a specific label font
./scripts/sample-all-fonts.py -o samples.svg --label-font aileron_bold$ moon version --all
moon 0.1.20260803 (c19f78e 2026-08-03) ~/.moon/bin/moon
moonc v0.10.6+80dc50f24 (2026-08-04) ~/.moon/bin/moonc
moonrun 0.1.20260803 (c19f78e 2026-08-03) ~/.moon/bin/moonrun
http://www.apache.org/licenses/LICENSE-2.0impl Show for AbsoluteCmdExperimental package to manipulate open source font data.
Dependencies