Requirement: Use a newly added font (copied to \Windows) immediately without the need for a soft-reset.
I have tried AddingFontResource()
bundled with SendingMessage(WM_FONTCHANGE)
, but to no avail.
Background: I'm developing an application that's shipped as a .cab file which includes several Hebrew fonts with it. At the end of the installation I run a program that handles the registration and which displays several MessageBox()'s
in Hebrew, but I'm getting boxes instead of Hebrew characters.
All help is appreciated.
Code:
AddFontResource(L"\\Windows\\Arial.ttf");
::SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
MessageBox(L"HEBREW CHARS TURN TO BOXES");
pEdit = (CEdit*)GetDlgItem(IDC_CODE);
CFont *pFont = new CFont;
pFont->CreateFont(20,0,0,0,FW_NORMAL,0,0,0,0,0,0,0,0,L"Arial");
pEdit->SetWindowText(L"BUT HERE THEY'LL LO开发者_运维技巧OK GOOD");
pEdit->SetFont(pFont);
AddFontResource works fine for me. How are you checking for font availability?
EDIT
Check the exact name you are passing to CreateFont - it must match the name being returned by EnumFonts. I would expect it to be "Arial" from your file name, but that's not a given - it could easily be something else (i.e. something more verbose).
You should deploy the fonts to the fonts folder: \Windows\Font\
精彩评论