Trait iced_native::text::Renderer
source · pub trait Renderer: Renderer {
type Font: Default + Clone;
const ICON_FONT: Self::Font;
const CHECKMARK_ICON: char;
const ARROW_DOWN_ICON: char;
fn default_size(&self) -> u16;
fn measure(
&self,
content: &str,
size: u16,
font: Self::Font,
bounds: Size
) -> (f32, f32);
fn hit_test(
&self,
contents: &str,
size: f32,
font: Self::Font,
bounds: Size,
point: Point,
nearest_only: bool
) -> Option<Hit>;
fn fill_text(&mut self, text: Text<'_, Self::Font>);
fn measure_width(&self, content: &str, size: u16, font: Self::Font) -> f32 { ... }
}
Expand description
A renderer capable of measuring and drawing Text
.
Required Associated Types
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,
content: &str,
size: u16,
font: Self::Font,
bounds: Size
) -> (f32, f32)
fn measure(
&self,
content: &str,
size: u16,
font: Self::Font,
bounds: Size
) -> (f32, f32)
Measures the text in the given bounds and returns the minimum boundaries that can fit the contents.
sourcefn hit_test(
&self,
contents: &str,
size: f32,
font: Self::Font,
bounds: Size,
point: Point,
nearest_only: bool
) -> Option<Hit>
fn hit_test(
&self,
contents: &str,
size: f32,
font: Self::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.