I was asked to open a new issue in relation to issue #1889, with RStudio needing to cache fonts on startup, closed by PR #3842.
The original problem, that opening "Global Options" caused the entirety of RStudio to hang while it built a font cache, has been resolved by building the cache at startup in a separate thread. That's definitely a workable solution.
The remaining problem now is that on systems with many fonts installed this causes a significant CPU load each time RStudio is started, as the cache is rebuilt each time. For reference, my Thinkpad X270 (Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz) with a 3.4G /usr/share/fonts including 505 monospace fonts takes just over five minutes to build the cache, with one CPU core maxed out by that thread.
It's no longer the critical problem that it was, but this still seems quite a CPU hit each time RStudio is started. PR #3833 proposed maintaining a cache of installed fonts. I'd suggest that buildling this cache in a separate thread _and_ maintaining the cache between instances would be ideal.
@josswright Thank you for opening this as a new issue!
This has been implemented for Linux, at least -- now, we use the fontconfig font cache (when available) to query the set of available fonts.
Most helpful comment
This has been implemented for Linux, at least -- now, we use the
fontconfigfont cache (when available) to query the set of available fonts.https://github.com/rstudio/rstudio/blob/84143aa71e0d29940c54b38b00d33e9b2f6e155a/src/cpp/desktop/DesktopInfo.cpp#L107-L133