Skip to content

Commit 7e4f18a

Browse files
committed
Added note about file deletion process
1 parent 785ba1a commit 7e4f18a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

FontInstallationIssues.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
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.
44

5+
56
## Font files can be damaged
67

78
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".
89

910
*HackWindowsInstaller* 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.
1011

12+
1113
## The FONTS applet might save fonts as (Fontname)_X.ttf
1214

1315
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*.
@@ -16,36 +18,44 @@ Depending on the application and the caching method it can happen that the appli
1618

1719
*HackWindowsInstaller* will delete any *(Fontname)_X.ttf* for each font file it installs. However, if a font file was renamed, *HackWindowsInstaller* won’t delete the old _0.ttf file because this deletion is executed upon installation and depends on the current font names.
1820

19-
## Some fonts can be locked when in use
21+
22+
## Font files can be locked
2023

2124
As soon as a font is used, the TTF file for it is locked and can’t be updated to a newer version.
2225

23-
*HackWindowsInstaller* 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.
26+
*HackWindowsInstaller* 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.
27+
28+
For files that only need to be deleted (not updated), *HackWindowsInstaller* will also use `PendingFileOperations` if they can not be deleted.
29+
2430

2531
## The FontCache service can lock fonts during installation
2632

2733
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.
2834

2935
*HackWindowsInstaller* will stop `FontCache` (and `FontCache3.0.0.0` for .NET if it exists) during installation.
3036

37+
3138
## The font data in the registry and the font files can be different
3239

3340
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).
3441

3542
*HackWindowsInstaller* will ensure that the files and the registration data are exactly as desired and reinstall the font if this is not the case.
3643

44+
3745
## The regular variant of a font can be registered as "Regular"
3846

3947
When installing a font using the *Fonts* applet from Control Panel it sometimes registers this variant as “Regular” although Windows does not expect “Regular” to be used. This can lead to a situation where two font files are registered for the “Regular” variant and causing display issues.
4048

4149
*HackWindowsInstaller* will delete any found registry entry for “Hack Regular”.
4250

51+
4352
## A font subsitute could be defined
4453

4554
It is possible using the registry location *HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes* to define an "alias" for a font that is mapped to a different font. For example, it is possible to define that Windows will use "Arial" when the font "Hack (Italic)" is requested. This can cause all sort of display problems.
4655

4756
*HackWindowsInstaller* will delete any found substitutes for the font that is installed.
4857

58+
4959
## A font cannot be updated without restart
5060

5161
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.

0 commit comments

Comments
 (0)