Skip to content

Commit 58489a7

Browse files
committed
Minor corrections, added FontInstallationIssues
1 parent bc7b0ad commit 58489a7

File tree

4 files changed

+139
-8
lines changed

4 files changed

+139
-8
lines changed

FontInstallationIssues.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#Font Installation Issues
2+
3+
When creating this setup, and when deploying this setup to 200+ machines, I faced some issues that come from the fact that Windows is not very smart when handling fonts. This file lists the issues I'm aware of.
4+
5+
##Font files can be damaged
6+
7+
For whatever reason, sometimes the *.ttf files are broken and depending how exactly they are broken can lead to all sorts of effects, from "Font can't be used" to "Some glyphs are broken".
8+
9+
*OSFontPack.exe* uses SHA-1 hashes to compare the files that should be installed with the files actually installed. This has the side effect that always the files included with the setup are installed, even if one font file was already manually updated to a newer version.
10+
11+
##The FONTS applet might save fonts as (Fontname)_X.ttf
12+
13+
When copying TTF files by simply dropping them onto the *Fonts* applet from Control Panel and the file that is copied is currently locked in *C:\WINDOWS\FONTS*, the applet will just append `_0` to the filename without extension and register this new file to the registry. For example, dropping `Hack-Regular.ttf` to FONTS when this file is locked will save the file as `Hack-Regular_0.ttf` to *C:\WINDOWS\FONTS*.
14+
15+
Depending on the application and the caching method it can happen that the application continues to use the old font file.
16+
17+
*OSFontPack.exe* will delete any *(Fontname)_X.ttf* for each font file it installs. However, if a font file was renamed, *OSFontPack.exe* won’t delete the old _0.ttf file because this deletion is executed upon installation and depends on the current font names.
18+
19+
##Some fonts can be locked when in use
20+
21+
As soon as a font is used, the TTF file for it is locked and can’t be updated to a newer version.
22+
23+
*OSFontPack.exe* will try to replace any locked file five times and if this doesn’t work, it will use `PendingFileOperations` to replace the file in question upon next boot.
24+
25+
##The FontCache service can lock fonts during installation
26+
27+
For performance reasons, Windows includes a cache for all installed fonts. Because it is sometime to “eager” to read the information from a file, the installation can fail because the file is locked during the installation.
28+
29+
*OSFontPack.exe* will stop `FontCache` (and `FontCache3.0.0.0` for .NET if it exists) during installation.
30+
##The font data in the registry and the font files can be different
31+
32+
Depending what else has gone wrong, the font registration data (Name and File) inside the registry can be different from the actual fonts installed in C:\WINDOWS\FONTS. When this happens, the fonts can go “crazy” - see issue [#152 for Hack](https://github.com/chrissimpkins/Hack/issues/152).
33+
34+
*OSFontPack.exe* will ensure that the files and the registration data are exactly as desired and reinstall the font if this is not the case.
35+
36+
##A new font is not visible directly after installation
37+
38+
When a new font is installed, Windows expects the broadcast message WM_FONTCHANGE before the font can be used.
39+
40+
*OSFontPack.exe* will sent this message if any new font is installed. However, some applications do not react on this message so a restart will be requested when the installation is finished.
41+
42+
##A font cannot be updated without restart
43+
44+
The [MSDN docs](https://msdn.microsoft.com/en-us/library/windows/desktop/dd183326%28v=vs.85%29.aspx) say that a call to RemoveFontResource() requires a restart before this font is really removed. However, it does not say anything if updating a font also requires this. Based on the current findings, I think it is required.
45+
46+
*OSFontPack.exe* will always request a restart when the installation is finished.
47+
48+
49+
##Not fixed: The cache files of the FontCache service can be corrupted
50+
51+
This issue is not yet fixed by *OSFontPack.exe* mostly because I never experienced this defect.
52+
53+
Both font cache services (FontCache and FontCache3.0.0.0) use cache files stored in *C:\Windows\ServiceProfiles\LocalService\AppData\Local\*. When these files become corrupted, the services might hang and the entire font handling goes haywire.
54+
55+
The solution in this case is to stop both services, delete the file `FontCache3.0.dat` as well as renaming the folder `FontCache` and recreating a new empty folder with the same name.
56+
57+
After that, restart the computer.
58+
59+
60+
----------
61+
2016-03-30
62+
~Michael 'Tex' Hex
63+

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ A Windows installer for [Hack](https://github.com/chrissimpkins/Hack).
88
- Run HackWindowsInstaller.exe
99
- Follow the instructions
1010

11+
## Why this project exists
12+
13+
It might seem to be overkill to have an installation tool just for some fonts, but a lot of things can go wrong when trying to install or update them manually (see [issue #152](https://github.com/chrissimpkins/Hack/issues/152) in the Hack repository).
14+
15+
The installer can prevent most of these issues. A (not complete) list of things that can go wrong can be found in [FontInstallationIssues.md](https://github.com/source-foundry/Hack-windows-installer/blob/master/FontInstallationIssues.md).
16+
1117
## Silent Installation
1218

1319
To install silently, use the following command:
@@ -28,6 +34,8 @@ If you are using EMET: If the "Only trusted fonts" option is activated, you need
2834

2935
Any constructive contribution is very welcome! If you have any question or encounter a bug, please create a new [issue](https://github.com/source-foundry/Hack-windows-installer/issues/new).
3036

37+
## Why does this
38+
3139
## Build from source
3240

3341
To build this setup yourself, download the newest ANSI (not unicode) version of [Inno Setup](http://www.jrsoftware.org/isdl.php). Install it and activate the option to install the [Inno Setup Preprocessor](http://www.jrsoftware.org/ispphelp/).

src/HackWindowsInstaller.iss

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
//#define DEBUG
1919

2020
//Update this when releasing a new version
21-
#define public Version '1.0.0'
21+
#define public Version '1.0.1'
2222

2323
//This defines in which sub folder of this project the current files are located
2424
#define public HackMonospaced_Sourcefolder 'Hack_v2_019'
2525

26-
//URL of the project homepage of the FONT
27-
#define public HackMonospaced_Homepage 'http://sourcefoundry.org/hack/' /*'https://github.com/chrissimpkins/Hack'*/
26+
//This definies the version of Hack monospaces
27+
#define public HackMonospaced_Version '2.019'
28+
29+
2830

2931

3032
//--------------------------------------------------------------------
@@ -35,6 +37,12 @@
3537
//Name of this setup
3638
#define public AppName 'Hack Windows Installer'
3739

40+
//URL of the project homepage of the FONT
41+
#define public HackMonospaced_Homepage 'http://sourcefoundry.org/hack/' /*'https://github.com/chrissimpkins/Hack'*/
42+
43+
//URL of the installer homepage
44+
#define public Installer_Homepage 'https://github.com/source-foundry/Hack-windows-installer'
45+
3846
//Copyright information
3947
#define public Copyright 'Copyright © 2016 Michael Hex / Source Foundry'
4048

@@ -129,7 +137,7 @@ VersionInfoVersion={#Version}
129137

130138
AppPublisher=Michael Hex / Source Foundry
131139
AppContact=Michael Hex / Source Foundry
132-
AppSupportURL={#HackMonospaced_Homepage}
140+
AppSupportURL={#Installer_Homepage}
133141
AppComments=Hack font installer
134142
AppCopyright={#Copyright}
135143

@@ -235,6 +243,16 @@ Filename: "{app}\InstallInfo.ini"; Section: "Main"; Key: "Name"; String: "{#AppN
235243
Type: files; Name: "{app}\InstallInfo.ini"
236244

237245

246+
[Messages]
247+
;Message for the "Read to install" wizard page
248+
;"Ready To Install"
249+
;WizardReady=
250+
251+
;"Setup is now ready to begin installing ...."
252+
ReadyLabel1=
253+
;"Click Install to continue with the installation"
254+
ReadyLabel2b=Setup is now ready to install the Hack fonts v{#HackMonospaced_Version} on your system.
255+
;%n%nClick Install to continue.
238256

239257

240258
[Code]
@@ -478,6 +496,20 @@ begin
478496
end;
479497
480498
499+
{ //Not used right now - See [Messages]
500+
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
501+
var
502+
text:string;
503+
begin
504+
text:='';
505+
text:=text + 'Setup is now ready to install Hack v2.XXX on your system' + NewLine;
506+
text:=text + NewLine;
507+
text:=text + 'Click Install to continue.' + NewLine;
508+
509+
result:=text;
510+
end;
511+
}
512+
481513
482514
//This function returns TRUE if:
483515
// - the SHA1 hash of a file inside Windows\fonts is the same as the hash we have calculated

src/HackWindowsInstaller_TEMP_Preprocessed.iss

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919

2020

21+
22+
2123
; ISPP: Base Path C:\dev\git\Hack-windows-installer\
2224

2325

@@ -38,6 +40,8 @@
3840

3941

4042

43+
44+
4145

4246

4347

@@ -73,12 +77,12 @@ AppId=HackWindowsInstaller
7377
SetupMutex=HackWindowsInstaller_SetupMutex
7478

7579
AppName=Hack Windows Installer
76-
AppVersion=1.0.0
77-
VersionInfoVersion=1.0.0
80+
AppVersion=1.0.1
81+
VersionInfoVersion=1.0.1
7882

7983
AppPublisher=Michael Hex / Source Foundry
8084
AppContact=Michael Hex / Source Foundry
81-
AppSupportURL=http://sourcefoundry.org/hack/
85+
AppSupportURL=https://github.com/source-foundry/Hack-windows-installer
8286
AppComments=Hack font installer
8387
AppCopyright=Copyright © 2016 Michael Hex / Source Foundry
8488

@@ -170,14 +174,24 @@ Type: files; Name: "{fonts}\Hack-RegularOblique.ttf";
170174

171175
[INI]
172176
;Create an ini to make detection for enterprise deployment tools easy
173-
Filename: "{app}\InstallInfo.ini"; Section: "Main"; Key: "Version"; String: "1.0.0"
177+
Filename: "{app}\InstallInfo.ini"; Section: "Main"; Key: "Version"; String: "1.0.1"
174178
Filename: "{app}\InstallInfo.ini"; Section: "Main"; Key: "Name"; String: "Hack Windows Installer"
175179

176180
[UninstallDelete]
177181
;Delete Install Info
178182
Type: files; Name: "{app}\InstallInfo.ini"
179183

180184

185+
[Messages]
186+
;Message for the "Read to install" wizard page
187+
;"Ready To Install"
188+
;WizardReady=
189+
190+
;"Setup is now ready to begin installing ...."
191+
ReadyLabel1=
192+
;"Click Install to continue with the installation"
193+
ReadyLabel2b=Setup is now ready to install the Hack fonts v2.019 on your system.
194+
;%n%nClick Install to continue.
181195

182196

183197
[Code]
@@ -399,6 +413,20 @@ begin
399413
end;
400414
401415
416+
{ //Not used right now - See [Messages]
417+
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
418+
var
419+
text:string;
420+
begin
421+
text:='';
422+
text:=text + 'Setup is now ready to install Hack v2.XXX on your system' + NewLine;
423+
text:=text + NewLine;
424+
text:=text + 'Click Install to continue.' + NewLine;
425+
426+
result:=text;
427+
end;
428+
}
429+
402430
403431
function IsSetupFontSameAsInstalledFont(fileName:string):boolean;
404432
var

0 commit comments

Comments
 (0)