Trait iced_graphics::backend::Text
source · pub trait Text {
const ICON_FONT: Font;
const CHECKMARK_ICON: char;
const ARROW_DOWN_ICON: char;
fn default_size(&self) -> u16;
fn measure(
&self,
contents: &str,
size: f32,
font: Font,
bounds: Size
) -> (f32, f32);
fn hit_test(
&self,
contents: &str,
size: f32,
font: Font,
bounds: Size,
point: Point,
nearest_only: bool
) -> Option<Hit>;
}
Expand description
A graphics backend that supports text rendering.
Required Associated Constants§
sourceconst CHECKMARK_ICON: char
const CHECKMARK_ICON: char
The char
representing a ✔ icon in the ICON_FONT
.
sourceconst ARROW_DOWN_ICON: char
const ARROW_DOWN_ICON: char
The char
representing a ▼ icon in the built-in ICON_FONT
.
Required Methods§
sourcefn default_size(&self) -> u16
fn default_size(&self) -> u16
Returns the default size of text.
sourcefn measure(&self, contents: &str, size: f32, font: Font, bounds: Size) -> (f32, f32)
fn measure(&self, contents: &str, size: f32, font: Font, bounds: Size) -> (f32, f32)
Measures the text contents with the given size and font, returning the size of a laid out paragraph that fits in the provided bounds.
sourcefn hit_test(
&self,
contents: &str,
size: f32,
font: Font,
bounds: Size,
point: Point,
nearest_only: bool
) -> Option<Hit>
fn hit_test(
&self,
contents: &str,
size: f32,
font: Font,
bounds: Size,
point: Point,
nearest_only: bool
) -> Option<Hit>
Tests whether the provided point is within the boundaries of Text
laid out with the given parameters, returning information about
the nearest character.
If nearest_only is true, the hit test does not consider whether the the point is interior to any glyph bounds, returning only the character with the nearest centeroid.