@lightningjs/renderer 2.22.1 → 2.23.0

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 (44) hide show
  1. package/dist/src/core/CoreNode.d.ts +1 -1
  2. package/dist/src/core/lib/WebGlContextWrapper.d.ts +5 -5
  3. package/dist/src/core/platform.js +5 -2
  4. package/dist/src/core/platform.js.map +1 -1
  5. package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.d.ts +1 -0
  6. package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js +2 -0
  7. package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js.map +1 -0
  8. package/dist/src/core/shaders/webgl/Border.js +7 -13
  9. package/dist/src/core/shaders/webgl/Border.js.map +1 -1
  10. package/dist/src/core/shaders/webgl/RoundedWithBorder.js +6 -17
  11. package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -1
  12. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +4 -8
  13. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -1
  14. package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +5 -8
  15. package/dist/src/core/text-rendering/CanvasTextRenderer.js +13 -30
  16. package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +1 -1
  17. package/dist/src/core/text-rendering/SdfFontHandler.d.ts +125 -28
  18. package/dist/src/core/text-rendering/SdfFontHandler.js +337 -4
  19. package/dist/src/core/text-rendering/SdfFontHandler.js.map +1 -1
  20. package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +5 -6
  21. package/dist/src/core/text-rendering/SdfTextRenderer.js +15 -19
  22. package/dist/src/core/text-rendering/SdfTextRenderer.js.map +1 -1
  23. package/dist/src/core/text-rendering/TextLayoutEngine.d.ts +11 -12
  24. package/dist/src/core/text-rendering/TextLayoutEngine.js +29 -29
  25. package/dist/src/core/text-rendering/TextLayoutEngine.js.map +1 -1
  26. package/dist/src/core/text-rendering/TextRenderer.d.ts +16 -6
  27. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  28. package/package.json +1 -1
  29. package/src/core/platform.ts +6 -2
  30. package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +0 -45
  31. package/dist/src/core/renderers/webgl/WebGlRenderOp.js +0 -127
  32. package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +0 -1
  33. package/dist/src/core/text-rendering/CanvasFont.d.ts +0 -14
  34. package/dist/src/core/text-rendering/CanvasFont.js +0 -119
  35. package/dist/src/core/text-rendering/CanvasFont.js.map +0 -1
  36. package/dist/src/core/text-rendering/CoreFont.d.ts +0 -33
  37. package/dist/src/core/text-rendering/CoreFont.js +0 -48
  38. package/dist/src/core/text-rendering/CoreFont.js.map +0 -1
  39. package/dist/src/core/text-rendering/FontManager.d.ts +0 -11
  40. package/dist/src/core/text-rendering/FontManager.js +0 -41
  41. package/dist/src/core/text-rendering/FontManager.js.map +0 -1
  42. package/dist/src/core/text-rendering/SdfFont.d.ts +0 -29
  43. package/dist/src/core/text-rendering/SdfFont.js +0 -142
  44. package/dist/src/core/text-rendering/SdfFont.js.map +0 -1
