Difference between revisions of "Fonts"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(+Inno Setup script)
m
Line 48: Line 48:
  
 
== Inno Setup Script ==
 
== Inno Setup Script ==
Because I had problems with the registry setting I found another way to install fonts by writing an installer. [[Inno Setup]] makes makes this easy and a script like the following will package a number of fonts into a pseudo-application.
+
Because I had problems with the registry setting I found another way to install fonts by writing an installer. [[Inno Setup]] makes this easy and a script like the following will package a number of fonts into a pseudo-application.
  
 
<source lang=inno>
 
<source lang=inno>

Revision as of 07:22, 9 February 2010

This is a silent installer for distributing additional fonts. Always be sure to be entitled to use the fonts you are distributing.


basic info

To install new fonts on a Windows machine, you have to do two things:

  • copy the font file to %WINDIR%\Fonts\ directory,
  • add a registry entry.


example batch file

An example bat file will look like this:

%COMSPEC% /c copy /Y "%SOFTWARE%\Fonts\*.TTF" "%WINDIR%\Fonts\"
regedit /s "%SOFTWARE%\Fonts\add-fonts.reg"


example registry file

An example registry file will look like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Frankfurt Gothic (TrueType)"="FRANKGON.TTF"


example XML file for WPKG

<?xml version="1.0" encoding="UTF-8"?>
<packages>
<package id="additional-fonts" name="Additional fonts" revision="1" reboot="false" priority="950" execute="once">

  <install cmd='"%SOFTWARE%\Fonts\add-fonts.bat"' />

</package>
</packages>

Inno Setup Script

Because I had problems with the registry setting I found another way to install fonts by writing an installer. Inno Setup makes this easy and a script like the following will package a number of fonts into a pseudo-application.

[Files]
Source: C:\WINDOWS\Fonts\CALIBRI.TTF; DestDir: {fonts}; FontInstall: Calibri; Flags: onlyifdoesntexist uninsneveruninstall
Source: C:\WINDOWS\Fonts\FuturaStd-Book.otf; DestDir: {fonts}; FontInstall: FuturaStd-Book (OpenType); Flags: onlyifdoesntexist uninsneveruninstall fontisnttruetype
...

[Setup]
AppName=Font Installer
AppVerName=Font Installer 1.0
CreateAppDir=false
DisableProgramGroupPage=true
ShowLanguageDialog=no

The package definition would be

<package id="additional-fonts" name="Additional fonts" revision="10" reboot="false" priority="950">
  <check type="uninstall" condition="exists" path="Font Installer 1.0" />
  <install cmd='%SOFTWARE%\font-setup.exe /sp- /silent /norestart' />
  <upgrade cmd='%SOFTWARE%\font-setup.exe /sp- /silent /norestart' />
</package>