fix crash discovering fonts on Linux #123
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
currently the extension crashes on every startup and every time the browser refreshes the session on Linux due to the font directories it looks for not existing and it doesn't handle exceptions.
this pull reduces code duplication by moving font discovery into functions and it also adds error handling when discovering fonts. i set it up to search common font directories on Linux.
the diff is fairly large because my editor cleaned up a bunch of trailing whitespace. if you really want to keep it for whatever reason i can amend this pull to only affect the font discovery part.
i'm not sure why some nodes only used the builtin fonts and one of them used system fonts instead, i assume it's for a reason so i provided separate functions. if you wanted to just use all available fonts a simple function like:
would work.