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

Windows 11下DirectWrite无法检测FontBase激活的Copyduck字体

DirectWrite无法检测FontBase激活的字体(Windows 11特定问题)

问题现象

  • 在Windows 11(版本10.0.22631.2861)设备上,通过DirectWrite无法检测到由FontBase激活的Copyduck字体,但Windows 10(版本10.0.19045.4046)设备可正常识别。
  • Windows 11上多款依赖DirectWrite的应用(如Word、Photoshop、Aegisub、libass)可正常使用该字体,且该字体在旧版C:\Windows\Fonts界面中可见,但新版字体设置界面无法找到。
  • 字体由FontBase激活,推测其通过AddFontResource接口加载,并在HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Fonts注册表项中添加了对应条目。
  • 核心矛盾:DirectWrite无法查询任何FontBase激活的字体,但可正常识别系统字体;GDI能检测到这些字体,造成Windows 11上GDI与DirectWrite的行为不一致。此外,从Windows 10升级到Windows 11的用户,可通过DirectWrite正常检测到FontBase安装的字体。

测试代码(Visual Studio 2022中运行)

#include <iostream>
#include <dwrite_3.h>
#pragma comment(lib, "Dwrite.lib")


int main() {
    IDWriteFactory3* dwrite_factory;
    if (FAILED(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(dwrite_factory), reinterpret_cast<IUnknown**>(&dwrite_factory))))
        return 1;

    IDWriteFontSet* font_set;
    if (FAILED(dwrite_factory->GetSystemFontSet(&font_set)))
        return 1;

    std::wcout << L"There is " << font_set->GetFontCount() << L" fonts installed." << std::endl;

    DWRITE_FONT_PROPERTY_ID property_ids[] = {
        DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME,
        DWRITE_FONT_PROPERTY_ID_FULL_NAME,
        DWRITE_FONT_PROPERTY_ID_POSTSCRIPT_NAME,
    };
    for (int i = 0; i < sizeof property_ids / sizeof * property_ids; i++) {
        DWRITE_FONT_PROPERTY property = {
            property_ids[i],
            L"Copyduck",
            L"",
        };

        IDWriteFontSet* filtered_set;
        HRESULT hr = font_set->GetMatchingFonts(&property, 1, &filtered_set);

        if (FAILED(hr) || !filtered_set)
            continue;

        std::wcout << L"GetFontCount " << filtered_set->GetFontCount() << std::endl;

        filtered_set->Release();
    }

    font_set->Release();
    dwrite_factory->Release();

    return 0;
}

当前结论

初步判断这是Windows 11的系统bug,计划向微软反馈该问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.27 18:51:04