Fonts: consider to set font-display: block. Fixes #131396

This commit is contained in:
Martin Aeschlimann 2021-08-23 14:31:07 +02:00
parent 8a0ef4107e
commit c8209aff4c
No known key found for this signature in database
GPG key ID: 2609A01E695523E3
5 changed files with 5 additions and 3 deletions

View file

@ -5,6 +5,7 @@
@font-face {
font-family: "codicon";
font-display: block;
src: url("./codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6") format("truetype");
}

View file

@ -365,6 +365,7 @@ let SHADOW_ROOT_CSS = /* css */ `
@font-face {
font-family: "codicon";
font-display: block;
src: url("./codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6") format("truetype");
}

View file

@ -53,7 +53,7 @@ export function getIconsStyleSheet(): IIconsStyleSheet {
for (let id in usedFontIds) {
const fontContribution = usedFontIds[id];
const src = fontContribution.definition.src.map(l => `${asCSSUrl(l.location)} format('${l.format}')`).join(', ');
rules.push(`@font-face { src: ${src}; font-family: ${asCSSPropertyValue(id)}; }`);
rules.push(`@font-face { src: ${src}; font-family: ${asCSSPropertyValue(id)}; font-display: block; }`);
}
return rules.join('\n');
}

View file

@ -345,7 +345,7 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
let src = font.src.map(l => `${asCSSUrl(resolvePath(l.path))} format('${l.format}')`).join(', ');
cssRules.push(`@font-face { src: ${src}; font-family: '${font.id}'; font-weight: ${font.weight}; font-style: ${font.style}; }`);
});
cssRules.push(`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: '${fonts[0].id}'; font-size: ${fonts[0].size || '150%'}}`);
cssRules.push(`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: '${fonts[0].id}'; font-size: ${fonts[0].size || '150%'}; font-display: block; }`);
}
for (let defId in selectorByDefinitionId) {

View file

@ -221,7 +221,7 @@ function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, i
warnings.push(nls.localize('error.fontStyle', 'Invalid font style in font \'{0}\'. Ignoring setting.', font.id));
}
cssRules.push(`@font-face { src: ${src}; font-family: '${fontId}';${fontWeight}${fontStyle} }`);
cssRules.push(`@font-face { src: ${src}; font-family: '${fontId}';${fontWeight}${fontStyle}; font-display: block; }`);
} else {
warnings.push(nls.localize('error.fontId', 'Missing or invalid font id \'{0}\'. Skipping font definition.', font.id));
}