You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: FontInstallationIssues.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,14 @@
2
2
3
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
4
5
+
5
6
## Font files can be damaged
6
7
7
8
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
9
10
*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.
10
11
12
+
11
13
## The FONTS applet might save fonts as (Fontname)_X.ttf
12
14
13
15
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
16
18
17
19
*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.
18
20
19
-
## Some fonts can be locked when in use
21
+
22
+
## Font files can be locked
20
23
21
24
As soon as a font is used, the TTF file for it is locked and can’t be updated to a newer version.
22
25
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
+
24
30
25
31
## The FontCache service can lock fonts during installation
26
32
27
33
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
34
29
35
*HackWindowsInstaller* will stop `FontCache` (and `FontCache3.0.0.0` for .NET if it exists) during installation.
30
36
37
+
31
38
## The font data in the registry and the font files can be different
32
39
33
40
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).
34
41
35
42
*HackWindowsInstaller* will ensure that the files and the registration data are exactly as desired and reinstall the font if this is not the case.
36
43
44
+
37
45
## The regular variant of a font can be registered as "Regular"
38
46
39
47
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.
40
48
41
49
*HackWindowsInstaller* will delete any found registry entry for “Hack Regular”.
42
50
51
+
43
52
## A font subsitute could be defined
44
53
45
54
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.
46
55
47
56
*HackWindowsInstaller* will delete any found substitutes for the font that is installed.
48
57
58
+
49
59
## A font cannot be updated without restart
50
60
51
61
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