Font Installtion

Got a problem you cannot solve? Try here.
Post Reply
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Font Installtion

Post by jimo »

How do I install a custom font on the target system?
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

Copy files into $WINDIR$\\Fonts
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Post by jimo »

Yes, but isn't there a command to install/register fonts, or should I force a reboot?
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

No, just copying the font files should be fine, I believe.
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Post 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?
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Post by jimo »

The corresponding Windows Installer standard action would be RegisterFonts
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

Thank you for reporting this.
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post 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~
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Post 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.
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post 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!
casic
Posts: 260
Joined: Thu Mar 17, 2005 4:02 am
Location: Germany
Contact:

Plugin for font installation available

Post 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
jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Post by jimo »

Works great thanks! Love your other plugins as well!
Post Reply