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:
- It is none of your business because you are not supposed to install fonts on the user’s behalf. If you want to use a specific font in your application, you should bundle it with your application and use an API like
AddFontResourceEx
with the FR_PRIVATE
flag 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.
- It is none of your business because putting a font in this directory is neither sufficient nor necessary to install a font. To install a font, one has to take the full path to the font and put it in a value stored under a specific registry key, which is not exactly a documented API either (though it’s something of common knowledge that the key is
HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
). The location %USERPROFILE%\AppData\Local\Microsoft\Windows\Fonts
is 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.