mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Replace indexing in Fonts with member function
This commit is contained in:
@@ -298,6 +298,11 @@ impl Fonts {
|
||||
&self.definitions
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn font(&self, text_style: TextStyle) -> &Font {
|
||||
&self.fonts[&text_style]
|
||||
}
|
||||
|
||||
/// Call each frame to get the change to the font texture since last call.
|
||||
pub fn font_image_delta(&self) -> Option<crate::ImageDelta> {
|
||||
self.atlas.lock().take_delta()
|
||||
@@ -382,15 +387,6 @@ impl Fonts {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Index<TextStyle> for Fonts {
|
||||
type Output = Font;
|
||||
|
||||
#[inline(always)]
|
||||
fn index(&self, text_style: TextStyle) -> &Font {
|
||||
&self.fonts[&text_style]
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct CachedGalley {
|
||||
|
||||
@@ -86,7 +86,7 @@ fn layout_section(
|
||||
byte_range,
|
||||
format,
|
||||
} = section;
|
||||
let font = &fonts[format.style];
|
||||
let font = fonts.font(format.style);
|
||||
let font_height = font.row_height();
|
||||
|
||||
let mut paragraph = out_paragraphs.last_mut().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user