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

Install fonts...


2 replies to this topic

briglass

briglass
  • Members
  • 7 posts

Posted 29 July 2003 - 17:40

Hello huh.gif

Is it possible to use InstallShield Professional 5 to install fonts with an installation?

My program requires a certain font, and I would like to be able to install one along with it.

Thanks, biggrin.gif
Brian

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 29 July 2003 - 20:00

Yes. See InstallScript Samples -> Operating System -> Font Installation

briglass

briglass
  • Members
  • 7 posts

Posted 29 July 2003 - 20:15

blink.gif

Are you saying that I have to use this lengthy code block:

CODE

STRING szFileTTF, sfFileFot, svResult, svFontFile,svFontDir,
svFontBackup, svFontName;
STRING svttfFile, svfotFile, szKey, szInfo,svValue;
NUMBER nResult, nvType, nvSize,nvResult;
BOOL bReplace, bWin16,bWin31, bWin95, bWin98, bWinNt,bWin351;
STRING svLogFile;
INT NVResult;

#define HWND_BROADCAST 0xFFFF
#define WM_FONTCHANGE 0x001D

prototype INT GDI32.AddFontResource(BYREF STRING);

program

if (GetSystemInfo (OS, nvResult, svResult) < 0) then

   szInfo = "Couldn't get Operating System info.";
else
switch (nvResult)
   case IS_WINDOWS:
       szInfo = "OS: Windows 3.1";
       bWin31 = TRUE;

   case IS_WINDOWSNT:
       GetSystemInfo ( OSMAJOR , nvResult , svResult );
       if (nvResult < 4) then
           bWin351 = TRUE;
       else
           bWinNt = TRUE;
       endif;
       szInfo = "OS: Windows NT";


   case IS_WINDOWS9X:
       GetSystemInfo (WINMINOR, nvResult, svResult);
       if (nvResult < 10) then
           szInfo = "OS: Windows 95";
           bWin95 = TRUE;
       else
           szInfo = "OS: Windows 98";
           bWin98 = TRUE;
       endif;


endswitch;
endif;

//Set up uninstall
TARGETDIR = WINDIR^"TEMP";
InstallationInfo("FONT COMPANY", "FONT INSTALLER", "1.0", "arlrdbd.fot");
DeinstallStart(TARGETDIR, svLogFile, "UNINSTALL KEY" ,0);
RegDBSetItem(REGDB_UNINSTALL_NAME, "Font Installer");


//Do Font Installation
svfotFile = "ARLRDBD.FOT";
svttfFile = "ARLRDBD.TTF";
szKey = "SOFTWARE\MICROSOFT\WINDOWS";

if((bWinNt)|| (bWin351)) then
   szKey = szKey+ " NT";
endif;
szKey = szKey +"\CurrentVersion\Fonts";
nvType =REGDB_STRING;
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
RegDBGetKeyValueEx ( szKey , "Arial Rounded MT Bold (TrueType)" , nvType , svValue , nvSize );

if (svValue != svttfFile) then
   MessageBox ( "Font does not exist, ready to add" , INFORMATION );

   if (bWinNt || bWin95 || bWin98)then
       svFontDir = WINDIR^"Fonts";
   elseif (bWin351) then
       svFontDir = WINSYSDIR;
    endif;
   TARGETDIR=svFontDir;
   svFontFile = svFontDir^svttfFile;
   svFontBackup= svFontDir^svttfFile;
   nResult = FindFile(svFontDir, "Arlrdbd.ttf", svResult);
   bReplace = FALSE;
   if (nResult = 0) then
        nResult = AskYesNo("The File" + svttfFile + "was found in the windows font"+
      " folder. Do you want to replace it?"+
       "(If you answer NO the installation will use         this as the font.)",
       NO);
       if (nResult=YES) then
           VarSave(SRCTARGETDIR);
           SRCDIR=TARGETDIR;
           DeleteFile("ARLRDBD.BAK");
           RenameFile("ARLRDBD.TTF", "ARLRDBD.BAK");
           VarRestore(SRCTARGETDIR);
       endif;
   endif;
   nResult = CopyFile(svttfFile, svttfFile);
   if (nResult < 0) then
       MessageBox("CopyFile function failed", INFORMATION);
   endif;
   MessageBox(" the font file is " + svttfFile, INFORMATION);

   RegDBSetKeyValueEx ( szKey , "Arial Rounded MT Bold TrueType" , REGDB_STRING , svFontFile , -1 );
   nResult = AddFontResource(svFontFile);
   SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
   if (nResult !=0) then
       MessageBox ( "The Font was added successfully." , INFORMATION );
   else
       MessageBox("The Font Already Exists", INFORMATION);
   endif;

 endif;


endprogram


That seems a bit absurd...

Where does this go, anyway? In the script??

I've been using InstallShield Express 3.5 and am now forced to revert to InstallShield Professional 5 because InstallShield Express has no option that keeps installer from reloading ODBC connections every time the application runs...

Do you happen to know of a way to do that? I really don't want to have to go through the complexities involved in InstallShield Pro 5... if that is how hard it is to get a font installed, who knows how difficult it is to make an ODBC connection!

dry.gif

Edited by briglass, 29 July 2003 - 20:17.