feat: concurrently load & parse fonts
This commit is contained in:
parent
5e82de11cf
commit
658025314c
3 changed files with 66 additions and 2 deletions
|
|
@ -158,3 +158,26 @@ impl Font {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test{
|
||||
#[test]
|
||||
fn test_fonts_load_time(){
|
||||
use crate::FontSystem;
|
||||
use sys_locale::get_locale;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let now = std::time::Instant::now();
|
||||
|
||||
let mut db = fontdb::Database::new();
|
||||
let locale = get_locale().unwrap();
|
||||
db.load_system_fonts();
|
||||
FontSystem::new_with_locale_and_db(locale, db);
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
println!(
|
||||
"Fonts load time {}ms.",
|
||||
now.elapsed().as_millis()
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue