Move customGlyphs option into webgl addon

Fixes #5480
This commit is contained in:
Daniel Imms
2025-12-24 08:35:06 -08:00
parent cbea462737
commit 5d24866042
11 changed files with 83 additions and 60 deletions
+3 -2
View File
@@ -32,9 +32,10 @@ export function acquireTextureAtlas(
deviceCharWidth: number,
deviceCharHeight: number,
devicePixelRatio: number,
deviceMaxTextureSize: number
deviceMaxTextureSize: number,
customGlyphs: boolean = true
): ITextureAtlas {
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio, deviceMaxTextureSize);
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio, deviceMaxTextureSize, customGlyphs);
// Check to see if the terminal already owns this config
for (let i = 0; i < charAtlasCache.length; i++) {
+2 -2
View File
@@ -9,7 +9,7 @@ import { ITerminalOptions } from '@xterm/xterm';
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { NULL_COLOR } from 'common/Color';
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number): ICharAtlasConfig {
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig {
// null out some fields that don't matter
const clonedColors: IColorSet = {
foreground: colors.foreground,
@@ -32,7 +32,7 @@ export function generateConfig(deviceCellWidth: number, deviceCellHeight: number
halfContrastCache: colors.halfContrastCache
};
return {
customGlyphs: options.customGlyphs,
customGlyphs,
devicePixelRatio,
deviceMaxTextureSize,
letterSpacing: options.letterSpacing,
+8 -4
View File
@@ -4,7 +4,7 @@
*/
import type { ITerminalAddon, Terminal } from '@xterm/xterm';
import type { WebglAddon as IWebglApi } from '@xterm/addon-webgl';
import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'browser/Types';
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
@@ -28,9 +28,10 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
private readonly _onContextLoss = this._register(new Emitter<void>());
public readonly onContextLoss = this._onContextLoss.event;
constructor(
private _preserveDrawingBuffer?: boolean
) {
private readonly _customGlyphs: boolean;
private readonly _preserveDrawingBuffer?: boolean;
constructor(options?: IWebglAddonOptions) {
if (isSafari && getSafariVersion() < 16) {
// Perform an extra check to determine if Webgl2 is manually enabled in developer settings
const contextAttributes = {
@@ -44,6 +45,8 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
}
}
super();
this._customGlyphs = options?.customGlyphs ?? true;
this._preserveDrawingBuffer = options?.preserveDrawingBuffer;
}
public activate(terminal: Terminal): void {
@@ -79,6 +82,7 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
decorationService,
optionsService,
themeService,
this._customGlyphs,
this._preserveDrawingBuffer
));
this._register(Event.forward(this._renderer.onContextLoss, this._onContextLoss));
+3 -1
View File
@@ -72,6 +72,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
private readonly _decorationService: IDecorationService,
private readonly _optionsService: IOptionsService,
private readonly _themeService: IThemeService,
private readonly _customGlyphs: boolean = true,
preserveDrawingBuffer?: boolean
) {
super();
@@ -278,7 +279,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
this.dimensions.device.char.width,
this.dimensions.device.char.height,
this._coreBrowserService.dpr,
this._deviceMaxTextureSize
this._deviceMaxTextureSize,
this._customGlyphs
);
if (this._charAtlas !== atlas) {
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas);