Expand description
Intrinsic measurers for components whose box size depends on content.
Uses the same Skia metrics that the painter uses, so the box reserved by taffy matches the pixels actually drawn — measure-vs-paint mismatches would otherwise cause text to wrap onto an extra line at paint time and overflow into the next sibling.
Structs§
- Badge
Intrinsic - Intrinsic measurer for
Badge— measures the label text plus icon, gap, and the size-derived horizontal/vertical padding. - Caption
Intrinsic - Intrinsic measurer for
Caption. Concatenates the words with single spaces and measures the result like a regular text run. - Codeblock
Intrinsic - Intrinsic measurer for
Codeblock. - Counter
Intrinsic - Intrinsic measurer for
Counter— reserves space for the largest absolute value the counter will display so layout never reflows during animation. - Gradient
Text Intrinsic - Cosmic-text–backed intrinsic measurer for
GradientText— same content model asText(a single string + style); the gradient is purely a paint-time concern and doesn’t change box dimensions. - KbdIntrinsic
- Intrinsic measurer for
Kbd— measures the key text plus the legacy keyboard-cap padding (h ≈ font_size × 0.7, v ≈ font_size × 0.4) and enforces a min-width offont_size × 1.8. - Number
Wheel Intrinsic - Intrinsic measurer for
crate::number_wheel::NumberWheel. - Rich
Text Intrinsic - Intrinsic measurer for
RichText. - Table
Intrinsic - Intrinsic measurer for
Table. - Terminal
Intrinsic - Intrinsic measurer for
Terminal. - Text
Intrinsic - Skia-backed intrinsic measurer for
Text(audit #10: despite the name this module’s doc header suggests, this usesskia_safe::Font:: measure_strviaengine::renderer::text’s fallback-aware helpers — the same primitivesText::paintdraws with — notengine::text::cosmic, which has no callers on the real render path at all; see that module’s doc comment).
Functions§
- font_
size_ ctx LengthContextfor resolvingfont-size(and, throughCssStyle::typography_px_ctx,letter-spacing/line-heightderived from it) against a real, per-frame viewport. Use fromPainter:: paint_contentand friends, which have a realPaintCtx(video_width/video_height) on hand.- measure_
time_ font_ size_ ctx - Same as
font_size_ctx, for theIntrinsicmeasurers in this module: they run atbox_builder/geometryconstruction time, before layout, so there is no real per-frame viewport to hand (see the pre-existing note onTextIntrinsic::from_parts, which has the same limitation forletter-spacing/line-height). Falls back to the engine-wide default 1920×1080 (same asLengthContext::default()) sorem— which does not depend on the viewport at all — still resolves exactly, andvw/vhget a reasonable non-zero approximation instead of silently dropping to 0. This can diverge from whatPainter::paint_contentresolves viafont_size_ctxforvw/vhspecifically, on videos that aren’t 1920×1080 — closing that fully needs the realVideoConfigthreaded throughbox_builder.rs/geometry.rs, both outside this workstream. - resolve_
text_ autofit text-autofit’s shared shrink resolution — the single computationTextIntrinsic::measureandText/GradientText’s painters all call with identical inputs, so the resolved size can never disagree between the box taffy reserves and the pixels actually painted into it (seeCssStyle::text_autofit’s doc comment — this exact class of bug is what this workstream exists to close, not reopen).