For the reminder of this tip, "windows" and "c:\windows" directories will naturally refer to the directory where your version of windows is installed in and "myfont.ttf" will refer to the name of the font file you're about to install.
First of all, you must make sure that the fonts you're about to install does not already exist on the system. Before we get into how to do this, let's go through the final steps of installing fonts:
Windows 3.x / Delphi 1.x
AddFontResource( 'c:\windows\system\myfont.ttf' ); SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 ); |
Windows 95, Windows NT 3.x, Windows NT 4.x
AddFontResource( 'c:\windows\system\myfont.ttf' ); { or } AddFontResource( 'c:\windows\fonts\myfont.ttf' ); { and } SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 ); |
Each font listing
should have the following format:
key name: <name of the font>
key data: <path to the font file>
for example:
"My Font (True Type)"
c:\windows\fonts\myfont.ttf
Now, back to the tricky part -- verifying if the font you're about to install isn't already installed on the system. This is very important; if you install your new font over an existing font, you may experience random [fonts related] problems.
If you're using win 3.1, you should get a list of installed fonts from the WIN.INI "[fonts]" section.
If you're using Windows 95 or Windows NT, you should get a list of installed fonts using the EnumFontFamilies() function. The actual font names could be found by looking in the following registry key:
HKEY_LOCAL_MACHINE\
SOFTWARE\Microsoft\Windows[NT]\CurrentVersion\Fonts
Once you have a list of installed fonts, compare them against the font you're about to install and make sure that...
It does not exist/not installed, or [if it's already installed,] the currently installed version of the font is older than the version you're about to install.