iris: add replaceable glyph atlas buckets

This commit is contained in:
iris committed 2026-09-12 18:10:55 -04:00
1 parent c97df72015
commit 90dffce514
12 files changed
+401 -91

No files matched your search

+7
View File
@@ -286,6 +286,13 @@ accepted duplication rather than threading a `Painter` into every input
handler for one field, the same tradeoff `AndroidRenderer::content_scale`
already makes for the Diagnostics page.
Glyph masks are cached at four horizontal quarter-pixel phases. Their final
quad edges snap to physical pixels after retained move offsets are applied;
the CPU mask geometry uses the same calculation as the shader. In particular,
a fractional scroll offset therefore moves text and other primitives in whole
physical-pixel steps instead of resampling the atlas vertically with the
nearest sampler.
**What did not change**: `rel`/`rest` are unaffected (already
resolution-independent, a fraction of the parent). `Span::gap` and
`Padding`'s four sides moved from bare `f32` to `Len` so `dp(...)` works
+10 -3
View File
@@ -823,9 +823,16 @@ a text widget's `TextHandle` wraps the UI-local `RscHandle` into it. The same
generic arena owns texture and managed-paint lifetimes. Its `StrongRscId` and
`WeakRscId` are sendable IDs rather than data pointers; clone and drop events
cross one arena-owned standard channel, and reference counts remain in the
arena instead of allocating one atomic counter per resource. Registering
another family invalidates the live text entries and dirties their active owner
widgets, so registration is also valid after the first shape. ai-app owns the
arena instead of allocating one atomic counter per resource. The ordinary
`register_font(family, data)` call needs no policy argument and uses the shared
default glyph-atlas bucket; `register_font_in` opts a reloadable or sparse font
into a named bucket. `replace_font` unregisters the old faces, releases only
that bucket's pages, and invalidates the live text entries so their active owner
widgets reshape automatically. Freed array layers are reused without moving
live pages. Glyph rasterisation retains four horizontal quarter-pixel phases,
while final primitive edges (including retained scroll moves) snap to physical
pixels; this favours low-DPI text stability and keeps vertical scrolling from
resampling atlas masks. ai-app owns the
`ai-app-icons` family, its Nerd Fonts subset, its codepoints, its license and
the script that rebuilds it; the CSS generic names `sans-serif` and `monospace`
continue to resolve through the platform.
+5 -1
View File
@@ -18,7 +18,11 @@ Glyph atlas pages are layers of one `texture_2d_array`. `GpuTextures` doubles
the array when it runs out of layers, copies the old layers on the GPU, and
rebuilds every bind group that referenced the old view. Page numbers are
assigned synchronously by `Textures::add_page` because glyph insertion needs
the layer before the renderer processes queued texture updates.
the layer before the renderer processes queued texture updates. Atlas maps and
pages are grouped into named buckets: ordinary font registration uses one
shared default bucket, while callers can isolate fonts they expect to replace.
Replacing a font drops its bucket. The resource slots and array layers from
those pages are reused without compacting or changing any live page number.
Standalone images each own a bind group and are not placed in the glyph
array. Each render layer keeps ordinary rect/glyph instances separately from