Skip to content
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

Crash when loading fontconfig #167

Closed
chrisduerr opened this issue Dec 18, 2020 · 3 comments · Fixed by #168
Closed

Crash when loading fontconfig #167

chrisduerr opened this issue Dec 18, 2020 · 3 comments · Fixed by #168

Comments

@chrisduerr
Copy link
Contributor

This has been reported to Alacritty in alacritty/alacritty#4591.

Generally the fontconfig of sctk should probably be reworked, but even if it doesn't it should under no circumstances just prevent the entire application from working. An unwrap in sctk on something that can actually occur seems rather inappropriate.

@elinorbgr
Copy link
Member

Indeed, this whole block should be formulated in a more error-tolerant way:

if let Some(font) = fontconfig::FontConfig::new()
.unwrap()
.get_regular_family_fonts(&font_face)
.unwrap()
.iter()
.find(|p| p.extension().map(|e| e == "ttf").unwrap_or(false))
{

Probably the behavior should be to just log a warning when failing to load fontconfig, and just don't display any text.

@brightly-salty
Copy link
Contributor

I'd be willing to attempt to implement this and submit a PR if it would be accepted.

@elinorbgr
Copy link
Member

@brightly-salty Thanks for offering your help, such a PR would be welcome ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants