@lightningjs/renderer 0.9.1 → 0.9.3

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.
Files changed (97) hide show
  1. package/dist/exports/index.d.ts +3 -0
  2. package/dist/{src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.js → exports/index.js} +4 -11
  3. package/dist/exports/index.js.map +1 -0
  4. package/dist/src/common/IAnimationController.d.ts +58 -1
  5. package/dist/src/common/IAnimationController.js +0 -18
  6. package/dist/src/common/IAnimationController.js.map +1 -1
  7. package/dist/src/core/CoreNode.js +40 -0
  8. package/dist/src/core/CoreNode.js.map +1 -1
  9. package/dist/src/core/CoreTextureManager.d.ts +35 -0
  10. package/dist/src/core/CoreTextureManager.js +1 -1
  11. package/dist/src/core/CoreTextureManager.js.map +1 -1
  12. package/dist/src/core/TextureList.js +34 -0
  13. package/dist/src/core/TextureList.js.map +1 -0
  14. package/dist/src/core/animations/CoreAnimation.d.ts +2 -2
  15. package/dist/src/core/animations/CoreAnimation.js +33 -10
  16. package/dist/src/core/animations/CoreAnimation.js.map +1 -1
  17. package/dist/src/core/animations/CoreAnimationController.d.ts +8 -12
  18. package/dist/src/core/animations/CoreAnimationController.js +42 -46
  19. package/dist/src/core/animations/CoreAnimationController.js.map +1 -1
  20. package/dist/src/core/lib/ImageWorker.d.ts +0 -1
  21. package/dist/src/core/lib/ImageWorker.js +8 -10
  22. package/dist/src/core/lib/ImageWorker.js.map +1 -1
  23. package/dist/src/core/lib/utils.d.ts +1 -0
  24. package/dist/src/core/lib/utils.js +20 -0
  25. package/dist/src/core/lib/utils.js.map +1 -1
  26. package/dist/src/core/renderers/webgl/WebGlCoreRenderer.js +25 -0
  27. package/dist/src/core/renderers/webgl/WebGlCoreRenderer.js.map +1 -1
  28. package/dist/src/core/renderers/webgl/newShader/effectsMock.d.ts +1 -0
  29. package/dist/src/core/renderers/webgl/newShader/effectsMock.js +36 -0
  30. package/dist/src/core/renderers/webgl/newShader/effectsMock.js.map +1 -0
  31. package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js +2 -1
  32. package/dist/src/core/renderers/webgl/shaders/effects/BorderEffect.js.map +1 -1
  33. package/dist/src/core/textures/ImageTexture.d.ts +5 -1
  34. package/dist/src/core/textures/ImageTexture.js +20 -9
  35. package/dist/src/core/textures/ImageTexture.js.map +1 -1
  36. package/dist/src/core/utils.js +1 -6
  37. package/dist/src/core/utils.js.map +1 -1
  38. package/dist/src/main-api/INode.d.ts +1 -1
  39. package/dist/src/main-api/Renderer.d.ts +314 -0
  40. package/dist/src/main-api/Renderer.js +387 -0
  41. package/dist/src/main-api/Renderer.js.map +1 -0
  42. package/dist/src/main-api/utils.d.ts +2 -0
  43. package/dist/src/main-api/utils.js +34 -0
  44. package/dist/src/main-api/utils.js.map +1 -0
  45. package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.d.ts +8 -4
  46. package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.js +53 -24
  47. package/dist/src/render-drivers/threadx/ThreadXMainAnimationController.js.map +1 -1
  48. package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.js +6 -0
  49. package/dist/src/render-drivers/threadx/worker/ThreadXRendererNode.js.map +1 -1
  50. package/dist/src/render-drivers/utils.js +6 -1
  51. package/dist/src/render-drivers/utils.js.map +1 -1
  52. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  53. package/{dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.js → exports/index.ts} +4 -14
  54. package/package.json +1 -1
  55. package/src/common/IAnimationController.ts +60 -1
  56. package/src/core/CoreNode.ts +45 -0
  57. package/src/core/CoreTextureManager.ts +40 -1
  58. package/src/core/animations/CoreAnimation.ts +35 -11
  59. package/src/core/animations/CoreAnimationController.ts +48 -53
  60. package/src/core/lib/ImageWorker.ts +10 -13
  61. package/src/core/lib/utils.ts +25 -0
  62. package/src/core/renderers/webgl/WebGlCoreRenderer.ts +27 -0
  63. package/src/core/renderers/webgl/shaders/effects/BorderEffect.ts +2 -1
  64. package/src/core/textures/ImageTexture.ts +26 -9
  65. package/src/core/utils.ts +1 -7
  66. package/src/main-api/INode.ts +1 -1
  67. package/src/render-drivers/threadx/ThreadXMainAnimationController.ts +63 -27
  68. package/src/render-drivers/threadx/worker/ThreadXRendererNode.ts +6 -0
  69. package/src/render-drivers/utils.ts +6 -1
  70. package/dist/src/core/lib/WebGlContext.d.ts +0 -414
  71. package/dist/src/core/lib/WebGlContext.js +0 -640
  72. package/dist/src/core/lib/WebGlContext.js.map +0 -1
  73. package/dist/src/core/scene/Scene.d.ts +0 -59
  74. package/dist/src/core/scene/Scene.js +0 -106
  75. package/dist/src/core/scene/Scene.js.map +0 -1
  76. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.d.ts +0 -8
  77. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.js.map +0 -1
  78. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/SdfBufferHelper.d.ts +0 -19
  79. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/SdfBufferHelper.js +0 -84
  80. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/SdfBufferHelper.js.map +0 -1
  81. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.d.ts +0 -8
  82. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.js +0 -40
  83. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.js.map +0 -1
  84. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.d.ts +0 -2
  85. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.js +0 -41
  86. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.js.map +0 -1
  87. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.d.ts +0 -1
  88. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.js +0 -4
  89. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.js.map +0 -1
  90. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2.js +0 -2
  91. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2.js.map +0 -1
  92. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.d.ts +0 -20
  93. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.js +0 -55
  94. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.js.map +0 -1
  95. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.d.ts +0 -9
  96. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.js.map +0 -1
  97. /package/dist/src/core/{text-rendering/renderers/SdfTextRenderer/internal/layoutText2.d.ts → TextureList.d.ts} +0 -0
