I maintain a library that provides the user-accessible locations for retrieving and storing configuration, cache and other data across multiple platforms. On Windows, this functionality is implemented using the KnownFolder API.
Recently I received a request to add support for the non-admin font directory on Windows that was added in 2018.
Surprisingly, this directory was not added to the KnownFolder API – is this intentional or was this overlooked?
Raymond Chen, who showed up in question comments and whom one might have expected to know the reason, seems either reluctant to share it or ignorant himself. But if you’re willing to accept some speculation, I can guess what he might be trying to say between the lines:
Because the user font directory is none of your business.
This works on a couple of levels:
AddFontResourceExwith theFR_PRIVATEflag to load it. If the user wants to install a font to their profile permanently, that is up to them and the operating system facilities already provided. Your services are not required.HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts). The location%USERPROFILE%\AppData\Local\Microsoft\Windows\Fontsis merely customary; enumerating that directory’s contents is not guaranteed to return all user-owned fonts, and neither is putting fonts inside sufficient to install them. The path alone would be useless to a cross-platform app, because it would need to perform platform-specific steps to install or enumerate user-owned fonts anyway. Which are not yours to manage in the first place.In other words, it would not be a good API for whatever you might want to accomplish with it, and it is not even clear that they want you to be able to accomplish it, since doing so might create potential for abuse.