Skip to content

Commit a5f9488

Browse files
authored
Merge pull request #4146 from magento-panda/MC-16046
Fixed issues: - MC-16046: Leverage the font-display CSS feature to ensure text is user-visible while webfonts are loading
2 parents 28757e4 + 5741106 commit a5f9488

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

app/design/frontend/Magento/blank/web/css/source/_typography.less

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,32 @@
1212
@family-name: @font-family-name__base,
1313
@font-path: '@{baseDir}fonts/opensans/light/opensans-300',
1414
@font-weight: 300,
15-
@font-style: normal
15+
@font-style: normal,
16+
@font-display: swap
1617
);
1718

1819
.lib-font-face(
1920
@family-name: @font-family-name__base,
2021
@font-path: '@{baseDir}fonts/opensans/regular/opensans-400',
2122
@font-weight: 400,
22-
@font-style: normal
23+
@font-style: normal,
24+
@font-display: swap
2325
);
2426

2527
.lib-font-face(
2628
@family-name: @font-family-name__base,
2729
@font-path: '@{baseDir}fonts/opensans/semibold/opensans-600',
2830
@font-weight: 600,
29-
@font-style: normal
31+
@font-style: normal,
32+
@font-display: swap
3033
);
3134

3235
.lib-font-face(
3336
@family-name: @font-family-name__base,
3437
@font-path: '@{baseDir}fonts/opensans/bold/opensans-700',
3538
@font-weight: 700,
36-
@font-style: normal
39+
@font-style: normal,
40+
@font-display: swap
3741
);
3842
}
3943

lib/web/css/source/lib/_typography.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
@family-name,
1212
@font-path,
1313
@font-weight: normal,
14-
@font-style: normal
14+
@font-style: normal,
15+
@font-display: auto
1516
) {
1617
@font-face {
1718
font-family: @family-name;
1819
src: url('@{font-path}.woff2') format('woff2'),
1920
url('@{font-path}.woff') format('woff');
2021
font-weight: @font-weight;
2122
font-style: @font-style;
23+
font-display: @font-display;
2224
}
2325
}
2426

0 commit comments

Comments
 (0)