enable
enable copied to clipboard
Add a function which triggers creation/refresh of the Kiva font cache
Warming up the Kiva font cache is a very expensive operation (several seconds). Most code will only trigger it when drawing text, which is generally gives a bad user experience.
We should instead provide a function in the public API which triggers creation of the cache if it is not yet built. Currently kiva.fonttools.font_manager.default_font_manager does this as a side-effect, but it is not part of the public API. I don't think it should become public, but I do think another function should exist for managing the cache.
IMO, default_font_manager() is the correct API to call for this purpose. The cache is an implementation detail. What I care about ensuring (greedily, at startup) is that the font manager is initialized.
OK, but the font manager itself is a hidden implementation detail. The public interface is the Font class. Are you saying we shouldn't provide a new function with a nice name that makes sure the font manager is initialized?