Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Crazy Install Font Problem


1 reply to this topic

wornmj

wornmj
  • Members
  • 2 posts

Posted 04 May 2001 - 16:33

I'm trying to Install the Arial Black Font (ARIBLK.TTF).
On some Win2k Machines, the following happens.
My Install seems to run fine.
Looking at the Registry, HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts ONLY SHOWS the Arial Black Font!!! Refresh does nothing!!!
Looking at C:\WINNT\Fonts,
ONLY SHOWS the Arial Black Font!!! Refresh makes all pre-existing fonts Reappear!!!
Now Refresh registry and all fonts appear again!
I don't know what's going on. MSDN is no help.
The worst symptom is that if the user runs the uninstall without this quirky refresh process. The uninstall properly uninstalls the font. If the user now shuts down (having uninstalled every font seemingly on their machine (the one arial black)) they will not be able to restart their machine.
Thanks,
Mike Worn
Here are the snippets of code that pertain to the problem:
////////////////////// string defines ////////////////////////////
#define HWND_BROADCAST 0xFFFF
#define WM_FONTCHANGE 0x001D
...
// your script function prototypes
prototype InstallArialBlackFont();
prototype INT GDI32.AddFontResourceA(STRING);
...
// your global variables
BOOL bMakeFontAvailable;
NUMBER nFontResult;
STRING sFontFileTTF;
...
// MAIN PROGRAM
program
bMakeFontAvailable = FALSE;
...
function ProcessBeforeDataMove()
// TO DO : any other tasks you want to perform before file transfer
InstallArialBlackFont();
...
function ProcessAfterDataMove()
//Activate Ariblk.ttf font
// Add it to the current system so won't have to restart Windows.
if(bMakeFontAvailable) then
 nFontResult = AddFontResourceA(sFontFileTTF);
 SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
 if (nFontResult = 0) then
   MessageBox("Failed to make the Arial Black font available immediately." +
" To use this font you must restart your system after the " +
"installation is finished.", WARNING);
 endif;
endif;
...
function SetupRegistry()
// Register the Arial Black font
if (bIsWindowsNT) then
 nResult = CreateRegistrySet ( "Font_ARIBLK_NT" );
else
 nResult = CreateRegistrySet ( "Font_ARIBLK_9X" );
endif;
...
// Note: The registry files contain the following, respectively:
// [Font_ARIBLK_NT:HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
// Arial Black (TrueType)=S,ARIBLK.TTF
// [Font_ARIBLK_9X:HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts]
// Arial Black (TrueType)=S,ARIBLK.TTF
...
///////////////////////////////////////////////////////////////////////////////
//
// Function: InstallArialBlackFont
//
// Purpose: This function will install the Ariblk.ttf font if it does not
// exist."
///////////////////////////////////////////////////////////////////////////////
function InstallArialBlackFont()
STRING sKey, svResult, sFontDir, sFont;
STRING sSrcDir, svValue;
NUMBER nResult, nvSize, nvType;
begin
// Inititialize stuff.
bMakeFontAvailable = FALSE;
sFontFileTTF = "ARIBLK.TTF";
// Set font registry location.
if (bIsWindowsNT) then
 sKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
else // bWin95
 sKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts";
endif;
// Set font target directory.
// bWin95 and bWinNT40
sFontDir = WINDIR ^ "FONTS";
// See if the font file already exists.
if (FindFile(sFontDir, sFontFileTTF, svResult) < 0) then
 // We DON'T have a Ariblk.TTF file.
 // Copy the file.
 nResult = ComponentSelectItem(MEDIA, "Fonts", TRUE);
 bMakeFontAvailable = TRUE;
else
 RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
 // We DO have a Ariblk.TTF file. Make sure it has a registry entry.
 if (RegDBGetKeyValueEx(sKey, "Arial Black (TrueType)", nvType, svValue, nvSize) < 0) then
   nResult = ComponentSelectItem(MEDIA, "Fonts", TRUE);
   bMakeFontAvailable = TRUE;
 endif;
 RegDBSetDefaultRoot ( HKEY_CLASSES_ROOT );
endif;
end;