Installing Fonts in Windows95 and NT
Keywords: fonts
Question:
Does anyone have any examples of how to install fonts in Windows 95?Answer:
This code seems to work:;Installing a font in Windows 95/98/ME ;---------------------------------------- ;Get path to font directory and copy font FontDir=RegQueryEx(@REGCURRENT,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders[Fonts]","",1) FileCopy("myfont.ttf",FontDir,@FALSE) ;Register font FontKey=RegOpenKey(@REGMACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts") RegSetValue(FontKey,"[My Font (TrueType)]","myfont.ttf") RegCloseKey(FontKey) ;Add the font to the font system DllName=StrCat(DirWindows(1),"gdi32.dll") DllCall(DllName,WORD:"AddFontResourceA",lpstr:"myfont.ttf") ;Inform running apps about the new font IntControl(22,-1,29,0,0)
;Installing a font in Windows NT/2000/XP ;---------------------------------------- ;Get path to font directory and copy font FontDir=RegQueryEx(@REGCURRENT,"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders[Fonts]","",1) FileCopy("myfont.ttf",FontDir,@FALSE) ;Register font FontKey=RegOpenKey(@REGMACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts") RegSetValue(FontKey,"[My Font (TrueType)]","myfont.ttf") RegCloseKey(FontKey) ;Add the font to the font system DllName=StrCat(DirWindows(1),"gdi32.dll") DllCall(DllName,LONG:"AddFontResourceA",lpstr:"myfont.ttf") ;Inform running apps about the new font IntControl(22,-1,29,0,0)The last line is only needed if currently running applications should be informed about the font addition. All apps started after the installation will recognize the new font even without the IntControl call.
Question:
Is there a message I can send to WordPad, or Windows itself, that will force WordPad to update its fonts for an open document? I only suspect there is because half of the time it updates itself properly.Answer:
The message is being sent...but it is up to the applications themseleves to do something about the message when they receive it.Apparently WordPad has a bug or something in it.
It is not the usual case to install a new font then expect running applications to honor it.
Article ID: W13399Filename: Installing Fonts in Windows 95 - NT.txt