Page 1 of 1

Font Installtion

Posted: Tue Aug 30, 2005 6:31 pm
by jimo
How do I install a custom font on the target system?

Posted: Wed Aug 31, 2005 6:16 am
by sinan
Copy files into $WINDIR$\\Fonts

Posted: Wed Aug 31, 2005 9:25 am
by jimo
Yes, but isn't there a command to install/register fonts, or should I force a reboot?

Posted: Wed Aug 31, 2005 9:31 am
by sinan
No, just copying the font files should be fine, I believe.

Posted: Wed Aug 31, 2005 3:18 pm
by jimo
Copying does not work,

I read this in the winodws installer documentation:
Windows Installer
Font Table
The Font table contains the information for registering font files with the system.


The Font table has the following columns.

Column Type Key Nullable
File_ Identifier Y N
FontTitle Text Y



Columns


File_
External key into the File table entry for the font file. It is recommended that the component containing the font file have the FontsFolder specified in the Directory_ column of the Component table.
FontTitle
Font name. It is recommended that you leave this column null for TrueType Fonts and TrueType Collections because the installer can register the font after reading the correct font title from the font file. If the font name is entered, it must be identical to font title from the font file. You must specify a title for fonts that do not have embedded names, such as .fon files.

Remarks

This table is referred to when the RegisterFonts action or the UnregisterFonts action is executed.

If the FontTitle field is left Null, the Font name is read directly from the font file specified. If the font name recorded into the FontTitle field differs from the internal font name recorded in the font file, the font is registered twice by the RegisterFonts action.

Font files should not be authored with a language ID, as fonts do not have an embedded language ID resource.Thus the Language column of the File table should be left null for font files.

Because the installer does not refcount font files by default, preexisting font files may be removed with their component when uninstalling an application. To ensure that a font file is not removed, authors may set the msidbComponentAttributesSharedDllRefCount or msidbComponentAttributesPermanent bit flags in the Attributes column of the Component Table_msi_Component_Table for the component containing the font file.


It seems that windows installer has a method for this, can this functionality be exposed?

Posted: Wed Aug 31, 2005 3:23 pm
by jimo
The corresponding Windows Installer standard action would be RegisterFonts

Posted: Thu Sep 01, 2005 8:45 am
by sinan
Thank you for reporting this.

Posted: Thu Sep 01, 2005 9:58 am
by sinan
Please paste this code into your setup script - it contains the necessary API calls to register (and, optionally unregister) a font that has been copied over.

Code: Select all

~InstallAWARE Clipboard Data~
~Call DLL Function~
~{12574AA8-AF82-4E0B-86BB-1B5559164412}~
~gdi32.dll,RemoveFontResourceA,bool,,"pointer to string",$TARGETDIR$\\font.ttf,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Comment~
~{D716ED65-395B-488D-9DAB-A9BF18864D53}~
~Remove Font File~
~Call DLL Function~
~{48537E1C-E3F3-4F71-B09E-7F9754079EC0}~
~user32.dll,SendMessageA,long,,"double word",4294967295,"double word",29,"double word",0,"double word",0,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Comment~
~{361C97BD-6316-4EBC-A7B4-16C1D9215DF7}~
~Send WM_FONTCHANGE Message~
~Call DLL Function~
~{909CB40B-4E18-48D7-B3D7-A9B4209A04D3}~
~gdi32.dll,AddFontResourceA,long,,"pointer to string",$TARGETDIR$\\fontfile.ttf,$~
~mIDEFunc.dll\\mEXEFunc.dll~
~Comment~
~{444DD43F-C304-452B-9A71-FD416C2AF57F}~
~Add Font File~

Posted: Thu Sep 01, 2005 10:07 am
by jimo
Does the SendMessage call have to be placed after the UnRegister call in the uninstall sequence?

By the way, great response time, I really appreciate you guys.

Posted: Fri Sep 02, 2005 4:56 am
by sinan
I think you would only unregister during an uninstall, before Apply Uninstall is called, to deregister the fonts from the system.

And, you would register each font (or unregister each font), and then you would call the Send Message WinAPI at the end of the entire (un)registration sequence, to broadcast to applications the font table changes.

Thanks for your kind words - please help spread the word on InstallAware!

Plugin for font installation available

Posted: Sat Jan 07, 2006 3:30 pm
by casic
Hi,

I developed a plugin for easy and save font installation (Freeware!). More information is available here: http://www.installaware.com/forum/viewtopic.php?t=480.

cu

Markus

Posted: Tue Jan 17, 2006 3:20 pm
by jimo
Works great thanks! Love your other plugins as well!