Advanced Font Installation: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 11: Line 11:


== Description ==
== Description ==
This page uses the functionality of the [[FontName plugin]]. This will allow you to register TTF fonts without the need to supply the font's registry name. The second macro is designed to register FON fonts and still requires the input of the font's name. If you do not wish to use the FontName plugin you should use the FON font macro to install TTF fonts.
This page uses the functionality of the [[FontName plugin]]. This will allow you to register TTF fonts without the naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
These macros have been designed to work with NSIS 2.0b4 (CVS), although it could possibly be modified to work with earlier versions of NSIS.
 
These macros allow the user to uninstall fonts in the uninstaller as does the [[Register Fonts|standard version]] the main difference being that if you define FontBackup to a 'registry store' of the fonts the installer created it will only remove fonts that were not present before the program was installed.
 
''Please note that uninstalling fonts is generally not a good idea since other programs might depend on them. Exceptions would be custom created fonts which would only be used by your program or when installing an *huge* amount of fonts.''
 
Save this script as a NSIS Include file in the Include directory of NSIS so that then you can easily get font registration functionality in any script by simply including this file. (Suggested file name: FontRegAdv.nsh)
 
 


== Version History ==
== Version History ==

Revision as of 10:01, 1 January 2006

Author: Vytautas (talk, contrib)


Note

This script is now included in the FontName plugin by default. The newest version of the script also includes code from other scripts as noted in the actual script.

A few notes about using InstallFON macro: You should copy the 'FontName' out of the registry of the Source machine as the fonts might not work if the wrong name or type is specified. The location of the fonts folder can be attained in a number of different ways, reading a registry key from the target machine or the way shown below, obtained from an example by Joel. Note that this way uses the System plug-in and if the size of your installer is a *very* big issue reading the registry might save a few bytes in the final installer size.

Some recent bugs: Do not put a trailing backslash onto the $FONT_DIR. This will make the font install, but be 0 Kilabytes. Some all uppercase font filenames generate errors. By changing the font to all lowercase, the font was automagically found.

Description

This page uses the functionality of the FontName plugin. This will allow you to register TTF fonts without the naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Version History

[Update 2005-10-23]
Fixed problem with installation not working when font file was in a different folder as reported by Francois Gelinas
[Update 2005-01-18]
Fixed problem with FON installation as reported by Francois Gelinas
[Update 2004-01-29]
Updated to use FontName v0.6
[Update 2003-12-29]
Added definition of CSIDL_FLAG_CREATE flag.
[Update 2003-12-28]
Added a note about $FONTS variable first included in NSIS v2.0rc1
[Update 2003-12-23]
Fixed some typos in the documentation and notes.
[Update 2003-12-07]
Fixed problem with remove macros removing only the first font, thanks to lewellyn for bug report and solution.
[Update 2003-12-05]
Added a note about the font filenames and macro usage if fonts not in the same folder as the script.
[Update 2003-11-28]
Fixed problem with TTF font installation on Windows 9x with help from brainsucker and kichik. Added error reporting functionality for the FontName plugin.
[Update 2003-11-21]
Fixed macro name mismatch.

Vytautas