You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何Windows 2018年新增的非管理员用户字体目录未被纳入KnownFolder API?

Why the Non-Admin Font Folder Isn't Included in the Windows KnownFolder API

Great question—this is actually an intentional design choice rather than an oversight, and there are a few key reasons behind Microsoft’s decision:

  • KnownFolder's core purpose
    The KnownFolder API is built to expose standardized, system/user-wide directories with stable, well-defined semantics—think Documents, Downloads, or Program Files. The non-admin font folder (%LOCALAPPDATA%\Microsoft\Windows\Fonts) is a specialized, sandboxed location tied directly to Windows’ font management subsystem. It’s not meant to be a general-purpose storage path for apps to reference directly; its sole job is to hold fonts installed by non-privileged users without requiring admin rights.

  • Font system design constraints
    Unlike admin-installed fonts (which get registered in the system-wide HKLM registry), non-admin fonts are only visible to the user who installed them. Windows doesn’t expose this folder via KnownFolder because it expects apps to access these fonts through GDI or DirectWrite’s font enumeration APIs, not by reading the directory path directly. This abstraction lets Microsoft adjust the underlying storage implementation in future updates without breaking apps.

  • Backward compatibility priorities
    KnownFolder GUIDs are intentionally kept stable to avoid breaking existing applications that rely on the API’s fixed list of folders. Adding this specialized font directory would introduce a new dependency that older apps wouldn’t recognize, and since there’s a supported alternative (using font enumeration APIs), Microsoft didn’t see value in expanding the KnownFolder list for this use case.

Practical Workaround for Your Library

If you need to retrieve this path for your storage/retrieval functionality, you’ll have to construct it manually using environment variables. Here’s an example in C#:

Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\Windows\Fonts")

Just note that this path is an implementation detail, not an official API contract—add error handling to account for potential changes in future Windows versions.

内容的提问来源于stack exchange,提问作者soc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 06:47:49