Open nyanpasu64 opened 4 years ago
I also hit this while trying out iced. I poked a little deeper, and the issue isn't with font-kit itself, but with servo-fontconfig-sys. Servo-fontconfig-sys is a snapshot of fontconfig 2.11.1 and gets confused by fontconfig 2.13's config files, which causes FcInitLoadConfigAndFonts to be quite slow. I hacked a servo-fontconfig-sys build out of fontconfig 2.13.92's sources and the warning spew and slowness went away.
I filed https://github.com/servo/libfontconfig/issues/57 to track that issue. Thanks for pointing that out!
Additional detail: if you have a newer fontconfig installed system-wide, servo-fontconfig-sys will use it instead of the embedded fontconfig 2.11.1. Too bad nothing tells you that installing it would be a good idea.
I recently reported https://github.com/hecrj/iced/issues/351:
When I launch any of the iced example apps, it hangs on a blank window for around 31 seconds while loading fonts. The slowness occurs in fontconfig C functions, called by the the font-kit crate. Incidentally, reloading
fc-cache
is also a fairly slow process taking the same "order of magnitude" time.During the hang, the terminal prints out all sorts of funny messages: https://youtu.be/-WZaFURNJYs
I think this is font-kit's fault. iced-wgpu calls
font_kit::source::SystemSource::new()
:https://github.com/hecrj/iced/blob/33448508a524db6447b380cc236be6f0d5ca8a86/wgpu/src/text/font.rs#L12
and everything from then on is font-kit's responsibility.
Interestingly,
sudo fc-cache -f
only takes 6 seconds and doesn't print any funny messages. And launching kate in gdb, the call toFcConfig * FcInitLoadConfigAndFonts(void)
only takes a few seconds and prints no errors to the terminal.This issue occurs with both font-kit 0.6.0 and 0.7.0.