Simplify font resolution in the GL backend

The font resolution function querying fontdb is fast now, so we can
always call it when rendering text. That way we don't need all the
indirection in the text_size(), etc. functions, we don't need an entry
in the item graphics cache for the font and we can avoid a lot of
property dependencies.
This commit is contained in:
Simon Hausmann 2021-09-20 18:05:04 +02:00
parent 2f1db396e8
commit ac0cc85d33
7 changed files with 62 additions and 140 deletions

View file

@ -21,7 +21,7 @@ use sixtyfps_corelib::component::ComponentRc;
use sixtyfps_corelib::graphics::{Image, Point, Size};
use sixtyfps_corelib::slice::Slice;
use sixtyfps_corelib::window::{PlatformWindow, Window};
use sixtyfps_corelib::{ImageInner, SharedString};
use sixtyfps_corelib::ImageInner;
use std::path::Path;
use std::pin::Pin;
use std::rc::Rc;
@ -137,12 +137,11 @@ impl PlatformWindow for TestingWindow {
fn text_size(
&self,
_item_graphics_cache: &sixtyfps_corelib::item_rendering::CachedRenderingData,
_unresolved_font_request_getter: &dyn Fn() -> sixtyfps_corelib::graphics::FontRequest,
text_getter: &dyn Fn() -> SharedString,
_font_request: sixtyfps_corelib::graphics::FontRequest,
text: &str,
_max_width: Option<f32>,
) -> Size {
Size::new(text_getter().len() as f32 * 10., 10.)
Size::new(text.len() as f32 * 10., 10.)
}
fn text_input_byte_offset_for_position(