Proposal: A font enqueue API for WP core

The themes team is proposing for themes to require local web font loading. The reasoning behind that is one of privacy, usability and speed. But web font loading is hard. The reason a large portion of sites on the web uses Google Fonts is that Google Fonts makes it relatively easy. The package the themes team has made to make local font loading easier is a very nice step in the right direction. I propose we go one step further and add an APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. to embed fonts to coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress..

The simple gist of the proposal is this: we should implement wp_enqueue_font. Building that so that fonts are always loaded the same way allows us to continuously improve the way we load fonts as the standards evolve.

This trac ticket elaborates with a very elaborate and specific proposal on what it should do and how it should work in my and @jonoaldersonwp‘s mind. The aforementioned themes team post also provides a lot of context. We would like to hear your feedback on whether this is a good idea and whichever concerns you might have!

Props @sergeybiryukov, @aristath, @adamsilverstein for reviewing.