Skip to content

Add text_ui example and update changelog - #211

Open
tobert wants to merge 7 commits into
linebender:mainfrom
tobert:docs/text-ui-example
Open

Add text_ui example and update changelog#211
tobert wants to merge 7 commits into
linebender:mainfrom
tobert:docs/text-ui-example

Conversation

@tobert

@tobert tobert commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a text_ui example demonstrating all 9 VelloTextAnchor variants in a 3x3 grid with debug outlines enabled.

Originally added to #206 by @nuzzles. Depends on #208 #209 #210.

Test plan

  • cargo check -p text_ui
  • Visual: cargo run -p text_ui — verify 3x3 grid with correct anchor positions

Series

This is PR 4 of 5:

  1. fix/ui-text-anchor — fix UI text anchor positioning
  2. fix/ui-clip-rects — CalculatedClip support, glyph culling, pixel-snap affines
  3. perf/dirty-tracking — skip unchanged frames, text layout cache
  4. This PR — example + changelog
  5. fix/linux-windowing — add x11/wayland features for Linux compilation

@nuzzles nuzzles added the blocked Progress is halted label Mar 7, 2026
@nuzzles

nuzzles commented Mar 7, 2026

Copy link
Copy Markdown
Member

Adding blocked label since this PR is attempting to merge to main, built off other PR work, so the diff is not a focused PR until other PRs merge.

@tobert
tobert force-pushed the docs/text-ui-example branch 3 times, most recently from dbdf4af to 9f13caf Compare March 8, 2026 23:01
tobert and others added 2 commits March 9, 2026 12:20
…fines

- Extract CalculatedClip during ECS extraction for all 4 UI types
- Convert to kurbo::Rect via to_kurbo_clip() with NaN/infinity sanitization
- Push/pop clip layers in render_frame around each UI item
- Skip glyph runs outside clip rect with early exit
- Floor UI affine translations to align with integer-snapped clip rects
- sort_unstable_by → sort_by for UI queue to prevent order flipping
- Skip fully transparent items before pushing clip layers

Partially addresses linebender#204.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tobert
tobert force-pushed the docs/text-ui-example branch 2 times, most recently from 699fde3 to 6514b68 Compare March 10, 2026 00:07
Replace the 2× font_size margin hack with LineMetrics::min_coord /
max_coord from Parley, which give the exact vertical extent of each
line including ascenders and descenders. Culling is also lifted from
per-glyph-run to per-line, which is both more accurate and slightly
more efficient.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tobert
tobert force-pushed the docs/text-ui-example branch from 6514b68 to 682ab47 Compare March 10, 2026 11:14
tobert and others added 4 commits March 10, 2026 11:36
Replace the axis-aligned-only culling path (which disabled culling
entirely under rotation) with inverse-transforming the clip rect
corners into layout space and taking the vertical AABB. This works
for any invertible affine including rotation and non-uniform scale.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VelloSceneDirty(bool) resource gates sort_render_items + render_frame
via run_if. detect_vello_scene_changes checks Changed<> on all Vello
component types, camera, window, render settings, and asset events.

TextLayoutCache — content-addressed double-buffer cache in the render
world. Layouts keyed by SipHash of (font ID, text, style, alignment,
max_advance). Untouched entries naturally drop after one idle frame.

Also includes:
- FRAMES_SKIPPED diagnostic (1.0 skipped, 0.0 rendered)
- VelloRenderSettings crash fix (now inserted into both worlds)
- 9 unit tests for TextLayoutCache including brush-invariance
- Anchor helper functions moved before impl block

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tobert
tobert force-pushed the docs/text-ui-example branch from 682ab47 to f24abdc Compare March 10, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Progress is halted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants