Search code examples
directxdirect3d

Use D3D9 Fonts by linking to Windows 10 SDK


Is it possible to use D3D9 fonts by linking to DirextX version in Windows 10 SDK ?

Below is the type of code I would like to run. But I can't find fonts supported in Windows 10 SDK

    D3DXFONT_DESC fontDesc;
    fontDesc.Height          = 80;
    fontDesc.Width           = 40;
    fontDesc.Weight          = FW_BOLD;
    fontDesc.MipLevels       = 0;
    fontDesc.Italic          = true;
    fontDesc.CharSet         = DEFAULT_CHARSET;
    fontDesc.OutputPrecision = OUT_DEFAULT_PRECIS;
    fontDesc.Quality         = DEFAULT_QUALITY;
    fontDesc.PitchAndFamily  = DEFAULT_PITCH | FF_DONTCARE;
    _tcscpy(fontDesc.FaceName, _T("Ariel"));

    D3DXCreateFontIndirect(gd3dDevice, &fontDesc, &mFont);

Solution

  • The Windows 10 SDK includes the 'core headers' for Direct3D 9 API, but does not contain the D3DX utility library. D3DX9, D3DX10, and D3DX11 are deprecated, and none of them are provided in the Windows 8.x SDK or Windows 10 SDK.

    You can still use the legacy, end-of-life DirectX SDK to get D3DX9. You can mix the legacy DirectX SDK with the Windows 10 SDK, but you need to use the reverse order for the include/lib paths. These details are on Microsoft Docs.

    Keep in mind that using D3DX also means your application continues to rely on the legacy DirectSetup which in many cases it could otherwise avoid using. See Not So Direct Setup.

    See Where is the DirectX SDK (2015 Edition)?

    Of course, Direct3D 9 itself is 'legacy'. There are replacements for all the D3DX functionality available if using Direct3D 11 or later. See Living without D3DX