Trait sixtyfps_corelib::graphics::FontMetrics [−][src]
pub trait FontMetrics { fn text_size(&self, text: &str) -> Size; fn text_offset_for_x_position<'a>(&self, text: &'a str, x: f32) -> usize; }
The FontMetrics trait is constructed from a FontRequest by the graphics backend and supplied to text related items in order to measure text.
Required methods
fn text_size(&self, text: &str) -> Size
[src]
Returns the size of the given string in logical pixels.
fn text_offset_for_x_position<'a>(&self, text: &'a str, x: f32) -> usize
[src]
Returns the (UTF-8) byte offset in the given text that refers to the character that contributed to the glyph cluster that’s visually nearest to the given x coordinate. This is used for hit-testing, for example when receiving a mouse click into a text field. Then this function returns the “cursor” position.