femtovg: increase font cache size

Otherwise, the cache is trashed with already moderate text size causing
TextEdit to become quickly very slow (unusable) when the text becomes a
bit big.

Big text are horribly still slow but at least now it can be used without
freezing the app for minutes
This commit is contained in:
Olivier Goffart 2023-03-22 09:50:52 +01:00 committed by Olivier Goffart
parent ff89a38062
commit d5a4ec87e0

View file

@ -3,6 +3,7 @@
// cspell:ignore Noto fontconfig
use core::num::NonZeroUsize;
use femtovg::TextContext;
use i_slint_core::graphics::euclid;
use i_slint_core::graphics::FontRequest;
@ -249,10 +250,14 @@ impl Default for FontCache {
})
.collect();
let text_context = TextContext::default();
text_context.resize_shaped_words_cache(NonZeroUsize::new(10_000_000).unwrap());
text_context.resize_shaping_run_cache(NonZeroUsize::new(1_000_000).unwrap());
Self {
loaded_fonts: HashMap::new(),
loaded_font_coverage: HashMap::new(),
text_context: Default::default(),
text_context,
available_fonts: font_db,
available_families,
#[cfg(all(