Expand description
D4: byte<->pixel geometry derived from a shaped run.
Relocated from the private render-wgpu ShapedRunSegmentIndex (which
drew the caret + selection) and extended with the hit-test / visual-line
queries the main-world editing logic needs. Deterministic: an identical
ShapedRun yields an identical TextGeometry, so the value computed
in the main world matches the glyphs the render world paints.
Coordinates are RUN-LOCAL logical pixels: x grows from the run’s leading
edge, y (baseline_y) is the byte’s visual-line baseline offset (0 on
line 1, line_idx * line_height further down). Callers add the draw
origin. All byte<->x math is BiDi-correct: it splits at segment
boundaries and follows visual (not logical) glyph order.
Structs§
- Caret
Geometry - Caret placement for a logical byte, in run-local coords.
- Selection
Band - One selection highlight rectangle, in run-local coords.
- Text
Geometry - Byte<->pixel geometry derived from one
ShapedRun.