Remove lifetime from Buffer and Mutex from FontSystem #97
Remove lifetime from Buffer and Mutex from FontSystem #97jackpot51 merged 9 commits intopop-os:mainfrom
Buffer and Mutex from FontSystem #97Conversation
make_shared_face_data only on demanmake_shared_face_data only on demand
|
By the way, this wouldn't fix #91. There are still outstanding issues with font loading that still slow it down in certain cases. |
56bd8ab to
ae6cb8e
Compare
make_shared_face_data only on demandBuffer and Mutex from FontSystem
6478066 to
fa9fee1
Compare
fa9fee1 to
9681938
Compare
9681938 to
af4378d
Compare
|
@notgull Could you check if this improves the load times? I've added a commit so it should only load the fonts that are really needed/used. |
This does appear to improve the loading time on my system. You can notice |
jackpot51
left a comment
There was a problem hiding this comment.
All tests are passing and performance is good
User question: I'm upgrading to for face in system.db().faces() {
let font = system.get_font(face.id).unwrap();
let font_ref = font.as_swash();This won't compile because the |
This includes all changes from #95.
This makes the
BufferandEditortypes not borrowFontSystem, changing their methods to take a&mut FontSystemwhen needed, like #39 does. A helper typeBorrowedWithFontSystemis added (this was proposed here: #39 (comment)), which allows calling methods without having to pass aFontSystemfor each call.Making
FontSystem::get_fonttake&mut selfalso allows us to lazily callmake_shared_face_data.This also adds an
FontSystem::db_mutmethod, allowing mutable access to thefontdb::Database, which also clears the font match cache to make sure that newly added fonts can be matched. This would fix #75 and resolve #57. It also fixes #107.