@@ -831,7 +831,7 @@ export declare class CoreNode extends EventEmitter {
831
831
  get src(): string | null;
832
832
  set src(imageUrl: string | null);
833
833
  set imageType(type: 'regular' | 'compressed' | 'svg' | null);
834
- get imageType(): 'regular' | 'compressed' | 'svg' | null;
834
+ get imageType(): "regular" | "compressed" | "svg" | null;
835
835
  get srcHeight(): number | undefined;
836
836
  set srcHeight(value: number);
837
837
  get srcWidth(): number | undefined;
@@ -175,7 +175,7 @@ export declare class WebGlContextWrapper {
175
175
  *
176
176
  * @returns
177
177
  */
178
- createTexture(): WebGLTexture | null;
178
+ createTexture(): WebGLTexture;
179
179
  /**
180
180
  * ```
181
181
  * gl.deleteTexture(texture);
@@ -251,14 +251,14 @@ export declare class WebGlContextWrapper {
251
251
  *
252
252
  * @returns
253
253
  */
254
- createBuffer(): WebGLBuffer | null;
254
+ createBuffer(): WebGLBuffer;
255
255
  /**
256
256
  * ```
257
257
  * gl.createFramebuffer();
258
258
  * ```
259
259
  * @returns
260
260
  */
261
- createFramebuffer(): WebGLFramebuffer | null;
261
+ createFramebuffer(): WebGLFramebuffer;
262
262
  /**
263
263
  * ```
264
264
  * gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
@@ -539,7 +539,7 @@ export declare class WebGlContextWrapper {
539
539
  *
540
540
  * @returns
541
541
  */
542
- createVertexArray(): WebGLVertexArrayObject | null;
542
+ createVertexArray(): WebGLVertexArrayObject;
543
543
  /**
544
544
  * ```
545
545
  * gl.bindVertexArray(vertexArray);
@@ -651,7 +651,7 @@ export declare class WebGlContextWrapper {
651
651
  *
652
652
  * @returns
653
653
  */
654
- createProgram(): WebGLProgram | null;
654
+ createProgram(): WebGLProgram;
655
655
  /**
656
656
  * ```
657
657
  * gl.getProgramParameter(program, pname);
@@ -45,7 +45,7 @@ export const startLoop = (stage) => {
45
45
  // Use standard idle timeout when not throttling
46
46
  setTimeout(() => requestAnimationFrame(runLoop), 16.666666666666668);
47
47
  }
48
- if (!isIdle) {
48
+ if (isIdle === false) {
49
49
  stage.eventBus.emit('idle');
50
50
  isIdle = true;
51
51
  }
@@ -55,7 +55,10 @@ export const startLoop = (stage) => {
55
55
  stage.flushFrameEvents();
56
56
  return;
57
57
  }
58
- isIdle = false;
58
+ if (isIdle === true) {
59
+ stage.eventBus.emit('active');
60
+ isIdle = false;
61
+ }
59
62
  stage.drawFrame();
60
63
  stage.flushFrameEvents();
61
64
  // Schedule next frame
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../../src/core/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,EAAE;IACxC,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,aAAa,GAAG,CAAC,CAAC;IAE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AAC;QAED,KAAK,CAAC,SAAS,EAAE,CAAC;QAClB,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAEzB,sBAAsB;QACtB,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;YACxB,2DAA2D;YAC3D,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAC7B,CAAC,EACD,eAAe,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,CACpD,CAAC;YACF,UAAU,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,uCAAuC;YACvC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;IAEF,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AACtD,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WebGlCoreShader.destroy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGlCoreShader.destroy.js","sourceRoot":"","sources":["../../../../../src/core/renderers/webgl/WebGlCoreShader.destroy.ts"],"names":[],"mappings":""}
@@ -143,23 +143,17 @@ export const Border = {
143
143
  vec4 resultColor = vec4(0.0);
144
144
  vec2 boxUv = v_nodeCoords.xy * u_dimensions - v_halfDimensions;
145
145
 
146
- float outerDist = box(boxUv + v_outerBorderUv, v_outerSize - v_edgeWidth);
147
- float innerDist = box(boxUv + v_innerBorderUv, v_innerSize - v_edgeWidth);
148
-
149
- if(u_borderGap == 0.0) {
150
- resultColor = mix(resultColor, u_borderColor, 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, outerDist));
151
- resultColor = mix(resultColor, color, 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, innerDist));
152
- gl_FragColor = resultColor * u_alpha;
153
- return;
154
- }
155
-
156
146
  float nodeDist = box(boxUv, v_halfDimensions - v_edgeWidth);
157
147
  float nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
148
+ resultColor = mix(resultColor, color, nodeAlpha);
149
+
150
+ float outerDist = box(boxUv + v_outerBorderUv, v_outerSize - v_edgeWidth);
151
+ float innerDist = box(boxUv + v_innerBorderUv, v_innerSize - v_edgeWidth);
158
152
 
159
153
  float borderDist = max(-innerDist, outerDist);
160
- float borderAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, borderDist);
161
- resultColor = mix(resultColor, color, nodeAlpha);
162
- resultColor = mix(resultColor, u_borderColor, borderAlpha * u_borderColor.a);
154
+ float borderAlpha = (1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, borderDist)) * u_borderColor.a;
155
+
156
+ resultColor = mix(resultColor, vec4(u_borderColor.rgb, 1.0), borderAlpha);
163
157
 
164
158
  gl_FragColor = resultColor * u_alpha;
165
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Border.js","sourceRoot":"","sources":["../../../../../src/core/shaders/webgl/Border.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,cAAc,GAEf,MAAM,gCAAgC,CAAC;AAIxC,MAAM,CAAC,MAAM,MAAM,GAAiC;IAClD,KAAK,EAAE,cAAc,CAAC,KAAK;IAC3B,MAAM,CAAC,IAAI;QACT,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,CAAS,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,KAAK,CAAC,CAAC;QACrD,IA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177,33 +177,22 @@ export const RoundedWithBorder = {
177
177
  vec4 resultColor = vec4(0.0);
178
178
  vec2 boxUv = v_nodeCoords.xy * u_dimensions - v_halfDimensions;
179
179
 
180
- float nodeDist;
181
- float nodeAlpha;
180
+ float nodeDist = roundedBox(boxUv, v_halfDimensions - v_edgeWidth, u_radius);
181
+ float nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
182
+ resultColor = mix(resultColor, color, nodeAlpha);
182
183
 
183
184
  if(v_borderZero == 1.0) {
184
- nodeDist = roundedBox(boxUv, v_halfDimensions - v_edgeWidth, u_radius);
185
- nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
186
- gl_FragColor = mix(vec4(0.0), color, nodeAlpha) * u_alpha;
185
+ gl_FragColor = resultColor * u_alpha;
187
186
  return;
188
187
  }
189
188
 
190
189
  float outerDist = roundedBox(boxUv + v_outerBorderUv, v_outerSize - v_edgeWidth, v_outerBorderRadius);
191
190
  float innerDist = roundedBox(boxUv + v_innerBorderUv, v_innerSize - v_edgeWidth, v_innerBorderRadius);
192
191
 
193
- if(u_borderGap == 0.0) {
194
- resultColor = mix(resultColor, u_borderColor, 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, outerDist));
195
- resultColor = mix(resultColor, color, 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, innerDist));
196
- gl_FragColor = resultColor * u_alpha;
197
- return;
198
- }
199
-
200
- nodeDist = roundedBox(boxUv, v_halfDimensions - v_edgeWidth, u_radius);
201
- nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
202
192
  float borderDist = max(-innerDist, outerDist);
203
- float borderAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, borderDist);
193
+ float borderAlpha = (1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, borderDist)) * u_borderColor.a;
204
194
 
205
- resultColor = mix(vec4(0.0), color, nodeAlpha);
206
- resultColor = mix(resultColor, u_borderColor, borderAlpha * u_borderColor.a);
195
+ resultColor = mix(resultColor, vec4(u_borderColor.rgb, 1.0), borderAlpha);
207
196
  gl_FragColor = resultColor * u_alpha;
208
197
  }
209
198
  `,
@@ -1 +1 @@
1
- {"version":3,"file":"RoundedWithBorder.js","sourceRoot":"","sources":["../../../../../src/core/shaders/webgl/RoundedWithBorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,yBAAyB,GAE1B,MAAM,2CAA2C,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAA4C;IACxE,KAAK,EAAE,yBAAyB,CAAC,KAAK;IACtC,MAAM,CAAC,IAAc;QACnB,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,cAAc,CAAC,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,UAAU,CAAS,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,KAAM,CAAC,YAAY,CAAW,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,cAAc,CAAW,CAAC,CAAC;QAEvE,IAAI,CAAC,UAAU,CACb,UAAU,EACV,uBAAuB,CAAC,IAAI,CAAC,KAAM,CAAC,MAAc,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CACpE,CAAC;IACJ,CAAC;IACD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;GA+DT;CACF,CAAC"}
@@ -191,13 +191,11 @@ export const RoundedWithBorderAndShadow = {
191
191
  vec4 color = texture2D(u_texture, v_textureCoords) * v_color;
192
192
  vec4 resultColor = vec4(0.0);
193
193
  vec2 boxUv = v_nodeCoords.xy * u_dimensions - v_halfDimensions;
194
- float nodeDist;
195
- float nodeAlpha;
194
+ float nodeDist = roundedBox(boxUv, v_halfDimensions - v_edgeWidth, u_radius);
195
+ float nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
196
196
  float shadowAlpha;
197
197
 
198
198
  if(v_borderZero == 1.0) {
199
- nodeDist = roundedBox(boxUv, v_halfDimensions - v_edgeWidth, u_radius);
200
- nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
201
199
  shadowAlpha = shadowBox(boxUv - u_shadow.xy, v_halfDimensions + u_shadow.w - v_edgeWidth, u_radius + u_shadow.z);
202
200
  resultColor = mix(resultColor, u_shadowColor, shadowAlpha);
203
201
  gl_FragColor = mix(resultColor, color, nodeAlpha) * u_alpha;
@@ -211,15 +209,13 @@ export const RoundedWithBorderAndShadow = {
211
209
  shadowAlpha = shadowBox(boxUv - u_shadow.xy, v_halfDimensions + u_shadow.w - v_edgeWidth, u_radius + u_shadow.z);
212
210
  }
213
211
 
214
- nodeDist = roundedBox(boxUv, v_halfDimensions - v_edgeWidth, u_radius);
215
- nodeAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, nodeDist);
216
212
  float outerDist = roundedBox(boxUv + v_outerBorderUv, v_outerSize - v_edgeWidth, v_outerBorderRadius);
217
213
  float innerDist = roundedBox(boxUv + v_innerBorderUv, v_innerSize - v_edgeWidth, v_innerBorderRadius);
218
214
  float borderDist = max(-innerDist, outerDist);
219
- float borderAlpha = 1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, borderDist);
215
+ float borderAlpha = (1.0 - smoothstep(-0.5 * v_edgeWidth, 0.5 * v_edgeWidth, borderDist)) * u_borderColor.a;
220
216
  resultColor = mix(resultColor, u_shadowColor, shadowAlpha);
221
217
  resultColor = mix(resultColor, color, nodeAlpha);
222
- resultColor = mix(resultColor, u_borderColor, borderAlpha * u_borderColor.a);
218
+ resultColor = mix(resultColor, vec4(u_borderColor.rgb, 1.0), borderAlpha);
223
219
  gl_FragColor = resultColor * u_alpha;
224
220
  }
225
221
  `,
@@ -1 +1 @@
1
- {"version":3,"file":"RoundedWithBorderAndShadow.js","sourceRoot":"","sources":["../../../../../src/core/shaders/webgl/RoundedWithBorderAndShadow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,kCAAkC,GAEnC,MAAM,oDAAoD,CAAC;AAE5D,MAAM,CAAC,MAAM,0BAA0B,GACrC;IACE,KAAK,EAAE,kCAAkC,CAAC,KAAK;IAC/C,MAAM,CAAC,IAAc;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAM,CAAC;QAC1B,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC,UAAU,CAAS,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,KAAM,CAAC,YAAY,CAAW,CAAC,CAAC;QACnE,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,KAAM,CAAC,cAAc,CAAW,CAAC,CAAC;QAEvE,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAExD,IA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CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,UAAU,CACb,UAAU,EACV,uBAAuB,CAAC,KAAK,CAAC,MAAc,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAC9D,CAAC;IACJ,CAAC;IACD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GT;IACC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFX;CACA,CAAC"}
@@ -1,20 +1,17 @@
1
1
  import type { Stage } from '../Stage.js';
2
- import type { FontLoadOptions, TextRenderInfo } from './TextRenderer.js';
2
+ import type { TextRenderInfo } from './TextRenderer.js';
3
+ import * as CanvasFontHandler from './CanvasFontHandler.js';
3
4
  import type { CoreTextNodeProps } from '../CoreTextNode.js';
4
- import { CanvasFont } from './CanvasFont.js';
5
- import type { CoreFontManager } from './FontManager.js';
6
- export declare let context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null;
7
- export declare let measureContext: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null;
8
5
  /**
9
6
  * Canvas Text Renderer - implements TextRenderer interface
10
7
  */
11
8
  declare const CanvasTextRenderer: {
12
9
  type: "canvas";
13
- createFont: (settings: FontLoadOptions) => CanvasFont | undefined;
14
- renderText: (font: CanvasFont, props: CoreTextNodeProps) => TextRenderInfo;
10
+ font: typeof CanvasFontHandler;
11
+ renderText: (props: CoreTextNodeProps) => TextRenderInfo;
15
12
  addQuads: () => Float32Array | null;
16
13
  renderQuads: () => void;
17
- init: (stage: Stage, fontManager: CoreFontManager) => void;
14
+ init: (stage: Stage) => void;
18
15
  clearLayoutCache: () => void;
19
16
  };
20
17
  export default CanvasTextRenderer;
@@ -17,20 +17,20 @@
17
17
  * limitations under the License.
18
18
  */
19
19
  import { assertTruthy } from '../../utils.js';
20
+ import * as CanvasFontHandler from './CanvasFontHandler.js';
20
21
  import { hasZeroWidthSpace } from './Utils.js';
21
22
  import { mapTextLayout } from './TextLayoutEngine.js';
22
- import { CanvasFont } from './CanvasFont.js';
23
23
  const MAX_TEXTURE_DIMENSION = 4096;
24
24
  const type = 'canvas';
25
25
  let canvas = null;
26
- export let context = null;
26
+ let context = null;
27
27
  // Separate canvas and context for text measurements
28
28
  let measureCanvas = null;
29
- export let measureContext = null;
29
+ let measureContext = null;
30
30
  // Cache for text layout calculations
31
31
  const layoutCache = new Map();
32
32
  // Initialize the Text Renderer
33
- const init = (stage, fontManager) => {
33
+ const init = (stage) => {
34
34
  const dpr = stage.options.devicePhysicalPixelRatio;
35
35
  // Drawing canvas and context
36
36
  canvas = stage.platform.createCanvas();
@@ -45,24 +45,7 @@ const init = (stage, fontManager) => {
45
45
  // Set up a minimal size for the measuring canvas since we only use it for measurements
46
46
  measureCanvas.width = 1;
47
47
  measureCanvas.height = 1;
48
- // Register the default 'sans-serif' font face
49
- const defaultMetrics = {
50
- ascender: 800,
51
- descender: -200,
52
- lineGap: 200,
53
- unitsPerEm: 1000,
54
- };
55
- fontManager.loadFont(type, {
56
- fontFamily: 'sans-serif',
57
- metrics: defaultMetrics,
58
- });
59
- };
60
- const createFont = (settings) => {
61
- if (settings.fontFamily !== 'sans-serif' && settings.fontUrl === undefined) {
62
- console.error('fontUrl is missing');
63
- return;
64
- }
65
- return new CanvasFont(CanvasTextRenderer, settings, measureContext);
48
+ CanvasFontHandler.init(context, measureContext);
66
49
  };
67
50
  /**
68
51
  * Canvas text renderer
@@ -71,26 +54,26 @@ const createFont = (settings) => {
71
54
  * @param props - Text rendering properties
72
55
  * @returns Object containing ImageData and dimensions
73
56
  */
74
- const renderText = (font, props) => {
57
+ const renderText = (props) => {
75
58
  assertTruthy(canvas, 'Canvas is not initialized');
76
59
  assertTruthy(context, 'Canvas context is not available');
77
60
  assertTruthy(measureContext, 'Canvas measureContext is not available');
78
61
  // Extract already normalized properties
79
62
  const { text, fontFamily, fontStyle, fontSize, textAlign, maxLines, lineHeight, verticalAlign, overflowSuffix, maxWidth, maxHeight, wordBreak, } = props;
80
- const canvasFont = `${fontStyle} ${fontSize}px Unknown, ${fontFamily}`;
63
+ const font = `${fontStyle} ${fontSize}px Unknown, ${fontFamily}`;
81
64
  // Get font metrics and calculate line height
82
- measureContext.font = canvasFont;
65
+ measureContext.font = font;
83
66
  measureContext.textBaseline = 'hanging';
84
- const metrics = font.getMetrics(fontSize);
67
+ const metrics = CanvasFontHandler.getFontMetrics(fontFamily, fontSize);
85
68
  const letterSpacing = props.letterSpacing;
86
- const [lines, remainingLines, hasRemainingText, bareLineHeight, lineHeightPx, effectiveWidth, effectiveHeight,] = mapTextLayout(font, metrics, text, textAlign, fontFamily, lineHeight, overflowSuffix, wordBreak, letterSpacing, maxLines, maxWidth, maxHeight);
69
+ const [lines, remainingLines, hasRemainingText, bareLineHeight, lineHeightPx, effectiveWidth, effectiveHeight,] = mapTextLayout(CanvasFontHandler.measureText, metrics, text, textAlign, fontFamily, lineHeight, overflowSuffix, wordBreak, letterSpacing, maxLines, maxWidth, maxHeight);
87
70
  const lineAmount = lines.length;
88
71
  const canvasW = Math.ceil(effectiveWidth);
89
72
  const canvasH = Math.ceil(effectiveHeight);
90
73
  canvas.width = canvasW;
91
74
  canvas.height = canvasH;
92
75
  context.fillStyle = 'white';
93
- context.font = canvasFont;
76
+ context.font = font;
94
77
  context.textBaseline = 'hanging';
95
78
  // Performance optimization for large fonts
96
79
  if (fontSize >= 128) {
@@ -114,7 +97,7 @@ const renderText = (font, props) => {
114
97
  continue;
115
98
  }
116
99
  context.fillText(char, currentX, currentY);
117
- currentX += font.measureText(char, letterSpacing);
100
+ currentX += CanvasFontHandler.measureText(char, fontFamily, letterSpacing);
118
101
  }
119
102
  }
120
103
  }
@@ -163,7 +146,7 @@ const renderQuads = () => {
163
146
  */
164
147
  const CanvasTextRenderer = {
165
148
  type,
166
- createFont,
149
+ font: CanvasFontHandler,
167
150
  renderText,
168
151
  addQuads,
169
152
  renderQuads,
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasTextRenderer.js","sourceRoot":"","sources":["../../../../src/core/text-rendering/CanvasTextRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAGnE,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,IAAI,GAAG,QAAiB,CAAC;AAE/B,IAAI,MAAM,GAA+C,IAAI,CAAC;AAC9D,MAAM,CAAC,IAAI,OAAO,GAGP,IAAI,CAAC;AAEhB,oDAAoD;AACpD,IAAI,aAAa,GAA+C,IAAI,CAAC;AACrE,MAAM,CAAC,IAAI,cAAc,GAGd,IAAI,CAAC;AAEhB,qCAAqC;AACrC,MAAM,WAAW,GAAG,IAAI,GAAG,EASxB,CAAC;AAEJ,+BAA+B;AAC/B,MAAM,IAAI,GAAG,CAAC,KAAY,EAAE,WAA4B,EAAQ,EAAE;IAChE,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;IAEnD,6BAA6B;IAC7B,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAyC,CAAC;IAC9E,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAEzB,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAC,GAAG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AAQ,GAAG,GAAwB,EAAE;IACzC,mDAAmD;IACnD,0CAA0C;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,GAAG,GAAS,EAAE;IAC7B,mDAAmD;IACnD,kDAAkD;AACpD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACzB,IAAI;IACJ,IAAI,EAAE,iBAAiB;IACvB,UAAU;IACV,QAAQ;IACR,WAAW;IACX,IAAI;IACJ,gBAAgB;CACjB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,30 +1,30 @@
1
- import type { FontMetrics } from './TextRenderer.js';
2
- export interface SdfGlyph {
3
- id: number;
4
- char: string;
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- xoffset: number;
10
- yoffset: number;
11
- xadvance: number;
12
- page: number;
13
- chnl: number;
14
- }
15
- export type SdfGlyphMap = Record<number, SdfGlyph>;
16
- export interface SdfKerning {
17
- first: number;
18
- second: number;
19
- amount: number;
20
- }
1
+ import type { FontFamilyMap, FontMetrics, NormalizedFontMetrics, TrProps, FontLoadOptions } from './TextRenderer.js';
2
+ import type { ImageTexture } from '../textures/ImageTexture.js';
3
+ import type { Stage } from '../Stage.js';
4
+ import type { CoreTextNode } from '../CoreTextNode.js';
21
5
  /**
22
6
  * SDF Font Data structure matching msdf-bmfont-xml output
23
7
  */
24
8
  export interface SdfFontData {
25
9
  pages: string[];
26
- chars: SdfGlyph[];
27
- kernings: SdfKerning[];
10
+ chars: Array<{
11
+ id: number;
12
+ char: string;
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ xoffset: number;
18
+ yoffset: number;
19
+ xadvance: number;
20
+ page: number;
21
+ chnl: number;
22
+ }>;
23
+ kernings: Array<{
24
+ first: number;
25
+ second: number;
26
+ amount: number;
27
+ }>;
28
28
  info: {
29
29
  face: string;
30
30
  size: number;
@@ -75,11 +75,108 @@ export interface SdfFontData {
75
75
  * @typedef {Object} KerningTable
76
76
  * Fast lookup table for kerning values
77
77
  */
78
- export type KerningTable = Record<number, Record<number, number | undefined> | undefined>;
78
+ type KerningTable = Record<number, Record<number, number | undefined> | undefined>;
79
+ /**
80
+ * @typedef {Object} SdfFontCache
81
+ * Cached font data for performance
82
+ */
83
+ export interface SdfFont {
84
+ data: SdfFontData;
85
+ glyphMap: Map<number, SdfFontData['chars'][0]>;
86
+ kernings: KerningTable;
87
+ atlasTexture: ImageTexture;
88
+ metrics: FontMetrics;
89
+ maxCharHeight: number;
90
+ }
91
+ /**
92
+ * Check if the SDF font handler can render a font
93
+ * @param {TrProps} trProps - Text rendering properties
94
+ * @returns {boolean} True if the font can be rendered
95
+ */
96
+ export declare const canRenderFont: (trProps: TrProps) => boolean;
97
+ /**
98
+ * Load SDF font from JSON + PNG atlas
99
+ * @param {Object} options - Font loading options
100
+ * @param {string} options.fontFamily - Font family name
101
+ * @param {string} options.fontUrl - JSON font data URL (atlasDataUrl)
102
+ * @param {string} options.atlasUrl - PNG atlas texture URL
103
+ * @param {FontMetrics} options.metrics - Optional font metrics
104
+ */
105
+ export declare const loadFont: (stage: Stage, options: FontLoadOptions) => Promise<void>;
106
+ /**
107
+ * Stop waiting for a font to load
108
+ * @param {string} fontFamily - Font family name
109
+ * @param {CoreTextNode} node - Node that was waiting for the font
110
+ */
111
+ export declare const waitingForFont: (fontFamily: string, node: CoreTextNode) => void;
112
+ /**
113
+ * Stop waiting for a font to load
114
+ *
115
+ * @param fontFamily
116
+ * @param node
117
+ * @returns
118
+ */
119
+ export declare const stopWaitingForFont: (fontFamily: string, node: CoreTextNode) => void;
120
+ /**
121
+ * Get the font families map for resolving fonts
122
+ */
123
+ export declare const getFontFamilies: () => FontFamilyMap;
124
+ /**
125
+ * Initialize the SDF font handler
126
+ */
127
+ export declare const init: (c?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D) => void;
128
+ export declare const type = "sdf";
129
+ /**
130
+ * Check if a font is already loaded by font family
131
+ */
132
+ export declare const isFontLoaded: (fontFamily: string) => boolean;
133
+ /**
134
+ * Get normalized font metrics for a font family
135
+ */
136
+ export declare const getFontMetrics: (fontFamily: string, fontSize: number) => NormalizedFontMetrics;
137
+ export declare const processFontMetrics: (fontFamily: string, fontSize: number, metrics: FontMetrics) => NormalizedFontMetrics;
138
+ /**
139
+ * Get glyph data for a character in a specific font
140
+ * @param {string} fontFamily - Font family name
141
+ * @param {number} codepoint - Character codepoint
142
+ * @returns {Object|null} Glyph data or null if not found
143
+ */
144
+ export declare const getGlyph: (fontFamily: string, codepoint: number) => SdfFontData["chars"][0] | null;
145
+ /**
146
+ * Get kerning value between two glyphs
147
+ * @param {string} fontFamily - Font family name
148
+ * @param {number} firstGlyph - First glyph ID
149
+ * @param {number} secondGlyph - Second glyph ID
150
+ * @returns {number} Kerning value or 0
151
+ */
152
+ export declare const getKerning: (fontFamily: string, firstGlyph: number, secondGlyph: number) => number;
153
+ /**
154
+ * Get atlas texture for a font family
155
+ * @param {string} fontFamily - Font family name
156
+ * @returns {ImageTexture|null} Atlas texture or null
157
+ */
158
+ export declare const getAtlas: (fontFamily: string) => ImageTexture | null;
159
+ /**
160
+ * Get font data for a font family
161
+ * @param {string} fontFamily - Font family name
162
+ * @returns {SdfFontData|null} Font data or null
163
+ */
164
+ export declare const getFontData: (fontFamily: string) => SdfFont | undefined;
165
+ /**
166
+ * Get maximum character height for a font family
167
+ * @param {string} fontFamily - Font family name
168
+ * @returns {number} Max character height or 0
169
+ */
170
+ export declare const getMaxCharHeight: (fontFamily: string) => number;
171
+ /**
172
+ * Get all loaded font families
173
+ * @returns {string[]} Array of font family names
174
+ */
175
+ export declare const getLoadedFonts: () => string[];
79
176
  /**
80
- * Build kerning lookup table for fast access
81
- * @param {Array} kernings - Kerning data from font
82
- * @returns {KerningTable} Optimized kerning lookup table
177
+ * Unload a font and free resources
178
+ * @param {string} fontFamily - Font family name
83
179
  */
84
- export declare const buildKerningTable: (kernings: SdfKerning[]) => KerningTable;
85
- export declare const buildGlyphMap: (chars: SdfGlyph[]) => SdfGlyphMap;
180
+ export declare const unloadFont: (fontFamily: string) => void;
181
+ export declare const measureText: (text: string, fontFamily: string, letterSpacing: number) => number;
182
+ export {};