@xterm/addon-webgl 0.20.0-beta.2 → 0.20.0-beta.20

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.
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Copyright (c) 2021 The xterm.js authors. All rights reserved.
3
+ * @license MIT
4
+ */
5
+
6
+ export interface ICustomGlyphSolidOctantBlockVector {
7
+ x: number;
8
+ y: number;
9
+ w: number;
10
+ h: number;
11
+ }
12
+
13
+ /**
14
+ * @param xp The percentage of 15% of the x axis.
15
+ * @param yp The percentage of 15% of the x axis on the y axis.
16
+ */
17
+ export type CustomGlyphPathDrawFunctionDefinition = (xp: number, yp: number) => string;
18
+
19
+ export interface ICustomGlyphVectorShape {
20
+ d: string;
21
+ type: CustomGlyphVectorType;
22
+ leftPadding?: number;
23
+ rightPadding?: number;
24
+ }
25
+
26
+ export const enum CustomGlyphVectorType {
27
+ FILL,
28
+ STROKE
29
+ }
30
+
31
+ export type CustomGlyphPatternDefinition = number[][];
32
+
33
+ export const enum CustomGlyphDefinitionType {
34
+ SOLID_OCTANT_BLOCK_VECTOR,
35
+ BLOCK_PATTERN,
36
+ PATH_FUNCTION,
37
+ PATH,
38
+ PATH_NEGATIVE,
39
+ VECTOR_SHAPE,
40
+ BRAILLE,
41
+ }
42
+
43
+ export type CustomGlyphDefinitionPartRaw = (
44
+ { type: CustomGlyphDefinitionType.SOLID_OCTANT_BLOCK_VECTOR, data: ICustomGlyphSolidOctantBlockVector[] } |
45
+ { type: CustomGlyphDefinitionType.BLOCK_PATTERN, data: CustomGlyphPatternDefinition } |
46
+ { type: CustomGlyphDefinitionType.PATH_FUNCTION, data: CustomGlyphPathDrawFunctionDefinition | string } |
47
+ { type: CustomGlyphDefinitionType.PATH, data: string } |
48
+ { type: CustomGlyphDefinitionType.PATH_NEGATIVE, data: ICustomGlyphVectorShape } |
49
+ { type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: ICustomGlyphVectorShape} |
50
+ { type: CustomGlyphDefinitionType.BRAILLE, data: number }
51
+ );
52
+
53
+ export const enum CustomGlyphScaleType {
54
+ /**
55
+ * Scale to the entire cell, including letter spacing and line height.
56
+ */
57
+ CELL,
58
+ /**
59
+ * Scale to only the character area, excluding letter spacing and line height.
60
+ */
61
+ CHAR,
62
+ }
63
+
64
+ export interface ICustomGlyphDefinitionCommon {
65
+ /**
66
+ * A custom clip path for the draw definition, restricting the area it can draw to.
67
+ */
68
+ clipPath?: string;
69
+ /**
70
+ * The stroke width to use when drawing the path. Defaults to 1.
71
+ */
72
+ strokeWidth?: number;
73
+ /**
74
+ * Defines how to scale the draw. Defaults to scaling to the full cell including letter spacing
75
+ * and line height.
76
+ */
77
+ scaleType?: CustomGlyphScaleType;
78
+ }
79
+
80
+ export type CustomGlyphDefinitionPart = CustomGlyphDefinitionPartRaw & ICustomGlyphDefinitionCommon;
81
+
82
+ /**
83
+ * A character definition that can be a single part or an array of parts drawn in sequence.
84
+ */
85
+ export type CustomGlyphCharacterDefinition = CustomGlyphDefinitionPart | CustomGlyphDefinitionPart[];
@@ -32,7 +32,7 @@ declare module '@xterm/addon-webgl' {
32
32
  */
33
33
  public readonly onRemoveTextureAtlasCanvas: IEvent<HTMLCanvasElement>;
34
34
 
35
- constructor(preserveDrawingBuffer?: boolean);
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
  }