Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/browser/config/domFontInfo.ts
3294 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { FastDomNode } from '../../../base/browser/fastDomNode.js';
7
import { BareFontInfo } from '../../common/config/fontInfo.js';
8
9
export function applyFontInfo(domNode: FastDomNode<HTMLElement> | HTMLElement, fontInfo: BareFontInfo): void {
10
if (domNode instanceof FastDomNode) {
11
domNode.setFontFamily(fontInfo.getMassagedFontFamily());
12
domNode.setFontWeight(fontInfo.fontWeight);
13
domNode.setFontSize(fontInfo.fontSize);
14
domNode.setFontFeatureSettings(fontInfo.fontFeatureSettings);
15
domNode.setFontVariationSettings(fontInfo.fontVariationSettings);
16
domNode.setLineHeight(fontInfo.lineHeight);
17
domNode.setLetterSpacing(fontInfo.letterSpacing);
18
} else {
19
domNode.style.fontFamily = fontInfo.getMassagedFontFamily();
20
domNode.style.fontWeight = fontInfo.fontWeight;
21
domNode.style.fontSize = fontInfo.fontSize + 'px';
22
domNode.style.fontFeatureSettings = fontInfo.fontFeatureSettings;
23
domNode.style.fontVariationSettings = fontInfo.fontVariationSettings;
24
domNode.style.lineHeight = fontInfo.lineHeight + 'px';
25
domNode.style.letterSpacing = fontInfo.letterSpacing + 'px';
26
}
27
}
28
29