123456789101112131415161718192021222324
CHOOSEFONT cf; LOGFONT log; //Setting the CHOOSEFONT structure cf.lStructSize = sizeof(CHOOSEFONT); cf.hwndOwner = (HWND) NULL; cf.lpLogFont = &log; cf.Flags = CF_SCREENFONTS; cf.rgbColors = RGB(0,0,0); cf.lCustData = 0L; cf.lpfnHook = (LPCFHOOKPROC)NULL; cf.lpTemplateName = (LPCWSTR)NULL; cf.hInstance = (HINSTANCE) NULL; cf.lpszStyle = (LPWSTR)NULL; cf.nFontType = SCREEN_FONTTYPE; cf.nSizeMin = 24; if(ChooseFont(&cf) == TRUE) { HRESULT hr = pDWFactory->CreateTextFormat(log.lfFaceName, NULL, (DWRITE_FONT_WEIGHT)log.lfWeight, log.lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL,(FLOAT)cf.iPointSize/10, _T(""), &pTF); }