| 7 | std::unique_ptr<DWriteWrapper> gDWriteWrapper; |
| 8 | |
| 9 | DWriteWrapper::DWriteWrapper() |
| 10 | { |
| 11 | TCHAR dllPath[1024 + 64]; |
| 12 | DWORD dllPathSize = GetSystemDirectory(dllPath, 1024); |
| 13 | if (dllPathSize == 0) |
| 14 | { |
| 15 | Fail("Could not get system directory path"); |
| 16 | } |
| 17 | |
| 18 | wcscpy_s(dllPath + dllPathSize, std::size(dllPath) - dllPathSize, L"\\DWrite.dll"); |
| 19 | |
| 20 | dllHandle = LoadLibrary(dllPath); |
| 21 | if (dllHandle == NULL) { |
| 22 | Fail("Could not load DWrite.dll"); |
| 23 | } |
| 24 | |
| 25 | CreateFactory = (DWriteCreateFactoryProc)GetProcAddress(dllHandle, "DWriteCreateFactory"); |
| 26 | |
| 27 | if (CreateFactory == NULL) { |
| 28 | Fail("Could not locate DWriteCreateFactory in DWrite.dll"); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | DWriteWrapper::~DWriteWrapper() |
| 33 | { |