Path: blob/main/src/vs/editor/common/config/fontInfoFromSettings.ts
5285 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { EditorOption, EditorOptions } from './editorOptions.js';6import { IValidatedEditorOptions, BareFontInfo } from './fontInfo.js';78export function createBareFontInfoFromValidatedSettings(options: IValidatedEditorOptions, pixelRatio: number, ignoreEditorZoom: boolean): BareFontInfo {9const fontFamily = options.get(EditorOption.fontFamily);10const fontWeight = options.get(EditorOption.fontWeight);11const fontSize = options.get(EditorOption.fontSize);12const fontFeatureSettings = options.get(EditorOption.fontLigatures);13const fontVariationSettings = options.get(EditorOption.fontVariations);14const lineHeight = options.get(EditorOption.lineHeight);15const letterSpacing = options.get(EditorOption.letterSpacing);16return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);17}1819export function createBareFontInfoFromRawSettings(opts: {20fontFamily?: unknown;21fontWeight?: unknown;22fontSize?: unknown;23fontLigatures?: unknown;24fontVariations?: unknown;25lineHeight?: unknown;26letterSpacing?: unknown;27}, pixelRatio: number, ignoreEditorZoom: boolean = false): BareFontInfo {28const fontFamily = EditorOptions.fontFamily.validate(opts.fontFamily);29const fontWeight = EditorOptions.fontWeight.validate(opts.fontWeight);30const fontSize = EditorOptions.fontSize.validate(opts.fontSize);31const fontFeatureSettings = EditorOptions.fontLigatures2.validate(opts.fontLigatures);32const fontVariationSettings = EditorOptions.fontVariations.validate(opts.fontVariations);33const lineHeight = EditorOptions.lineHeight.validate(opts.lineHeight);34const letterSpacing = EditorOptions.letterSpacing.validate(opts.letterSpacing);35return BareFontInfo._create(fontFamily, fontWeight, fontSize, fontFeatureSettings, fontVariationSettings, lineHeight, letterSpacing, pixelRatio, ignoreEditorZoom);36}373839