@lightningjs/renderer 2.16.0 → 2.18.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 (257) hide show
  1. package/dist/src/core/CoreNode.js +7 -5
  2. package/dist/src/core/CoreNode.js.map +1 -1
  3. package/dist/src/core/CoreTextureManager.d.ts +14 -8
  4. package/dist/src/core/CoreTextureManager.js +33 -59
  5. package/dist/src/core/CoreTextureManager.js.map +1 -1
  6. package/dist/src/core/Stage.d.ts +3 -3
  7. package/dist/src/core/Stage.js +9 -14
  8. package/dist/src/core/Stage.js.map +1 -1
  9. package/dist/src/core/TextureMemoryManager.d.ts +21 -17
  10. package/dist/src/core/TextureMemoryManager.js +99 -124
  11. package/dist/src/core/TextureMemoryManager.js.map +1 -1
  12. package/dist/src/core/lib/WebGlContextWrapper.d.ts +10 -0
  13. package/dist/src/core/lib/WebGlContextWrapper.js +32 -0
  14. package/dist/src/core/lib/WebGlContextWrapper.js.map +1 -1
  15. package/dist/src/core/lib/textureCompression.js +13 -6
  16. package/dist/src/core/lib/textureCompression.js.map +1 -1
  17. package/dist/src/core/platform.js +4 -1
  18. package/dist/src/core/platform.js.map +1 -1
  19. package/dist/src/core/renderers/CoreContextTexture.d.ts +1 -0
  20. package/dist/src/core/renderers/CoreContextTexture.js.map +1 -1
  21. package/dist/src/core/renderers/canvas/CanvasCoreTexture.d.ts +1 -0
  22. package/dist/src/core/renderers/canvas/CanvasCoreTexture.js +4 -3
  23. package/dist/src/core/renderers/canvas/CanvasCoreTexture.js.map +1 -1
  24. package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.d.ts +9 -0
  25. package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js +59 -29
  26. package/dist/src/core/renderers/webgl/WebGlCoreCtxTexture.js.map +1 -1
  27. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js +4 -4
  28. package/dist/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.js.map +1 -1
  29. package/dist/src/core/textures/ColorTexture.d.ts +2 -2
  30. package/dist/src/core/textures/ColorTexture.js +1 -2
  31. package/dist/src/core/textures/ColorTexture.js.map +1 -1
  32. package/dist/src/core/textures/ImageTexture.d.ts +7 -1
  33. package/dist/src/core/textures/ImageTexture.js +55 -39
  34. package/dist/src/core/textures/ImageTexture.js.map +1 -1
  35. package/dist/src/core/textures/NoiseTexture.js +1 -1
  36. package/dist/src/core/textures/NoiseTexture.js.map +1 -1
  37. package/dist/src/core/textures/RenderTexture.js +1 -1
  38. package/dist/src/core/textures/RenderTexture.js.map +1 -1
  39. package/dist/src/core/textures/SubTexture.d.ts +1 -2
  40. package/dist/src/core/textures/SubTexture.js +11 -29
  41. package/dist/src/core/textures/SubTexture.js.map +1 -1
  42. package/dist/src/core/textures/Texture.d.ts +51 -7
  43. package/dist/src/core/textures/Texture.js +127 -15
  44. package/dist/src/core/textures/Texture.js.map +1 -1
  45. package/dist/src/main-api/Inspector.d.ts +3 -0
  46. package/dist/src/main-api/Inspector.js +156 -0
  47. package/dist/src/main-api/Inspector.js.map +1 -1
  48. package/dist/src/main-api/Renderer.d.ts +1 -3
  49. package/dist/src/main-api/Renderer.js +2 -4
  50. package/dist/src/main-api/Renderer.js.map +1 -1
  51. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  52. package/package.json +1 -1
  53. package/src/core/CoreNode.ts +8 -4
  54. package/src/core/CoreTextureManager.ts +59 -65
  55. package/src/core/Stage.ts +10 -16
  56. package/src/core/TextureMemoryManager.ts +118 -148
  57. package/src/core/lib/WebGlContextWrapper.ts +38 -0
  58. package/src/core/lib/textureCompression.ts +18 -7
  59. package/src/core/platform.ts +5 -1
  60. package/src/core/renderers/CoreContextTexture.ts +1 -0
  61. package/src/core/renderers/canvas/CanvasCoreTexture.ts +5 -3
  62. package/src/core/renderers/webgl/WebGlCoreCtxTexture.ts +78 -40
  63. package/src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts +10 -4
  64. package/src/core/textures/ColorTexture.ts +4 -7
  65. package/src/core/textures/ImageTexture.ts +66 -51
  66. package/src/core/textures/NoiseTexture.ts +1 -1
  67. package/src/core/textures/RenderTexture.ts +1 -1
  68. package/src/core/textures/SubTexture.ts +14 -31
  69. package/src/core/textures/Texture.ts +150 -21
  70. package/src/main-api/Inspector.ts +203 -0
  71. package/src/main-api/Renderer.ts +2 -4
  72. package/dist/exports/canvas-shaders.d.ts +0 -10
  73. package/dist/exports/canvas-shaders.js +0 -27
  74. package/dist/exports/canvas-shaders.js.map +0 -1
  75. package/dist/exports/webgl-shaders.d.ts +0 -11
  76. package/dist/exports/webgl-shaders.js +0 -28
  77. package/dist/exports/webgl-shaders.js.map +0 -1
  78. package/dist/src/core/platforms/Platform.d.ts +0 -37
  79. package/dist/src/core/platforms/Platform.js +0 -22
  80. package/dist/src/core/platforms/Platform.js.map +0 -1
  81. package/dist/src/core/platforms/web/WebPlatform.d.ts +0 -9
  82. package/dist/src/core/platforms/web/WebPlatform.js +0 -58
  83. package/dist/src/core/platforms/web/WebPlatform.js.map +0 -1
  84. package/dist/src/core/renderers/CoreShaderNode.d.ts +0 -59
  85. package/dist/src/core/renderers/CoreShaderNode.js +0 -113
  86. package/dist/src/core/renderers/CoreShaderNode.js.map +0 -1
  87. package/dist/src/core/renderers/CoreShaderProgram.d.ts +0 -4
  88. package/dist/src/core/renderers/CoreShaderProgram.js +0 -20
  89. package/dist/src/core/renderers/CoreShaderProgram.js.map +0 -1
  90. package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +0 -37
  91. package/dist/src/core/renderers/canvas/CanvasRenderer.js +0 -215
  92. package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +0 -1
  93. package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +0 -21
  94. package/dist/src/core/renderers/canvas/CanvasShaderNode.js +0 -57
  95. package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +0 -1
  96. package/dist/src/core/renderers/canvas/CanvasTexture.d.ts +0 -16
  97. package/dist/src/core/renderers/canvas/CanvasTexture.js +0 -124
  98. package/dist/src/core/renderers/canvas/CanvasTexture.js.map +0 -1
  99. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.d.ts +0 -12
  100. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js +0 -55
  101. package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js.map +0 -1
  102. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.d.ts +0 -9
  103. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js +0 -38
  104. package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js.map +0 -1
  105. package/dist/src/core/renderers/webgl/WebGlCtxTexture.d.ts +0 -57
  106. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +0 -224
  107. package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +0 -1
  108. package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +0 -44
  109. package/dist/src/core/renderers/webgl/WebGlRenderOp.js +0 -125
  110. package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +0 -1
  111. package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +0 -136
  112. package/dist/src/core/renderers/webgl/WebGlRenderer.js +0 -573
  113. package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +0 -1
  114. package/dist/src/core/renderers/webgl/WebGlShaderNode.d.ts +0 -222
  115. package/dist/src/core/renderers/webgl/WebGlShaderNode.js +0 -331
  116. package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +0 -1
  117. package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +0 -35
  118. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +0 -201
  119. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +0 -1
  120. package/dist/src/core/shaders/canvas/Border.d.ts +0 -9
  121. package/dist/src/core/shaders/canvas/Border.js +0 -57
  122. package/dist/src/core/shaders/canvas/Border.js.map +0 -1
  123. package/dist/src/core/shaders/canvas/HolePunch.d.ts +0 -7
  124. package/dist/src/core/shaders/canvas/HolePunch.js +0 -38
  125. package/dist/src/core/shaders/canvas/HolePunch.js.map +0 -1
  126. package/dist/src/core/shaders/canvas/LinearGradient.d.ts +0 -10
  127. package/dist/src/core/shaders/canvas/LinearGradient.js +0 -48
  128. package/dist/src/core/shaders/canvas/LinearGradient.js.map +0 -1
  129. package/dist/src/core/shaders/canvas/RadialGradient.d.ts +0 -11
  130. package/dist/src/core/shaders/canvas/RadialGradient.js +0 -70
  131. package/dist/src/core/shaders/canvas/RadialGradient.js.map +0 -1
  132. package/dist/src/core/shaders/canvas/Rounded.d.ts +0 -7
  133. package/dist/src/core/shaders/canvas/Rounded.js +0 -33
  134. package/dist/src/core/shaders/canvas/Rounded.js.map +0 -1
  135. package/dist/src/core/shaders/canvas/RoundedWithBorder.d.ts +0 -7
  136. package/dist/src/core/shaders/canvas/RoundedWithBorder.js +0 -43
  137. package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +0 -1
  138. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.d.ts +0 -8
  139. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +0 -41
  140. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +0 -1
  141. package/dist/src/core/shaders/canvas/RoundedWithShadow.d.ts +0 -7
  142. package/dist/src/core/shaders/canvas/RoundedWithShadow.js +0 -40
  143. package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +0 -1
  144. package/dist/src/core/shaders/canvas/Shadow.d.ts +0 -8
  145. package/dist/src/core/shaders/canvas/Shadow.js +0 -31
  146. package/dist/src/core/shaders/canvas/Shadow.js.map +0 -1
  147. package/dist/src/core/shaders/canvas/utils/render.d.ts +0 -5
  148. package/dist/src/core/shaders/canvas/utils/render.js +0 -84
  149. package/dist/src/core/shaders/canvas/utils/render.js.map +0 -1
  150. package/dist/src/core/shaders/templates/BorderTemplate.d.ts +0 -37
  151. package/dist/src/core/shaders/templates/BorderTemplate.js +0 -73
  152. package/dist/src/core/shaders/templates/BorderTemplate.js.map +0 -1
  153. package/dist/src/core/shaders/templates/HolePunchTemplate.d.ts +0 -46
  154. package/dist/src/core/shaders/templates/HolePunchTemplate.js +0 -35
  155. package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +0 -1
  156. package/dist/src/core/shaders/templates/LinearGradientTemplate.d.ts +0 -23
  157. package/dist/src/core/shaders/templates/LinearGradientTemplate.js +0 -47
  158. package/dist/src/core/shaders/templates/LinearGradientTemplate.js.map +0 -1
  159. package/dist/src/core/shaders/templates/RadialGradientTemplate.d.ts +0 -31
  160. package/dist/src/core/shaders/templates/RadialGradientTemplate.js +0 -49
  161. package/dist/src/core/shaders/templates/RadialGradientTemplate.js.map +0 -1
  162. package/dist/src/core/shaders/templates/RoundedTemplate.d.ts +0 -29
  163. package/dist/src/core/shaders/templates/RoundedTemplate.js +0 -67
  164. package/dist/src/core/shaders/templates/RoundedTemplate.js.map +0 -1
  165. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +0 -7
  166. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js +0 -24
  167. package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js.map +0 -1
  168. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +0 -6
  169. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js +0 -23
  170. package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js.map +0 -1
  171. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +0 -6
  172. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js +0 -23
  173. package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js.map +0 -1
  174. package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +0 -34
  175. package/dist/src/core/shaders/templates/ShadowTemplate.js +0 -66
  176. package/dist/src/core/shaders/templates/ShadowTemplate.js.map +0 -1
  177. package/dist/src/core/shaders/templates/shaderUtils.d.ts +0 -5
  178. package/dist/src/core/shaders/templates/shaderUtils.js +0 -41
  179. package/dist/src/core/shaders/templates/shaderUtils.js.map +0 -1
  180. package/dist/src/core/shaders/utils.d.ts +0 -5
  181. package/dist/src/core/shaders/utils.js +0 -41
  182. package/dist/src/core/shaders/utils.js.map +0 -1
  183. package/dist/src/core/shaders/webgl/Border.d.ts +0 -3
  184. package/dist/src/core/shaders/webgl/Border.js +0 -110
  185. package/dist/src/core/shaders/webgl/Border.js.map +0 -1
  186. package/dist/src/core/shaders/webgl/Default.d.ts +0 -2
  187. package/dist/src/core/shaders/webgl/Default.js +0 -86
  188. package/dist/src/core/shaders/webgl/Default.js.map +0 -1
  189. package/dist/src/core/shaders/webgl/DefaultBatched.d.ts +0 -2
  190. package/dist/src/core/shaders/webgl/DefaultBatched.js +0 -104
  191. package/dist/src/core/shaders/webgl/DefaultBatched.js.map +0 -1
  192. package/dist/src/core/shaders/webgl/HolePunch.d.ts +0 -3
  193. package/dist/src/core/shaders/webgl/HolePunch.js +0 -65
  194. package/dist/src/core/shaders/webgl/HolePunch.js.map +0 -1
  195. package/dist/src/core/shaders/webgl/LinearGradient.d.ts +0 -3
  196. package/dist/src/core/shaders/webgl/LinearGradient.js +0 -76
  197. package/dist/src/core/shaders/webgl/LinearGradient.js.map +0 -1
  198. package/dist/src/core/shaders/webgl/RadialGradient.d.ts +0 -3
  199. package/dist/src/core/shaders/webgl/RadialGradient.js +0 -74
  200. package/dist/src/core/shaders/webgl/RadialGradient.js.map +0 -1
  201. package/dist/src/core/shaders/webgl/Rounded.d.ts +0 -7
  202. package/dist/src/core/shaders/webgl/Rounded.js +0 -86
  203. package/dist/src/core/shaders/webgl/Rounded.js.map +0 -1
  204. package/dist/src/core/shaders/webgl/RoundedWithBorder.d.ts +0 -3
  205. package/dist/src/core/shaders/webgl/RoundedWithBorder.js +0 -140
  206. package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +0 -1
  207. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.d.ts +0 -3
  208. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +0 -162
  209. package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +0 -1
  210. package/dist/src/core/shaders/webgl/RoundedWithShadow.d.ts +0 -3
  211. package/dist/src/core/shaders/webgl/RoundedWithShadow.js +0 -84
  212. package/dist/src/core/shaders/webgl/RoundedWithShadow.js.map +0 -1
  213. package/dist/src/core/shaders/webgl/SdfShader.d.ts +0 -32
  214. package/dist/src/core/shaders/webgl/SdfShader.js +0 -116
  215. package/dist/src/core/shaders/webgl/SdfShader.js.map +0 -1
  216. package/dist/src/core/shaders/webgl/Shadow.d.ts +0 -3
  217. package/dist/src/core/shaders/webgl/Shadow.js +0 -110
  218. package/dist/src/core/shaders/webgl/Shadow.js.map +0 -1
  219. package/dist/src/core/shaders/webgl/Spinner.d.ts +0 -1
  220. package/dist/src/core/shaders/webgl/Spinner.js +0 -2
  221. package/dist/src/core/shaders/webgl/Spinner.js.map +0 -1
  222. package/dist/src/core/text-rendering/CanvasFontHandler.d.ts +0 -25
  223. package/dist/src/core/text-rendering/CanvasFontHandler.js +0 -117
  224. package/dist/src/core/text-rendering/CanvasFontHandler.js.map +0 -1
  225. package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +0 -6
  226. package/dist/src/core/text-rendering/CanvasTextRenderer.js +0 -139
  227. package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +0 -1
  228. package/dist/src/core/text-rendering/SdfFontHandler.d.ts +0 -137
  229. package/dist/src/core/text-rendering/SdfFontHandler.js +0 -336
  230. package/dist/src/core/text-rendering/SdfFontHandler.js.map +0 -1
  231. package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +0 -21
  232. package/dist/src/core/text-rendering/SdfTextRenderer.js +0 -324
  233. package/dist/src/core/text-rendering/SdfTextRenderer.js.map +0 -1
  234. package/dist/src/core/text-rendering/TextRenderer.d.ts +0 -425
  235. package/dist/src/core/text-rendering/TextRenderer.js +0 -70
  236. package/dist/src/core/text-rendering/TextRenderer.js.map +0 -1
  237. package/dist/src/core/text-rendering/Utils.d.ts +0 -71
  238. package/dist/src/core/text-rendering/Utils.js +0 -212
  239. package/dist/src/core/text-rendering/Utils.js.map +0 -1
  240. package/dist/src/core/text-rendering/canvas/Settings.d.ts +0 -53
  241. package/dist/src/core/text-rendering/canvas/Settings.js +0 -20
  242. package/dist/src/core/text-rendering/canvas/Settings.js.map +0 -1
  243. package/dist/src/core/text-rendering/canvas/Utils.d.ts +0 -19
  244. package/dist/src/core/text-rendering/canvas/Utils.js +0 -139
  245. package/dist/src/core/text-rendering/canvas/Utils.js.map +0 -1
  246. package/dist/src/core/text-rendering/canvas/calculateRenderInfo.d.ts +0 -37
  247. package/dist/src/core/text-rendering/canvas/calculateRenderInfo.js +0 -188
  248. package/dist/src/core/text-rendering/canvas/calculateRenderInfo.js.map +0 -1
  249. package/dist/src/core/text-rendering/canvas/draw.d.ts +0 -12
  250. package/dist/src/core/text-rendering/canvas/draw.js +0 -133
  251. package/dist/src/core/text-rendering/canvas/draw.js.map +0 -1
  252. package/dist/src/core/text-rendering/sdf/PeekableGenerator.d.ts +0 -12
  253. package/dist/src/core/text-rendering/sdf/PeekableGenerator.js +0 -61
  254. package/dist/src/core/text-rendering/sdf/PeekableGenerator.js.map +0 -1
  255. package/dist/src/core/text-rendering/sdf/SimpleFontShaper.d.ts +0 -45
  256. package/dist/src/core/text-rendering/sdf/SimpleFontShaper.js +0 -69
  257. package/dist/src/core/text-rendering/sdf/SimpleFontShaper.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"SdfTextRenderer.js","sourceRoot":"","sources":["../../../../src/core/text-rendering/SdfTextRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,aAAa,EAAwD,MAAM,mBAAmB,CAAC;AACxG,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAEtD,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QACD,QAAQ,IAAI,gBAAgB,CAAC;IAC/B,CAAC;IAED,yDAAyD;IACzD,MAAM,UAAU,GACd,QAAQ,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACjE,OAAO;QACL,MAAM;QACN,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC;QACvC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,6BAA6B;QAC9F,SAAS,EAAE,UAAU;QACrB,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,IAAI;IACJ,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,WAAW;IACX,IAAI;CACL,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,425 +0,0 @@
1
- import type { CoreRenderer } from '../renderers/CoreRenderer.js';
2
- import type { Stage } from '../Stage.js';
3
- export declare enum TextBaseline {
4
- alphabetic = 0,
5
- hanging = 1,
6
- middle = 2,
7
- ideographic = 3,
8
- bottom = 4
9
- }
10
- export type TextBaselineType = keyof typeof TextBaseline;
11
- export declare const TextBaselineValueToKey: Record<TextBaseline, "alphabetic" | "hanging" | "middle" | "ideographic" | "bottom">;
12
- export declare enum TextAlign {
13
- left = 0,
14
- center = 1,
15
- right = 2
16
- }
17
- export type TextAlignType = keyof typeof TextAlign;
18
- export declare const TextAlignValueToKey: Record<TextAlign, "left" | "center" | "right">;
19
- export declare enum TextFontStyle {
20
- normal = 0,
21
- italic = 1,
22
- oblique = 2
23
- }
24
- export type TextFontStyleType = keyof typeof TextFontStyle;
25
- export declare const TextFontStyleValueToKey: Record<TextFontStyle, "normal" | "italic" | "oblique">;
26
- export declare enum TextVerticalAlign {
27
- top = 0,
28
- middle = 1,
29
- bottom = 2
30
- }
31
- export type TextVerticalAlignType = keyof typeof TextVerticalAlign;
32
- export declare const TextVerticalAlignValueToKey: Record<TextVerticalAlign, "middle" | "bottom" | "top">;
33
- export declare enum TextContain {
34
- none = 0,
35
- width = 1,
36
- both = 2
37
- }
38
- export type TextContainType = keyof typeof TextContain;
39
- export declare const TextContainValueToKey: Record<TextContain, "width" | "none" | "both">;
40
- export declare enum TextWordBreak {
41
- normal = 0,
42
- 'break-all' = 1,
43
- 'break-word' = 2
44
- }
45
- export type TextWordBreakType = keyof typeof TextWordBreak;
46
- export declare const TextWordBreakValueToKey: Record<TextWordBreak, "normal" | "break-all" | "break-word">;
47
- export declare enum TextRenderers {
48
- canvas = 0,
49
- sdf = 1
50
- }
51
- export type TextRendererType = keyof typeof TextRenderers;
52
- export declare const TextRendererValueToKey: Record<TextRenderers, "canvas" | "sdf">;
53
- /**
54
- * Structure mapping font family names to a set of font faces.
55
- */
56
- export interface FontFamilyMap {
57
- [familyName: string]: FontFace;
58
- }
59
- /**
60
- * Font metrics used for layout and default line height calculations.
61
- */
62
- export interface FontMetrics {
63
- /**
64
- * The distance, in font units, from the baseline to the highest point of the font.
65
- */
66
- ascender: number;
67
- /**
68
- * The distance, in font units, from the baseline to the lowest point of the font.
69
- */
70
- descender: number;
71
- /**
72
- * The additional space used in the calculation of the default line height in font units.
73
- */
74
- lineGap: number;
75
- /**
76
- * The number of font units per 1 EM.
77
- */
78
- unitsPerEm: number;
79
- }
80
- /**
81
- * Normalized font metrics where values are expressed as a fraction of 1 EM.
82
- */
83
- export interface NormalizedFontMetrics {
84
- /**
85
- * The distance, as a fraction of 1 EM, from the baseline to the highest point of the font.
86
- */
87
- ascender: number;
88
- /**
89
- * The distance, as a fraction of 1 EM, from the baseline to the lowest point of the font.
90
- */
91
- descender: number;
92
- /**
93
- * The additional space used in the calculation of the default line height as a fraction of 1 EM
94
- */
95
- lineGap: number;
96
- }
97
- /**
98
- * Text renderer properties that are used in resolving appropriate font faces
99
- *
100
- * @remarks
101
- * Extended by {@link TrProps}
102
- */
103
- export interface TrFontProps {
104
- /**
105
- * Font Family
106
- *
107
- * @internalRemarks
108
- * `fontFamily` is defined currently as single string, but in the future we may want to
109
- * support multiple font family fallbacks, as this is supported by CSS / Canvas2d. We can
110
- * do this in a backwards compatible way by unioning an array of strings to the
111
- * `fontFamily` property.
112
- */
113
- fontFamily: string;
114
- /**
115
- * Font Style
116
- *
117
- * @remarks
118
- * The font style to use when looking up the font face. This can be one of the
119
- * following strings:
120
- * - `'normal'`
121
- * - `'italic'`
122
- * - `'oblique'`
123
- */
124
- fontStyle: TextFontStyleType;
125
- /**
126
- * Font Size
127
- *
128
- * @remarks
129
- * The font size to use when looking up the font face.
130
- *
131
- * The font size is specified in pixels and is the height of the font's
132
- * em-square. The em-square is essentially the height of the capital letters
133
- * for the font. The actual height of the text can be larger than the
134
- * specified font size, as the font may have ascenders and descenders that
135
- * extend beyond the em-square.
136
- *
137
- * @default 16
138
- */
139
- fontSize: number;
140
- }
141
- export interface TrProps extends TrFontProps {
142
- /**
143
- * Text to display
144
- *
145
- * @default ''
146
- */
147
- text: string;
148
- /**
149
- * Text alignment
150
- *
151
- * @remarks
152
- * Alignment of the text relative to it's contained bounds. For best results,
153
- * use {@link contain} mode `'width'` or `'both'` and a set an explicit
154
- * {@link width} for the text to be aligned within.
155
- *
156
- * @default 'left'
157
- */
158
- textAlign: TextAlignType;
159
- /**
160
- * Color of text
161
- *
162
- * @remarks
163
- * The color value is a number in the format 0xRRGGBBAA, where RR is the red
164
- * component, GG is the green component, BB is the blue component, and AA is
165
- * the alpha component.
166
- *
167
- * @default 0xffffffff (opaque white)
168
- */
169
- color: number;
170
- x: number;
171
- y: number;
172
- /**
173
- * Contain mode for text
174
- *
175
- * @remarks
176
- * The contain mode determines how the text is contained within the bounds
177
- * of the Text Node. The default value is `'none'`, which means that the
178
- * Text Renderer will not constrain the text in any way. `'width'` mode will
179
- * constrain the text to the set width wrapping lines as necessary, and
180
- * `'both'` mode will constrain the text to both the set width and height
181
- * wrapping lines and truncating text as necessary.
182
- *
183
- * ## Text Auto-size Behavior
184
- * Depending on the set contain mode, after the text 'loaded' event is emitted,
185
- * the text node may have either its {@link width} and {@link height} updated
186
- * to match the rendered size of the text.
187
- *
188
- * When contain mode is 'none', both the {@link width} and {@link height}
189
- * properties are updated.
190
- *
191
- * When contain mode is 'width', only the {@link height} property is updated.
192
- *
193
- * When contain mode is 'both', neither property is updated.
194
- *
195
- * @default 'none'
196
- */
197
- contain: TextContainType;
198
- width: number;
199
- height: number;
200
- /**
201
- * Vertical offset for text
202
- *
203
- * @remarks
204
- * The vertical offset of the text.
205
- *
206
- * @default 0
207
- */
208
- offsetY: number;
209
- /**
210
- * Letter spacing for text (in pixels)
211
- *
212
- * @remarks
213
- * This property sets additional (or reduced, if value is negative) spacing
214
- * between characters in the text.
215
- *
216
- * @default 0
217
- */
218
- letterSpacing: number;
219
- /**
220
- * Line height for text (in pixels)
221
- *
222
- * @remarks
223
- * This property sets the height of each line. If set to `undefined`, the
224
- * line height will be calculated based on the font and font size to be the
225
- * minimal height required to completely contain a line of text.
226
- *
227
- * See: https://github.com/lightning-js/renderer/issues/170
228
- *
229
- * @default `undefined`
230
- */
231
- lineHeight: number | undefined;
232
- /**
233
- * Max lines for text
234
- *
235
- * @remarks
236
- * This property sets max number of lines of a text paragraph.
237
- * Not yet implemented in the SDF renderer.
238
- *
239
- * @default 0
240
- */
241
- maxLines: number;
242
- /**
243
- * Baseline for text
244
- *
245
- * @remarks
246
- * This property sets the text baseline used when drawing text.
247
- * Not yet implemented in the SDF renderer.
248
- *
249
- * @default alphabetic
250
- */
251
- textBaseline: TextBaselineType;
252
- /**
253
- * Vertical Align for text when lineHeight > fontSize
254
- *
255
- * @remarks
256
- * This property sets the vertical align of the text.
257
- * Not yet implemented in the SDF renderer.
258
- *
259
- * @default middle
260
- */
261
- verticalAlign: TextVerticalAlignType;
262
- /**
263
- * Overflow Suffix for text
264
- *
265
- * @remarks
266
- * The suffix to be added when text is cropped due to overflow.
267
- * Not yet implemented in the SDF renderer.
268
- *
269
- * @default "..."
270
- */
271
- overflowSuffix: string;
272
- /**
273
- * Word Break for text
274
- *
275
- * @remarks
276
- * This property sets how words should break when reaching the end of a line.
277
- *
278
- * - `'normal'`: Use the default line break rule.
279
- * - `'break-all'`: To prevent overflow, word breaks should happen between any two characters.
280
- * - `'break-word'`: To prevent overflow, word breaks should happen between words. If words are too long word breaks happen between any two characters.
281
- *
282
- * @default "normal"
283
- */
284
- wordBreak: TextWordBreakType;
285
- zIndex: number;
286
- }
287
- /**
288
- * Glyph layout information for WebGL rendering
289
- */
290
- export interface GlyphLayout {
291
- /**
292
- * Unicode codepoint
293
- */
294
- codepoint: number;
295
- /**
296
- * Glyph ID in the font atlas
297
- */
298
- glyphId: number;
299
- /**
300
- * X position relative to text origin
301
- */
302
- x: number;
303
- /**
304
- * Y position relative to text origin
305
- */
306
- y: number;
307
- /**
308
- * Width of glyph in font units
309
- */
310
- width: number;
311
- /**
312
- * Height of glyph in font units
313
- */
314
- height: number;
315
- /**
316
- * X offset for glyph positioning
317
- */
318
- xOffset: number;
319
- /**
320
- * Y offset for glyph positioning
321
- */
322
- yOffset: number;
323
- /**
324
- * Atlas texture coordinates (normalized 0-1)
325
- */
326
- atlasX: number;
327
- atlasY: number;
328
- atlasWidth: number;
329
- atlasHeight: number;
330
- }
331
- /**
332
- * Complete text layout information for caching
333
- */
334
- export interface TextLayout {
335
- /**
336
- * Individual glyph layouts
337
- */
338
- glyphs: GlyphLayout[];
339
- /**
340
- * Total text width
341
- */
342
- width: number;
343
- /**
344
- * Total text height
345
- */
346
- height: number;
347
- /**
348
- * Font scale factor
349
- */
350
- fontScale: number;
351
- /**
352
- * Line height
353
- */
354
- lineHeight: number;
355
- /**
356
- * Font family used
357
- */
358
- fontFamily: string;
359
- }
360
- export interface FontLoadOptions {
361
- fontFamily: string;
362
- metrics?: FontMetrics;
363
- fontUrl?: string;
364
- atlasUrl?: string;
365
- atlasDataUrl?: string;
366
- }
367
- export interface FontHandler {
368
- init: () => void;
369
- type: TextRenderers;
370
- isFontLoaded: (fontFamily: string) => boolean;
371
- loadFont: (stage: Stage, options: FontLoadOptions) => Promise<void>;
372
- getFontFamilies: () => FontFamilyMap;
373
- canRenderFont: (trProps: TrProps) => boolean;
374
- getFontMetrics: (fontFamily: string, trProps: TrProps) => NormalizedFontMetrics | null;
375
- setFontMetrics: (fontFamily: string, metrics: NormalizedFontMetrics) => void;
376
- }
377
- export interface TextRenderProps {
378
- fontFamily: string;
379
- fontSize: number;
380
- color: number;
381
- offsetY: number;
382
- worldAlpha: number;
383
- globalTransform: Float32Array;
384
- clippingRect: unknown;
385
- width: number;
386
- height: number;
387
- parentHasRenderTexture: boolean;
388
- framebufferDimensions: unknown;
389
- stage: Stage;
390
- }
391
- export interface TextRenderPropsNormalized {
392
- x: number;
393
- y: number;
394
- zIndex: number;
395
- text: string;
396
- fontFamily: string;
397
- fontSize: number;
398
- fontStyle: TextFontStyle;
399
- textAlign: TextAlign;
400
- contain: TextContain;
401
- letterSpacing: number;
402
- lineHeight: number | undefined;
403
- maxLines: number;
404
- textBaseline: TextBaseline;
405
- verticalAlign: TextVerticalAlign;
406
- color: number;
407
- offsetY: number;
408
- width: number;
409
- height: number;
410
- overflowSuffix: string;
411
- wordBreak: TextWordBreak;
412
- }
413
- export interface TextRenderer {
414
- type: TextRenderers;
415
- font: FontHandler;
416
- renderText: (stage: Stage, props: TextRenderPropsNormalized) => {
417
- imageData: ImageData | null;
418
- width: number;
419
- height: number;
420
- layout?: TextLayout;
421
- };
422
- addQuads: (layout?: TextLayout) => Float32Array | null;
423
- renderQuads: (renderer: CoreRenderer, layout: TextLayout, vertexBuffer: Float32Array, renderProps: TextRenderProps) => void;
424
- init: (stage: Stage) => void;
425
- }
@@ -1,70 +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 { createEnumReverseMap } from '../../utils.js';
20
- export var TextBaseline;
21
- (function (TextBaseline) {
22
- TextBaseline[TextBaseline["alphabetic"] = 0] = "alphabetic";
23
- TextBaseline[TextBaseline["hanging"] = 1] = "hanging";
24
- TextBaseline[TextBaseline["middle"] = 2] = "middle";
25
- TextBaseline[TextBaseline["ideographic"] = 3] = "ideographic";
26
- TextBaseline[TextBaseline["bottom"] = 4] = "bottom";
27
- })(TextBaseline || (TextBaseline = {}));
28
- export const TextBaselineValueToKey = createEnumReverseMap(TextBaseline);
29
- export var TextAlign;
30
- (function (TextAlign) {
31
- TextAlign[TextAlign["left"] = 0] = "left";
32
- TextAlign[TextAlign["center"] = 1] = "center";
33
- TextAlign[TextAlign["right"] = 2] = "right";
34
- })(TextAlign || (TextAlign = {}));
35
- export const TextAlignValueToKey = createEnumReverseMap(TextAlign);
36
- export var TextFontStyle;
37
- (function (TextFontStyle) {
38
- TextFontStyle[TextFontStyle["normal"] = 0] = "normal";
39
- TextFontStyle[TextFontStyle["italic"] = 1] = "italic";
40
- TextFontStyle[TextFontStyle["oblique"] = 2] = "oblique";
41
- })(TextFontStyle || (TextFontStyle = {}));
42
- export const TextFontStyleValueToKey = createEnumReverseMap(TextFontStyle);
43
- export var TextVerticalAlign;
44
- (function (TextVerticalAlign) {
45
- TextVerticalAlign[TextVerticalAlign["top"] = 0] = "top";
46
- TextVerticalAlign[TextVerticalAlign["middle"] = 1] = "middle";
47
- TextVerticalAlign[TextVerticalAlign["bottom"] = 2] = "bottom";
48
- })(TextVerticalAlign || (TextVerticalAlign = {}));
49
- export const TextVerticalAlignValueToKey = createEnumReverseMap(TextVerticalAlign);
50
- export var TextContain;
51
- (function (TextContain) {
52
- TextContain[TextContain["none"] = 0] = "none";
53
- TextContain[TextContain["width"] = 1] = "width";
54
- TextContain[TextContain["both"] = 2] = "both";
55
- })(TextContain || (TextContain = {}));
56
- export const TextContainValueToKey = createEnumReverseMap(TextContain);
57
- export var TextWordBreak;
58
- (function (TextWordBreak) {
59
- TextWordBreak[TextWordBreak["normal"] = 0] = "normal";
60
- TextWordBreak[TextWordBreak["break-all"] = 1] = "break-all";
61
- TextWordBreak[TextWordBreak["break-word"] = 2] = "break-word";
62
- })(TextWordBreak || (TextWordBreak = {}));
63
- export const TextWordBreakValueToKey = createEnumReverseMap(TextWordBreak);
64
- export var TextRenderers;
65
- (function (TextRenderers) {
66
- TextRenderers[TextRenderers["canvas"] = 0] = "canvas";
67
- TextRenderers[TextRenderers["sdf"] = 1] = "sdf";
68
- })(TextRenderers || (TextRenderers = {}));
69
- export const TextRendererValueToKey = createEnumReverseMap(TextRenderers);
70
- //# sourceMappingURL=TextRenderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextRenderer.js","sourceRoot":"","sources":["../../../../src/core/text-rendering/TextRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAItD,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,2DAAU,CAAA;IACV,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,6DAAW,CAAA;IACX,mDAAM,CAAA;AACR,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;AAID,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;AAEzE,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,yCAAI,CAAA;IACJ,6CAAM,CAAA;IACN,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- import type { NormalizedFontMetrics } from './TextRenderer.js';
2
- /**
3
- * Returns CSS font setting string for use in canvas context.
4
- *
5
- * @param fontFace
6
- * @param fontStyle
7
- * @param fontSize
8
- * @param precision
9
- * @param defaultFontFace
10
- * @returns
11
- */
12
- export declare function getFontSetting(fontFace: string | string[], fontStyle: string, fontSize: number, precision: number, defaultFontFace: string): string;
13
- /**
14
- * Returns true if the given character is a zero-width space.
15
- *
16
- * @param space
17
- */
18
- export declare function isZeroWidthSpace(space: string): boolean;
19
- /**
20
- * Returns true if the given character is a zero-width space or a regular space.
21
- *
22
- * @param space
23
- */
24
- export declare function isSpace(space: string): boolean;
25
- /**
26
- * Converts a string into an array of tokens and the words between them.
27
- *
28
- * @param tokenRegex
29
- * @param text
30
- */
31
- export declare function tokenizeString(tokenRegex: RegExp, text: string): string[];
32
- /**
33
- * Measure the width of a string accounting for letter spacing.
34
- *
35
- * @param context
36
- * @param word
37
- * @param space
38
- */
39
- export declare function measureText(context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, word: string, space?: number): number;
40
- /**
41
- * Get the font metrics for a font face.
42
- *
43
- * @remarks
44
- * This function will attempt to grab the explicitly defined metrics from the
45
- * font face first. If the font face does not have metrics defined, it will
46
- * attempt to calculate the metrics using the browser's measureText method.
47
- *
48
- * If the browser does not support the font metrics API, it will use some
49
- * default values.
50
- *
51
- * @param context
52
- * @param fontFace
53
- * @param fontSize
54
- * @returns
55
- */
56
- export declare function calculateFontMetrics(context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, fontFamily: string, fontSize: number): NormalizedFontMetrics;
57
- export interface WrapTextResult {
58
- l: string[];
59
- n: number[];
60
- }
61
- /**
62
- * Applies newlines to a string to have it optimally fit into the horizontal
63
- * bounds set by the Text object's wordWrapWidth property.
64
- *
65
- * @param context
66
- * @param text
67
- * @param wordWrapWidth
68
- * @param letterSpacing
69
- * @param indent
70
- */
71
- export declare function wrapText(context: CanvasRenderingContext2D, text: string, wordWrapWidth: number, letterSpacing: number, indent: number): WrapTextResult;