@xterm/addon-webgl 0.20.0-beta.13 → 0.20.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/addon-webgl.js +1 -1
- package/lib/addon-webgl.js.map +1 -1
- package/lib/addon-webgl.mjs +6 -6
- package/lib/addon-webgl.mjs.map +3 -3
- package/package.json +3 -3
- package/src/CharAtlasCache.ts +3 -2
- package/src/CharAtlasUtils.ts +2 -2
- package/src/WebglAddon.ts +8 -4
- package/src/WebglRenderer.ts +3 -1
- package/typings/addon-webgl.d.ts +26 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xterm/addon-webgl",
|
|
3
|
-
"version": "0.20.0-beta.
|
|
3
|
+
"version": "0.20.0-beta.14",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "The xterm.js authors",
|
|
6
6
|
"url": "https://xtermjs.org/"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"prepublishOnly": "npm run package",
|
|
24
24
|
"start": "node ../../demo/start"
|
|
25
25
|
},
|
|
26
|
-
"commit": "
|
|
26
|
+
"commit": "0e0b445784998e16d63cc5d2edc503b513ad87bd",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@xterm/xterm": "^6.1.0-beta.
|
|
28
|
+
"@xterm/xterm": "^6.1.0-beta.15"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/CharAtlasCache.ts
CHANGED
|
@@ -32,9 +32,10 @@ export function acquireTextureAtlas(
|
|
|
32
32
|
deviceCharWidth: number,
|
|
33
33
|
deviceCharHeight: number,
|
|
34
34
|
devicePixelRatio: number,
|
|
35
|
-
deviceMaxTextureSize: number
|
|
35
|
+
deviceMaxTextureSize: number,
|
|
36
|
+
customGlyphs: boolean = true
|
|
36
37
|
): ITextureAtlas {
|
|
37
|
-
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio, deviceMaxTextureSize);
|
|
38
|
+
const newConfig = generateConfig(deviceCellWidth, deviceCellHeight, deviceCharWidth, deviceCharHeight, options, colors, devicePixelRatio, deviceMaxTextureSize, customGlyphs);
|
|
38
39
|
|
|
39
40
|
// Check to see if the terminal already owns this config
|
|
40
41
|
for (let i = 0; i < charAtlasCache.length; i++) {
|
package/src/CharAtlasUtils.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { ITerminalOptions } from '@xterm/xterm';
|
|
|
9
9
|
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
|
|
10
10
|
import { NULL_COLOR } from 'common/Color';
|
|
11
11
|
|
|
12
|
-
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number): ICharAtlasConfig {
|
|
12
|
+
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig {
|
|
13
13
|
// null out some fields that don't matter
|
|
14
14
|
const clonedColors: IColorSet = {
|
|
15
15
|
foreground: colors.foreground,
|
|
@@ -32,7 +32,7 @@ export function generateConfig(deviceCellWidth: number, deviceCellHeight: number
|
|
|
32
32
|
halfContrastCache: colors.halfContrastCache
|
|
33
33
|
};
|
|
34
34
|
return {
|
|
35
|
-
customGlyphs
|
|
35
|
+
customGlyphs,
|
|
36
36
|
devicePixelRatio,
|
|
37
37
|
deviceMaxTextureSize,
|
|
38
38
|
letterSpacing: options.letterSpacing,
|
package/src/WebglAddon.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { ITerminalAddon, Terminal } from '@xterm/xterm';
|
|
7
|
-
import type { WebglAddon as IWebglApi } from '@xterm/addon-webgl';
|
|
7
|
+
import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl';
|
|
8
8
|
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
|
|
9
9
|
import { ITerminal } from 'browser/Types';
|
|
10
10
|
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
@@ -28,9 +28,10 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
|
|
|
28
28
|
private readonly _onContextLoss = this._register(new Emitter<void>());
|
|
29
29
|
public readonly onContextLoss = this._onContextLoss.event;
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
private readonly _customGlyphs: boolean;
|
|
32
|
+
private readonly _preserveDrawingBuffer?: boolean;
|
|
33
|
+
|
|
34
|
+
constructor(options?: IWebglAddonOptions) {
|
|
34
35
|
if (isSafari && getSafariVersion() < 16) {
|
|
35
36
|
// Perform an extra check to determine if Webgl2 is manually enabled in developer settings
|
|
36
37
|
const contextAttributes = {
|
|
@@ -44,6 +45,8 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
super();
|
|
48
|
+
this._customGlyphs = options?.customGlyphs ?? true;
|
|
49
|
+
this._preserveDrawingBuffer = options?.preserveDrawingBuffer;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
public activate(terminal: Terminal): void {
|
|
@@ -79,6 +82,7 @@ export class WebglAddon extends Disposable implements ITerminalAddon , IWebglApi
|
|
|
79
82
|
decorationService,
|
|
80
83
|
optionsService,
|
|
81
84
|
themeService,
|
|
85
|
+
this._customGlyphs,
|
|
82
86
|
this._preserveDrawingBuffer
|
|
83
87
|
));
|
|
84
88
|
this._register(Event.forward(this._renderer.onContextLoss, this._onContextLoss));
|
package/src/WebglRenderer.ts
CHANGED
|
@@ -72,6 +72,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|
|
72
72
|
private readonly _decorationService: IDecorationService,
|
|
73
73
|
private readonly _optionsService: IOptionsService,
|
|
74
74
|
private readonly _themeService: IThemeService,
|
|
75
|
+
private readonly _customGlyphs: boolean = true,
|
|
75
76
|
preserveDrawingBuffer?: boolean
|
|
76
77
|
) {
|
|
77
78
|
super();
|
|
@@ -278,7 +279,8 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|
|
278
279
|
this.dimensions.device.char.width,
|
|
279
280
|
this.dimensions.device.char.height,
|
|
280
281
|
this._coreBrowserService.dpr,
|
|
281
|
-
this._deviceMaxTextureSize
|
|
282
|
+
this._deviceMaxTextureSize,
|
|
283
|
+
this._customGlyphs
|
|
282
284
|
);
|
|
283
285
|
if (this._charAtlas !== atlas) {
|
|
284
286
|
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas);
|
package/typings/addon-webgl.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ declare module '@xterm/addon-webgl' {
|
|
|
32
32
|
*/
|
|
33
33
|
public readonly onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
|
|
34
34
|
|
|
35
|
-
constructor(
|
|
35
|
+
constructor(options?: IWebglAddonOptions);
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Activates the addon.
|
|
@@ -50,4 +50,29 @@ declare module '@xterm/addon-webgl' {
|
|
|
50
50
|
*/
|
|
51
51
|
public clearTextureAtlas(): void;
|
|
52
52
|
}
|
|
53
|
+
|
|
54
|
+
export interface IWebglAddonOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Whether to draw custom glyphs instead of using the font for the following
|
|
57
|
+
* unicode ranges:
|
|
58
|
+
*
|
|
59
|
+
* - Box Drawing (U+2500-U+257F)
|
|
60
|
+
* - Box Elements (U+2580-U+259F)
|
|
61
|
+
* - Braille Patterns (U+2800-U+28FF)
|
|
62
|
+
* - Powerline Symbols (U+E0A0–U+E0D4)
|
|
63
|
+
* - Symbols for Legacy Computing (U+1FB00–U+1FBFF)
|
|
64
|
+
*
|
|
65
|
+
* This will typically result in better rendering with continuous lines,
|
|
66
|
+
* even when line height and letter spacing is used. Note that this doesn't
|
|
67
|
+
* work with the DOM renderer which renders all characters using the font.
|
|
68
|
+
* The default is true.
|
|
69
|
+
*/
|
|
70
|
+
customGlyphs?: boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Whether to enable the preserveDrawingBuffer flag when creating the WebGL
|
|
74
|
+
* context. This may be useful in tests. This defaults to false.
|
|
75
|
+
*/
|
|
76
|
+
preserveDrawingBuffer?: boolean
|
|
77
|
+
}
|
|
53
78
|
}
|