Skip to content

Commit bf5fbdd

Browse files
committed
fix(@angular-devkit/build-angular): inlining of fonts results in jagged fonts for Windows users
We now replace the user agent string used to perform font inlining with a Windows one. This is because Google fonts will including hinting in fonts for Windows. Hinting is a technique used with Windows files to improve appearance however results in 20-50% larger file sizes, however this will make the fonts display correctly on all platforms. More information about this can be found in: - https://fonts.google.com/knowledge/glossary/hinting - https://glyphsapp.com/learn/hinting-manual-truetype-hinting - http://google3/java/com/google/fonts/css/OpenSansWebFontsCssBuilder.java?l=22 Closes #22248
1 parent 125fb77 commit bf5fbdd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/angular_devkit/build_angular/src/utils/index-file/inline-fonts.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,17 @@ export class InlineFontsProcessor {
211211
{
212212
agent,
213213
headers: {
214+
/**
215+
* Always use a Windows UA. This is because Google fonts will including hinting in fonts for Windows.
216+
* Hinting is a technique used with Windows files to improve appearance however
217+
* results in 20-50% larger file sizes.
218+
*
219+
* @see http://google3/java/com/google/fonts/css/OpenSansWebFontsCssBuilder.java?l=22
220+
* @see https://fonts.google.com/knowledge/glossary/hinting (short)
221+
* @see https://glyphsapp.com/learn/hinting-manual-truetype-hinting (deep dive)
222+
*/
214223
'user-agent':
215-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36',
224+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
216225
},
217226
},
218227
(res) => {

0 commit comments

Comments
 (0)