I wrote a small utility that can aid in installing fonts during a unattended installation. The utility is silent, in that, it has no display or interface. It will run silently in the background and do it's work then exit. It has only one argument. If the user wishes (it's preferred) the directory containing the fonts to be installed can be specified as the one argument. If no argument is given, it uses the working directory.
How it works
First, it gets a list of all the files in the working/specified directory, then it processes all the ones that have the .ttf (.TTF) extension. After it gets it's list, it copies each of the files to %SYSTEMROOT%\Fonts and creates registry entries for each of the fonts. Unfortunately, I don't know of any available API for Java that can parse a TTF and retrieve the font name, so the entries in the registry are labeled "System Installed Font (# ?)" where ? is the number that font was processed.
After a reboot the fonts are all available with their proper names. So you won't have to worry about opening Word and seeing "System Installed Font (# 12)" in the font selector.
The utility depends on the presence of the REG.EXE tool. If this tool doesn't exist or isn't in your path, the program will fail but will not display any errors.
How to make it work
The whole purpose behind using this tool is so that when the system boots for the first time, the fonts are available without user interaction. So the tool will need to be run during GUI-mode or during RunOnceEx if your setup automatically reboots at the end. Remember: the system must be rebooted before the fonts will appear. That's why it's best to do it during GUI-mode. The best way (according to me) is to run it during [SetupParams] in WINNT.SIF.
Here's an example using [SetupParams] in WINNT.SIF
... [SetupParams] UserExecute="%SYSTEMDRIVE%\Fonts\typer.exe %SYSTEMDRIVE%\Fonts" ...
Here's an example using cmdlines.txt:
D:\ (ROOT OF CD) -$OEM$ -$$ -$1 -Fonts -FONT1.TTF -FONT2.TTF -another.ttf -... -typer.exe -cmdlines.txt -fonts.cmd
cmdlines.txt
[COMMANDS] ... "fonts.cmd" ...
fonts.cmd
%SYSTEMROOT%\SYSTEM\CMDOW @ /HID @echo off %SYSTEMDRIVE% cd Fonts start /wait typer.exe exit
That's one way to do it. I'm experimenting with different ways to clean it up so it's completely silent and the end-user is oblivious to what's going on.
The utility was written in Java, but was compiled to native code using GCJ and packed using UPX.
Below is a link to a zipped copy of the native binary. Source is included and will successfully compile and run with Sun Java 1.5 (bytecode) and GNU GCJ 3.4.0 (native and bytecode).
License: You may use this utility as you see fit and may use it's source as you see fit. This utility has NO warranty. I have tested it and it works fine for me, but don't blame me if you use it and it destroys the world.
Note: I've tested it on already-installed systems and on my unattended CD. Both times, the utility performed appropriately.
Download: typer.zip Size: 1.26 MB (1,292 KB)
This post has been edited by tosk: 17 October 2006 - 08:31 AM



Help
Back to top










