@xterm/addon-webgl 0.20.0-beta.4 → 0.20.0-beta.6
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 +15 -15
- package/lib/addon-webgl.mjs.map +4 -4
- package/package.json +3 -3
- package/src/TextureAtlas.ts +2 -2
- package/src/customGlyphs/CustomGlyphDefinitions.ts +821 -0
- package/src/customGlyphs/CustomGlyphRasterizer.ts +659 -0
- package/src/customGlyphs/Types.ts +61 -0
- package/src/CustomGlyphs.ts +0 -1026
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
BLOCK_PATTERN_WITH_REGION,
|
|
37
|
+
BLOCK_PATTERN_WITH_REGION_AND_SOLID_OCTANT_BLOCK_VECTOR,
|
|
38
|
+
BLOCK_PATTERN_WITH_CLIP_PATH,
|
|
39
|
+
PATH_FUNCTION,
|
|
40
|
+
PATH_FUNCTION_WITH_WEIGHT,
|
|
41
|
+
PATH,
|
|
42
|
+
PATH_NEGATIVE,
|
|
43
|
+
VECTOR_SHAPE,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type CustomGlyphRegionDefinition = [x: number, y: number, w: number, h: number];
|
|
47
|
+
|
|
48
|
+
export type CustomGlyphCharacterDefinition = (
|
|
49
|
+
{ type: CustomGlyphDefinitionType.SOLID_OCTANT_BLOCK_VECTOR, data: ICustomGlyphSolidOctantBlockVector[] } |
|
|
50
|
+
{ type: CustomGlyphDefinitionType.BLOCK_PATTERN, data: CustomGlyphPatternDefinition } |
|
|
51
|
+
{ type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_REGION, data: [pattern: CustomGlyphPatternDefinition, region: CustomGlyphRegionDefinition] } |
|
|
52
|
+
// TODO: Consolidate these, draws should be possible via regions/clipping instead of special
|
|
53
|
+
// casing
|
|
54
|
+
{ type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_REGION_AND_SOLID_OCTANT_BLOCK_VECTOR, data: { pattern: [pattern: CustomGlyphPatternDefinition, region: CustomGlyphRegionDefinition], vectors: ICustomGlyphSolidOctantBlockVector[] } } |
|
|
55
|
+
{ type: CustomGlyphDefinitionType.BLOCK_PATTERN_WITH_CLIP_PATH, data: [pattern: CustomGlyphPatternDefinition, clipPath: string] } |
|
|
56
|
+
{ type: CustomGlyphDefinitionType.PATH_FUNCTION, data: CustomGlyphPathDrawFunctionDefinition } |
|
|
57
|
+
{ type: CustomGlyphDefinitionType.PATH_FUNCTION_WITH_WEIGHT, data: { [fontWeight: number]: string | CustomGlyphPathDrawFunctionDefinition } } |
|
|
58
|
+
{ type: CustomGlyphDefinitionType.PATH, data: string } |
|
|
59
|
+
{ type: CustomGlyphDefinitionType.PATH_NEGATIVE, data: ICustomGlyphVectorShape } |
|
|
60
|
+
{ type: CustomGlyphDefinitionType.VECTOR_SHAPE, data: ICustomGlyphVectorShape }
|
|
61
|
+
);
|