@@ -56,18 +56,63 @@ const fontFaceCSS = `
56
56
}
57
57
` ;
58
58
59
- const insertFontFace = ( ) => {
60
- if ( document . querySelector ( `head>style[data-ui5-font-face]` ) ) {
61
- return ;
59
+ /**
60
+ * Some diacritics are supported by the 72 font:
61
+ * * Grave
62
+ * * Acute
63
+ * * Circumflex
64
+ * * Tilde
65
+ *
66
+ * However, the following diacritics and the combination of multiple diacritics (including the supported ones) are not supported:
67
+ * * Breve
68
+ * * Horn
69
+ * * Dot below
70
+ * * Hook above
71
+ *
72
+ *
73
+ * Override for the characters that aren't covered by the '72' font to other system fonts
74
+ *
75
+ * U+0102-0103: A and a with Breve
76
+ * U+01A0-01A1: O and o with Horn
77
+ * U+01AF-01B0: U and u with Horn
78
+ * U+1EA0-1EB7: A and a with diacritics that are not supported by the font and combination of multiple diacritics
79
+ * U+1EB8-1EC7: E and e with diacritics that are not supported by the font and combination of multiple diacritics
80
+ * U+1EC8-1ECB: I and i with diacritics that are not supported by the font and combination of multiple diacritics
81
+ * U+1ECC-1EE3: O and o with diacritics that are not supported by the font and combination of multiple diacritics
82
+ * U+1EE4-1EF1: U and u with diacritics that are not supported by the font and combination of multiple diacritics
83
+ * U+1EF4-1EF7: Y and y with diacritics that are not supported by the font and combination of multiple diacritics
84
+ *
85
+ */
86
+ const overrideFontFaceCSS = `
87
+ @font-face {
88
+ font-family: '72override';
89
+ unicode-range: U+0102-0103, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EB7, U+1EB8-1EC7, U+1EC8-1ECB, U+1ECC-1EE3, U+1EE4-1EF1, U+1EF4-1EF7;
90
+ src: local('Arial'), local('Helvetica'), local('sans-serif');
62
91
}
92
+ ` ;
63
93
64
- // If OpenUI5 is found, let it set the font
94
+ const insertFontFace = ( ) => {
65
95
const OpenUI5Support = getFeature ( "OpenUI5Support" ) ;
66
- if ( OpenUI5Support && OpenUI5Support . isLoaded ( ) ) {
67
- return ;
96
+
97
+ // Only set the main font if there is no OpenUI5 support, or there is, but OpenUI5 is not loaded
98
+ if ( ! OpenUI5Support || ! OpenUI5Support . isLoaded ( ) ) {
99
+ insertMainFontFace ( ) ;
68
100
}
69
101
70
- createStyleInHead ( fontFaceCSS , { "data-ui5-font-face" : "" } ) ;
102
+ // Always set the override font - OpenUI5 in CSS Vars mode does not set it, unlike the main font
103
+ insertOverrideFontFace ( ) ;
104
+ } ;
105
+
106
+ const insertMainFontFace = ( ) => {
107
+ if ( ! document . querySelector ( `head>style[data-ui5-font-face]` ) ) {
108
+ createStyleInHead ( fontFaceCSS , { "data-ui5-font-face" : "" } ) ;
109
+ }
110
+ } ;
111
+
112
+ const insertOverrideFontFace = ( ) => {
113
+ if ( ! document . querySelector ( `head>style[data-ui5-font-face-override]` ) ) {
114
+ createStyleInHead ( overrideFontFaceCSS , { "data-ui5-font-face-override" : "" } ) ;
115
+ }
71
116
} ;
72
117
73
118
export default insertFontFace ;
0 commit comments