@@ -1,106 +0,0 @@
1
- /*
2
- * If not stated otherwise in this file or this component's LICENSE file the
3
- * following copyright and licenses apply:
4
- *
5
- * Copyright 2023 Comcast Cable Communications Management, LLC.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the License);
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- export class Scene {
20
- /**
21
- * Root node of the scene
22
- *
23
- * @type {Node}
24
- * @memberof Scene
25
- */
26
- root;
27
- constructor(root) {
28
- this.root = root;
29
- }
30
- /**
31
- * Get all nodes of a specific type
32
- * @param type
33
- * @returns
34
- */
35
- getNodeByType(type) {
36
- return [];
37
- }
38
- /**
39
- * Find a node by id
40
- * @param id
41
- * @returns
42
- */
43
- getNodeById(id) {
44
- return null;
45
- }
46
- /**
47
- * Create a new node
48
- * @param parent
49
- * @returns
50
- */
51
- // public createNode(settings: Partial<INodeWritableProps> = {}): NodeTypes {
52
- // return createNode(settings);
53
- // }
54
- /**
55
- * create a new RectangleNode
56
- * @param w
57
- * @param h
58
- * @param parent
59
- * @returns
60
- */
61
- // public rectangle(w: number, h: number, parent: NodeTypes | null = null) {
62
- // // TODO: Fix this
63
- // // return this.create(new RectangleNode(w, h), parent);
64
- // }
65
- /**
66
- * Create a new CircleNode
67
- * @param r
68
- * @param parent
69
- * @returns
70
- */
71
- // public circle(r: number, parent: NodeTypes | null = null) {
72
- // // TODO: Fix this
73
- // // return this.create(new CircleNode(r), parent);
74
- // }
75
- /**
76
- * Create a new TextNode
77
- * @param text
78
- * @param parent
79
- * @returns
80
- */
81
- // public text(text = '', parent: NodeTypes | null = null) {
82
- // // TODO: Fix this
83
- // // return this.create(new TextNode(text), parent);
84
- // }
85
- /**
86
- * Setup and attaching Node
87
- * @param node
88
- * @param parent
89
- * @returns
90
- */
91
- // private create(node: NodeTypes, parent: NodeTypes | null = null): NodeTypes {
92
- // if (!parent) {
93
- // parent = this.root;
94
- // }
95
- // node.parent = parent;
96
- // return node;
97
- // }
98
- /**
99
- * Update the scene
100
- * @param delta
101
- */
102
- update(delta) {
103
- this.root.update(delta);
104
- }
105
- }
106
- //# sourceMappingURL=Scene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Scene.js","sourceRoot":"","sources":["../../../../src/core/scene/Scene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,OAAO,KAAK;IAChB;;;;;OAKG;IACI,IAAI,CAAW;IAEtB,YAAY,IAAc;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,IAAY;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,EAAU;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,6EAA6E;IAC7E,iCAAiC;IACjC,IAAI;IAEJ;;;;;;OAMG;IACH,4EAA4E;IAC5E,sBAAsB;IACtB,4DAA4D;IAC5D,IAAI;IAEJ;;;;;OAKG;IACH,8DAA8D;IAC9D,sBAAsB;IACtB,sDAAsD;IACtD,IAAI;IAEJ;;;;;OAKG;IACH,4DAA4D;IAC5D,sBAAsB;IACtB,uDAAuD;IACvD,IAAI;IAEJ;;;;;OAKG;IACH,gFAAgF;IAChF,mBAAmB;IACnB,0BAA0B;IAC1B,MAAM;IAEN,0BAA0B;IAC1B,iBAAiB;IACjB,IAAI;IAEJ;;;OAGG;IACI,MAAM,CAAC,KAAa;QACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Round up to the nearest multiple of the given number.
3
- *
4
- * @param value
5
- * @param multiple
6
- * @returns
7
- */
8
- export declare function roundUpToMultiple(value: number, multiple: number): number;
@@ -1 +0,0 @@
1
- {"version":3,"file":"findNearestMultiple.js","sourceRoot":"","sources":["../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/findNearestMultiple.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,QAAgB;IAC/D,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAChD,CAAC"}
@@ -1,19 +0,0 @@
1
- import type { SdfTrFontFace } from '../../../../font-face-types/SdfTrFontFace/SdfTrFontFace.js';
2
- import type { MappedGlyphInfo } from '../../../../font-face-types/SdfTrFontFace/internal/FontShaper.js';
3
- export declare class SdfBufferHelper {
4
- bufferOffset: number;
5
- vertexBuffer: Float32Array;
6
- trFontFace: SdfTrFontFace;
7
- scaleW: number;
8
- scaleH: number;
9
- standByGlyphs: MappedGlyphInfo[];
10
- standByCurX: number;
11
- standByStartXAfterLeadSpaces: number;
12
- curX: number;
13
- curY: number;
14
- constructor(vertexBuffer: Float32Array, trFontFace: SdfTrFontFace);
15
- glyphsStandingBy(): boolean;
16
- getStandByGlyphsWidth(): number;
17
- pushStandByGlyph(glyph: MappedGlyphInfo): void;
18
- flushStandByGlyphs(skipLeadingSpaces?: boolean): void;
19
- }
@@ -1,84 +0,0 @@
1
- import { assertTruthy } from '../../../../../../utils.js';
2
- import { isWhiteSpace } from './utils.js';
3
- export class SdfBufferHelper {
4
- bufferOffset = 0;
5
- vertexBuffer;
6
- trFontFace;
7
- scaleW;
8
- scaleH;
9
- standByGlyphs = [];
10
- standByCurX = -1;
11
- standByStartXAfterLeadSpaces = -1;
12
- curX = 0;
13
- curY = 0;
14
- constructor(vertexBuffer, trFontFace) {
15
- assertTruthy(trFontFace.data);
16
- this.vertexBuffer = vertexBuffer;
17
- this.trFontFace = trFontFace;
18
- this.scaleW = trFontFace.data.common.scaleW;
19
- this.scaleH = trFontFace.data.common.scaleH;
20
- }
21
- glyphsStandingBy() {
22
- return this.standByGlyphs.length > 0;
23
- }
24
- getStandByGlyphsWidth() {
25
- if (this.standByStartXAfterLeadSpaces === -1 || this.standByCurX === -1) {
26
- return 0;
27
- }
28
- return this.standByCurX - this.standByStartXAfterLeadSpaces;
29
- }
30
- pushStandByGlyph(glyph) {
31
- this.standByGlyphs.push(glyph);
32
- if (!isWhiteSpace(glyph.codepoint) &&
33
- this.standByStartXAfterLeadSpaces === -1) {
34
- this.standByStartXAfterLeadSpaces = this.standByCurX;
35
- }
36
- if (this.standByCurX === -1) {
37
- this.standByCurX = this.curX;
38
- }
39
- this.standByCurX += glyph.xAdvance;
40
- }
41
- flushStandByGlyphs(skipLeadingSpaces = false) {
42
- const { vertexBuffer, trFontFace, scaleW, scaleH, curX, curY, standByCurX, } = this;
43
- let { bufferOffset } = this;
44
- for (const glyph of this.standByGlyphs) {
45
- if (skipLeadingSpaces && isWhiteSpace(glyph.codepoint)) {
46
- continue;
47
- }
48
- const atlasEntry = trFontFace.getAtlasEntry(glyph.glyphId);
49
- // This glyph fits, so we can add it to the buffer
50
- const quadX = curX + glyph.xOffset;
51
- const quadY = curY + glyph.yOffset;
52
- const u = atlasEntry.x / scaleW;
53
- const v = atlasEntry.y / scaleH;
54
- const uvWidth = atlasEntry.width / scaleW;
55
- const uvHeight = atlasEntry.height / scaleH;
56
- // Top-left
57
- vertexBuffer[bufferOffset++] = quadX;
58
- vertexBuffer[bufferOffset++] = quadY;
59
- vertexBuffer[bufferOffset++] = u;
60
- vertexBuffer[bufferOffset++] = v;
61
- // Top-right
62
- vertexBuffer[bufferOffset++] = quadX + glyph.width;
63
- vertexBuffer[bufferOffset++] = quadY;
64
- vertexBuffer[bufferOffset++] = u + uvWidth;
65
- vertexBuffer[bufferOffset++] = v;
66
- // Bottom-left
67
- vertexBuffer[bufferOffset++] = quadX;
68
- vertexBuffer[bufferOffset++] = quadY + glyph.height;
69
- vertexBuffer[bufferOffset++] = u;
70
- vertexBuffer[bufferOffset++] = v + uvHeight;
71
- // Bottom-right
72
- vertexBuffer[bufferOffset++] = quadX + glyph.width;
73
- vertexBuffer[bufferOffset++] = quadY + glyph.height;
74
- vertexBuffer[bufferOffset++] = u + uvWidth;
75
- vertexBuffer[bufferOffset++] = v + uvHeight;
76
- this.bufferOffset = bufferOffset;
77
- }
78
- this.curX = standByCurX;
79
- this.standByGlyphs.length = 0;
80
- this.standByCurX = -1;
81
- this.standByStartXAfterLeadSpaces = -1;
82
- }
83
- }
84
- //# sourceMappingURL=SdfBufferHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SdfBufferHelper.js","sourceRoot":"","sources":["../../../../../../../../src/core/text-rendering/renderers/Sdf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acterInfo } from '../../../../font-face-types/SdfTrFontFace/internal/FontShaper.js';
2
- import { PeekableIterator } from '../PeekableGenerator.js';
3
- import type { SdfBufferHelper } from './SdfBufferHelper.js';
4
- export declare function layoutLine(glyphs: PeekableIterator<MappedGlyphInfo | UnmappedCharacterInfo>,
5
- /**
6
- * Can be Infinity
7
- */
8
- maxLineWidth: number, bufferHelper: SdfBufferHelper): boolean;
@@ -1,40 +0,0 @@
1
- import { PeekableIterator } from '../PeekableGenerator.js';
2
- import { getUnicodeCodepoints } from '../getUnicodeCodepoints.js';
3
- import { isWhiteSpace } from './utils.js';
4
- export function layoutLine(glyphs,
5
- /**
6
- * Can be Infinity
7
- */
8
- maxLineWidth, bufferHelper) {
9
- let moreLeft = true;
10
- let glyphResult;
11
- // If there's any standByGlyphs at the beginning of the line, we need to
12
- // we to flush them if they fit
13
- if (bufferHelper.getStandByGlyphsWidth() < maxLineWidth) {
14
- bufferHelper.flushStandByGlyphs(true);
15
- }
16
- while ((glyphResult = glyphs.next())) {
17
- if (glyphResult.done || isWhiteSpace(glyphResult.value.codepoint)) {
18
- // We're out of glyphs, or we hit a whitespace character.
19
- // Flush the standByGlyphs if they fit or if this is the last line
20
- // add the overflow suffix.
21
- if (bufferHelper.glyphsStandingBy() &&
22
- bufferHelper.standByCurX <= maxLineWidth) {
23
- bufferHelper.flushStandByGlyphs();
24
- }
25
- else {
26
- break;
27
- }
28
- }
29
- if (glyphResult.done) {
30
- moreLeft = false;
31
- break;
32
- }
33
- const glyph = glyphResult.value;
34
- if (glyph.mapped) {
35
- bufferHelper.pushStandByGlyph(glyph);
36
- }
37
- }
38
- return moreLeft;
39
- }
40
- //# sourceMappingURL=layoutLine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layoutLine.js","sourceRoot":"","sources":["../../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutLine.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,UAAU,CACxB,MAAiE;AACjE;;GAEG;AACH,YAAoB,EACpB,YAA6B;IAE7B,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,IAAI,WAAoE,CAAC;IAEzE,wEAAwE;IACxE,+BAA+B;IAC/B,IAAI,YAAY,CAAC,qBAAqB,EAAE,GAAG,YAAY,EAAE;QACvD,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KACvC;IAED,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE;QACpC,IAAI,WAAW,CAAC,IAAI,IAAI,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACjE,yDAAyD;YACzD,kEAAkE;YAClE,2BAA2B;YAC3B,IACE,YAAY,CAAC,gBAAgB,EAAE;gBAC/B,YAAY,CAAC,WAAW,IAAI,YAAY,EACxC;gBACA,YAAY,CAAC,kBAAkB,EAAE,CAAC;aACnC;iBAAM;gBACL,MAAM;aACP;SACF;QAED,IAAI,WAAW,CAAC,IAAI,EAAE;YACpB,QAAQ,GAAG,KAAK,CAAC;YACjB,MAAM;SACP;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;QAEhC,IAAI,KAAK,CAAC,MAAM,EAAE;YAChB,YAAY,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;SACtC;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { SdfTrFontFace } from '../../../../font-face-types/SdfTrFontFace/SdfTrFontFace.js';
2
- export declare function layoutText2(text: string, sdfLetterSpacing: number, trFontFace: SdfTrFontFace): void;
@@ -1,41 +0,0 @@
1
- import { assertTruthy } from '../../../../../../utils.js';
2
- import { PeekableIterator } from '../PeekableGenerator.js';
3
- import { getUnicodeCodepoints } from '../getUnicodeCodepoints.js';
4
- import { measureText } from '../measureText.js';
5
- import { SdfBufferHelper } from './SdfBufferHelper.js';
6
- import { layoutLine } from './layoutLine.js';
7
- export function layoutText2(text, sdfLetterSpacing, trFontFace) {
8
- const startingCodepointIndex = 0;
9
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10
- const shaper = trFontFace.shaper;
11
- assertTruthy(shaper);
12
- const shaperProps = {
13
- letterSpacing: sdfLetterSpacing,
14
- };
15
- // Get glyphs
16
- const glyphs = new PeekableIterator(shaper.shapeText(shaperProps, new PeekableIterator(getUnicodeCodepoints(text, startingCodepointIndex), startingCodepointIndex)));
17
- const maxLineWidth = 100;
18
- const maxLines = 1;
19
- const overflowSuffix = '...';
20
- const sdfOverflowSuffWidth = measureText(overflowSuffix, shaperProps, shaper);
21
- const bufferHelper = new SdfBufferHelper(new Float32Array(100), trFontFace);
22
- let moreLines = true;
23
- let lastLine = false;
24
- let curLineIndex = 0;
25
- while (moreLines) {
26
- lastLine = !(maxLines === 0 || curLineIndex + 1 < maxLines);
27
- layoutLine(glyphs,
28
- // If this is the last line, we need to account for the overflow suffix
29
- // in the maxLineWidth it will definitely fit.
30
- lastLine ? maxLineWidth - sdfOverflowSuffWidth : maxLineWidth, bufferHelper);
31
- const moreGlyphs = !glyphs.peek().done;
32
- // If lastLine and there are more glyphs, we need to add the overflow suffix
33
- // to the end of the line
34
- if (lastLine && moreGlyphs) {
35
- layoutLine(new PeekableIterator(shaper.shapeText(shaperProps, new PeekableIterator(getUnicodeCodepoints(overflowSuffix, 0), 0))), Infinity, bufferHelper);
36
- }
37
- moreLines = !lastLine && moreGlyphs;
38
- curLineIndex++;
39
- }
40
- }
41
- //# sourceMappingURL=layoutText2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layoutText2.js","sourceRoot":"","sources":["../../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/layoutText2.ts"],"names":[],"mappings":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AK,CAAC,IAAI,YAAY,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;QAE5D,UAAU,CACR,MAAM;QACN,uEAAuE;QACvE,8CAA8C;QAC9C,QAAQ,CAAC,CAAC,CAAC,YAAY,GAAG,oBAAoB,CAAC,CAAC,CAAC,YAAY,EAC7D,YAAY,CACb,CAAC;QAEF,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;QACvC,4EAA4E;QAC5E,yBAAyB;QACzB,IAAI,QAAQ,IAAI,UAAU,EAAE;YAC1B,UAAU,CACR,IAAI,gBAAgB,CAClB,MAAM,CAAC,SAAS,CACd,WAAW,EACX,IAAI,gBAAgB,CAAC,oBAAoB,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CACjE,CACF,EACD,QAAQ,EACR,YAAY,CACb,CAAC;SACH;QACD,SAAS,GAAG,CAAC,QAAQ,IAAI,UAAU,CAAC;QACpC,YAAY,EAAE,CAAC;KAChB;AACH,CAAC"}
@@ -1 +0,0 @@
1
- export declare function isWhiteSpace(codepoint: number): boolean;
@@ -1,4 +0,0 @@
1
- export function isWhiteSpace(codepoint) {
2
- return codepoint === 32 || codepoint === 10;
3
- }
4
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,KAAK,EAAE,IAAI,SAAS,KAAK,EAAE,CAAC;AAC9C,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=layoutText2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layoutText2.js","sourceRoot":"","sources":["../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/layoutText2.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { type Bound } from '../../../../lib/utils.js';
2
- import type { TrProps } from '../../TextRenderer.js';
3
- /**
4
- * Create a render window from the given parameters.
5
- *
6
- * @remarks
7
- * The render window is a rectangle that defines the area of the text that
8
- * should be rendered. It is used to skip rendering parts of the text that
9
- * are outside of the render window. The render window is relative to the
10
- * text's top left corner of the overrall text.
11
- *
12
- * @param x The x coordinate of the text element's top left corner relative to the screen.
13
- * @param y The y coordinate of the text element's top left corner relative to the screen.
14
- * @param scrollY The amount of pixels to scroll the text vertically.
15
- * @param lineHeight The height of a single line of text.
16
- * @param numExtraLines The number of extra lines to render above and below the visible window.
17
- * @param visibleWindow The visible window of the text element relative to the screen
18
- * @returns
19
- */
20
- export declare function makeRenderWindow(x: TrProps['x'], y: TrProps['y'], scrollY: TrProps['scrollY'], lineHeight: number, numExtraLines: number, visibleWindow: Bound): Bound;
@@ -1,55 +0,0 @@
1
- /*
2
- * If not stated otherwise in this file or this component's LICENSE file the
3
- * following copyright and licenses apply:
4
- *
5
- * Copyright 2023 Comcast Cable Communications Management, LLC.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the License);
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- import { isBoundPositive } from '../../../../lib/utils.js';
20
- /**
21
- * Create a render window from the given parameters.
22
- *
23
- * @remarks
24
- * The render window is a rectangle that defines the area of the text that
25
- * should be rendered. It is used to skip rendering parts of the text that
26
- * are outside of the render window. The render window is relative to the
27
- * text's top left corner of the overrall text.
28
- *
29
- * @param x The x coordinate of the text element's top left corner relative to the screen.
30
- * @param y The y coordinate of the text element's top left corner relative to the screen.
31
- * @param scrollY The amount of pixels to scroll the text vertically.
32
- * @param lineHeight The height of a single line of text.
33
- * @param numExtraLines The number of extra lines to render above and below the visible window.
34
- * @param visibleWindow The visible window of the text element relative to the screen
35
- * @returns
36
- */
37
- export function makeRenderWindow(x, y, scrollY, lineHeight, numExtraLines, visibleWindow) {
38
- const bufferMargin = lineHeight * numExtraLines;
39
- const x1 = visibleWindow.x1 - x;
40
- const y1 = visibleWindow.y1 - y;
41
- return isBoundPositive(visibleWindow)
42
- ? {
43
- x1: x1,
44
- y1: y1 + scrollY - bufferMargin,
45
- x2: x1 + (visibleWindow.x2 - visibleWindow.x1),
46
- y2: y1 + scrollY + (visibleWindow.y2 - visibleWindow.y1) + bufferMargin,
47
- }
48
- : {
49
- x1: 0,
50
- y1: 0,
51
- x2: 0,
52
- y2: 0,
53
- };
54
- }
55
- //# sourceMappingURL=makeRenderWindow.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeRenderWindow.js","sourceRoot":"","sources":["../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/makeRenderWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,eAAe,EAAc,MAAM,0BAA0B,CAAC;AAGvE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,CAAe,EACf,CAAe,EACf,OAA2B,EAC3B,UAAkB,EAClB,aAAqB,EACrB,aAAoB;IAEpB,MAAM,YAAY,GAAG,UAAU,GAAG,aAAa,CAAC;IAChD,MAAM,EAAE,GAAG,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;IAChC,MAAM,EAAE,GAAG,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC;IAChC,OAAO,eAAe,CAAC,aAAa,CAAC;QACnC,CAAC,CAAC;YACE,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE,GAAG,OAAO,GAAG,YAAY;YAC/B,EAAE,EAAE,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC;YAC9C,EAAE,EAAE,EAAE,GAAG,OAAO,GAAG,CAAC,aAAa,CAAC,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC,GAAG,YAAY;SACxE;QACH,CAAC,CAAC;YACE,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,CAAC;SACN,CAAC;AACR,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Round up to the nearest multiple of the given number.
3
- *
4
- * @param value
5
- * @param multiple
6
- * @returns
7
- */
8
- export declare function roundUpToMultiple(value: number, multiple: number): number;
9
- export declare function roundDownToMultiple(value: number, multiple: number): number;
@@ -1 +0,0 @@
1
- {"version":3,"file":"roundUpToMultiple.js","sourceRoot":"","sources":["../../../../../../../src/core/text-rendering/renderers/SdfTextRenderer/internal/roundUpToMultiple.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,QAAgB;IAC/D,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,QAAgB;IACjE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACjD,CAAC"}