mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
Make WidgetText smaller and faster (#6903)
* In preparation of #5830, this should reduce the performance impact of that PR --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -118,6 +118,21 @@ impl LayoutJob {
|
||||
}
|
||||
}
|
||||
|
||||
/// Break on `\n`
|
||||
#[inline]
|
||||
pub fn simple_format(text: String, format: TextFormat) -> Self {
|
||||
Self {
|
||||
sections: vec![LayoutSection {
|
||||
leading_space: 0.0,
|
||||
byte_range: 0..text.len(),
|
||||
format,
|
||||
}],
|
||||
text,
|
||||
break_on_newline: true,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Does not break on `\n`, but shows the replacement character instead.
|
||||
#[inline]
|
||||
pub fn simple_singleline(text: String, font_id: FontId, color: Color32) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user