-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove lifetime from Buffer
and Mutex
from FontSystem
#97
Conversation
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Buffer
andEditor
types not borrowFontSystem
, changing their methods to take a&mut FontSystem
when needed, like #39 does. A helper typeBorrowedWithFontSystem
is added (this was proposed here: #39 (comment)), which allows calling methods without having to pass aFontSystem
for each call.Making
FontSystem::get_font
take&mut self
also allows us to lazily callmake_shared_face_data
.This also adds an
FontSystem::db_mut
method, 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.