pub struct MeasureRequests { /* private fields */ }Expand description
A set of questions for one call, built up and then asked at once.
Reused across frames: clearing keeps every buffer’s capacity, so once warm, asking the same number of questions allocates nothing.
Implementations§
Source§impl MeasureRequests
impl MeasureRequests
pub fn new() -> Self
Sourcepub fn set_zoom(&mut self, zoom: f32)
pub fn set_zoom(&mut self, zoom: f32)
Measures the requests asked from here on at zoom zoom: the zoom of the page
region they belong to, which is the operating system’s text size times the
application’s own zoom. The Renderer measures them at its density times zoom,
with no font scale of its own, and answers in the region’s CSS pixels.
A Host can hold several regions at different zooms, which is why this travels with every request rather than being the Renderer’s state. Never set, it is one.
pub fn is_empty(&self) -> bool
Sourcepub fn text(
&mut self,
text: &str,
spans: &TextSpans,
style: &TextStyle,
constraint: TextConstraint,
) -> usize
pub fn text( &mut self, text: &str, spans: &TextSpans, style: &TextStyle, constraint: TextConstraint, ) -> usize
Asks how big text, with spans laid over it and set in style, is under
constraint. Returns the index its answer will have.
Sourcepub fn node(&mut self, node_id: u32, constraints: NodeConstraints) -> usize
pub fn node(&mut self, node_id: u32, constraints: NodeConstraints) -> usize
Asks how big the node node_id, which the Renderer has already applied, is under
constraints. Returns the index its answer will have.