@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.
- package/dist/src/core/CoreNode.d.ts +1 -1
- package/dist/src/core/lib/WebGlContextWrapper.d.ts +5 -5
- package/dist/src/core/platform.js +5 -2
- package/dist/src/core/platform.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.d.ts +1 -0
- package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js +2 -0
- package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js.map +1 -0
- package/dist/src/core/shaders/webgl/Border.js +7 -13
- package/dist/src/core/shaders/webgl/Border.js.map +1 -1
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js +6 -17
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -1
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +4 -8
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -1
- package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +5 -8
- package/dist/src/core/text-rendering/CanvasTextRenderer.js +13 -30
- package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/SdfFontHandler.d.ts +125 -28
- package/dist/src/core/text-rendering/SdfFontHandler.js +337 -4
- package/dist/src/core/text-rendering/SdfFontHandler.js.map +1 -1
- package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +5 -6
- package/dist/src/core/text-rendering/SdfTextRenderer.js +15 -19
- package/dist/src/core/text-rendering/SdfTextRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/TextLayoutEngine.d.ts +11 -12
- package/dist/src/core/text-rendering/TextLayoutEngine.js +29 -29
- package/dist/src/core/text-rendering/TextLayoutEngine.js.map +1 -1
- package/dist/src/core/text-rendering/TextRenderer.d.ts +16 -6
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/platform.ts +6 -2
- package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +0 -45
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js +0 -127
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +0 -1
- package/dist/src/core/text-rendering/CanvasFont.d.ts +0 -14
- package/dist/src/core/text-rendering/CanvasFont.js +0 -119
- package/dist/src/core/text-rendering/CanvasFont.js.map +0 -1
- package/dist/src/core/text-rendering/CoreFont.d.ts +0 -33
- package/dist/src/core/text-rendering/CoreFont.js +0 -48
- package/dist/src/core/text-rendering/CoreFont.js.map +0 -1
- package/dist/src/core/text-rendering/FontManager.d.ts +0 -11
- package/dist/src/core/text-rendering/FontManager.js +0 -41
- package/dist/src/core/text-rendering/FontManager.js.map +0 -1
- package/dist/src/core/text-rendering/SdfFont.d.ts +0 -29
- package/dist/src/core/text-rendering/SdfFont.js +0 -142
- package/dist/src/core/text-rendering/SdfFont.js.map +0 -1
|
@@ -16,12 +16,21 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
+
import { UpdateType } from '../CoreNode.js';
|
|
20
|
+
import { hasZeroWidthSpace } from './Utils.js';
|
|
21
|
+
import { normalizeFontMetrics } from './TextLayoutEngine.js';
|
|
22
|
+
//global state variables for SdfFontHandler
|
|
23
|
+
const fontCache = new Map();
|
|
24
|
+
const fontLoadPromises = new Map();
|
|
25
|
+
const normalizedMetrics = new Map();
|
|
26
|
+
const nodesWaitingForFont = Object.create(null);
|
|
27
|
+
let initialized = false;
|
|
19
28
|
/**
|
|
20
29
|
* Build kerning lookup table for fast access
|
|
21
30
|
* @param {Array} kernings - Kerning data from font
|
|
22
31
|
* @returns {KerningTable} Optimized kerning lookup table
|
|
23
32
|
*/
|
|
24
|
-
|
|
33
|
+
const buildKerningTable = (kernings) => {
|
|
25
34
|
const kerningTable = {};
|
|
26
35
|
let i = 0;
|
|
27
36
|
const length = kernings.length;
|
|
@@ -41,8 +50,14 @@ export const buildKerningTable = (kernings) => {
|
|
|
41
50
|
}
|
|
42
51
|
return kerningTable;
|
|
43
52
|
};
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Build glyph map from font data for fast character lookup
|
|
55
|
+
* @param {Array} chars - Character data from font
|
|
56
|
+
* @returns {Map} Glyph map for character to glyph lookup
|
|
57
|
+
*/
|
|
58
|
+
const buildGlyphMap = (chars) => {
|
|
59
|
+
const glyphMap = new Map();
|
|
60
|
+
let maxCharHeight = 0;
|
|
46
61
|
let i = 0;
|
|
47
62
|
const length = chars.length;
|
|
48
63
|
while (i < length) {
|
|
@@ -51,8 +66,326 @@ export const buildGlyphMap = (chars) => {
|
|
|
51
66
|
if (glyph === undefined) {
|
|
52
67
|
continue;
|
|
53
68
|
}
|
|
54
|
-
glyphMap
|
|
69
|
+
glyphMap.set(glyph.id, glyph);
|
|
70
|
+
const charHeight = glyph.yoffset + glyph.height;
|
|
71
|
+
if (charHeight > maxCharHeight) {
|
|
72
|
+
maxCharHeight = charHeight;
|
|
73
|
+
}
|
|
55
74
|
}
|
|
56
75
|
return glyphMap;
|
|
57
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Process font data and create optimized cache entry
|
|
79
|
+
* @param {string} fontFamily - Font family name
|
|
80
|
+
* @param {SdfFontData} fontData - Raw font data
|
|
81
|
+
* @param {ImageTexture} atlasTexture - Atlas texture
|
|
82
|
+
* @param {FontMetrics} metrics - Font metrics
|
|
83
|
+
*/
|
|
84
|
+
const processFontData = (fontFamily, fontData, atlasTexture, metrics) => {
|
|
85
|
+
// Build optimized data structures
|
|
86
|
+
const glyphMap = buildGlyphMap(fontData.chars);
|
|
87
|
+
const kernings = buildKerningTable(fontData.kernings);
|
|
88
|
+
// Calculate max char height
|
|
89
|
+
let maxCharHeight = 0;
|
|
90
|
+
let i = 0;
|
|
91
|
+
const length = fontData.chars.length;
|
|
92
|
+
while (i < length) {
|
|
93
|
+
const glyph = fontData.chars[i];
|
|
94
|
+
if (glyph !== undefined) {
|
|
95
|
+
const charHeight = glyph.yoffset + glyph.height;
|
|
96
|
+
if (charHeight > maxCharHeight) {
|
|
97
|
+
maxCharHeight = charHeight;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
i++;
|
|
101
|
+
}
|
|
102
|
+
if (metrics === undefined && fontData.lightningMetrics === undefined) {
|
|
103
|
+
console.warn(`Font metrics not found for SDF font ${fontFamily}. ` +
|
|
104
|
+
'Make sure you are using the latest version of the Lightning ' +
|
|
105
|
+
'3 msdf-generator tool to generate your SDF fonts. Using default metrics.');
|
|
106
|
+
}
|
|
107
|
+
metrics = metrics ||
|
|
108
|
+
fontData.lightningMetrics || {
|
|
109
|
+
ascender: 800,
|
|
110
|
+
descender: -200,
|
|
111
|
+
lineGap: 200,
|
|
112
|
+
unitsPerEm: 1000,
|
|
113
|
+
};
|
|
114
|
+
// Cache processed data
|
|
115
|
+
fontCache.set(fontFamily, {
|
|
116
|
+
data: fontData,
|
|
117
|
+
glyphMap,
|
|
118
|
+
kernings,
|
|
119
|
+
atlasTexture,
|
|
120
|
+
metrics,
|
|
121
|
+
maxCharHeight,
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Check if the SDF font handler can render a font
|
|
126
|
+
* @param {TrProps} trProps - Text rendering properties
|
|
127
|
+
* @returns {boolean} True if the font can be rendered
|
|
128
|
+
*/
|
|
129
|
+
export const canRenderFont = (trProps) => {
|
|
130
|
+
return (isFontLoaded(trProps.fontFamily) || fontLoadPromises.has(trProps.fontFamily));
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Load SDF font from JSON + PNG atlas
|
|
134
|
+
* @param {Object} options - Font loading options
|
|
135
|
+
* @param {string} options.fontFamily - Font family name
|
|
136
|
+
* @param {string} options.fontUrl - JSON font data URL (atlasDataUrl)
|
|
137
|
+
* @param {string} options.atlasUrl - PNG atlas texture URL
|
|
138
|
+
* @param {FontMetrics} options.metrics - Optional font metrics
|
|
139
|
+
*/
|
|
140
|
+
export const loadFont = async (stage, options) => {
|
|
141
|
+
const { fontFamily, atlasUrl, atlasDataUrl, metrics } = options;
|
|
142
|
+
// Early return if already loaded
|
|
143
|
+
if (fontCache.get(fontFamily) !== undefined) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// Early return if already loading
|
|
147
|
+
const existingPromise = fontLoadPromises.get(fontFamily);
|
|
148
|
+
if (existingPromise !== undefined) {
|
|
149
|
+
return existingPromise;
|
|
150
|
+
}
|
|
151
|
+
if (atlasDataUrl === undefined) {
|
|
152
|
+
throw new Error(`Atlas data URL must be provided for SDF font: ${fontFamily}`);
|
|
153
|
+
}
|
|
154
|
+
const nwff = (nodesWaitingForFont[fontFamily] = []);
|
|
155
|
+
// Create loading promise
|
|
156
|
+
const loadPromise = (async () => {
|
|
157
|
+
// Load font JSON data
|
|
158
|
+
const response = await fetch(atlasDataUrl);
|
|
159
|
+
if (!response.ok) {
|
|
160
|
+
throw new Error(`Failed to load font data: ${response.statusText}`);
|
|
161
|
+
}
|
|
162
|
+
const fontData = (await response.json());
|
|
163
|
+
if (!fontData || !fontData.chars) {
|
|
164
|
+
throw new Error('Invalid SDF font data format');
|
|
165
|
+
}
|
|
166
|
+
// Atlas texture should be provided externally
|
|
167
|
+
if (!atlasUrl) {
|
|
168
|
+
throw new Error('Atlas texture must be provided for SDF fonts');
|
|
169
|
+
}
|
|
170
|
+
// Wait for atlas texture to load
|
|
171
|
+
return new Promise((resolve, reject) => {
|
|
172
|
+
// create new atlas texture using ImageTexture
|
|
173
|
+
const atlasTexture = stage.txManager.createTexture('ImageTexture', {
|
|
174
|
+
src: atlasUrl,
|
|
175
|
+
premultiplyAlpha: false,
|
|
176
|
+
});
|
|
177
|
+
atlasTexture.setRenderableOwner(fontFamily, true);
|
|
178
|
+
atlasTexture.preventCleanup = true; // Prevent automatic cleanup
|
|
179
|
+
if (atlasTexture.state === 'loaded') {
|
|
180
|
+
// If already loaded, process immediately
|
|
181
|
+
processFontData(fontFamily, fontData, atlasTexture, metrics);
|
|
182
|
+
fontLoadPromises.delete(fontFamily);
|
|
183
|
+
for (let key in nwff) {
|
|
184
|
+
nwff[key].setUpdateType(UpdateType.Local);
|
|
185
|
+
}
|
|
186
|
+
delete nodesWaitingForFont[fontFamily];
|
|
187
|
+
return resolve();
|
|
188
|
+
}
|
|
189
|
+
atlasTexture.on('loaded', () => {
|
|
190
|
+
// Process and cache font data
|
|
191
|
+
processFontData(fontFamily, fontData, atlasTexture, metrics);
|
|
192
|
+
// remove from promises
|
|
193
|
+
fontLoadPromises.delete(fontFamily);
|
|
194
|
+
for (let key in nwff) {
|
|
195
|
+
nwff[key].setUpdateType(UpdateType.Local);
|
|
196
|
+
}
|
|
197
|
+
delete nodesWaitingForFont[fontFamily];
|
|
198
|
+
resolve();
|
|
199
|
+
});
|
|
200
|
+
atlasTexture.on('failed', (error) => {
|
|
201
|
+
// Cleanup on error
|
|
202
|
+
fontLoadPromises.delete(fontFamily);
|
|
203
|
+
if (fontCache[fontFamily]) {
|
|
204
|
+
delete fontCache[fontFamily];
|
|
205
|
+
}
|
|
206
|
+
console.error(`Failed to load SDF font: ${fontFamily}`, error);
|
|
207
|
+
reject(error);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
})();
|
|
211
|
+
fontLoadPromises.set(fontFamily, loadPromise);
|
|
212
|
+
return loadPromise;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Stop waiting for a font to load
|
|
216
|
+
* @param {string} fontFamily - Font family name
|
|
217
|
+
* @param {CoreTextNode} node - Node that was waiting for the font
|
|
218
|
+
*/
|
|
219
|
+
export const waitingForFont = (fontFamily, node) => {
|
|
220
|
+
if (nodesWaitingForFont[fontFamily] === undefined) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
nodesWaitingForFont[fontFamily][node.id] = node;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Stop waiting for a font to load
|
|
227
|
+
*
|
|
228
|
+
* @param fontFamily
|
|
229
|
+
* @param node
|
|
230
|
+
* @returns
|
|
231
|
+
*/
|
|
232
|
+
export const stopWaitingForFont = (fontFamily, node) => {
|
|
233
|
+
if (nodesWaitingForFont[fontFamily] === undefined) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
delete nodesWaitingForFont[fontFamily][node.id];
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Get the font families map for resolving fonts
|
|
240
|
+
*/
|
|
241
|
+
export const getFontFamilies = () => {
|
|
242
|
+
const families = {};
|
|
243
|
+
// SDF fonts don't use the traditional FontFamilyMap structure
|
|
244
|
+
// Return empty map since SDF fonts are handled differently
|
|
245
|
+
return families;
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Initialize the SDF font handler
|
|
249
|
+
*/
|
|
250
|
+
export const init = (c) => {
|
|
251
|
+
if (initialized === true) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
initialized = true;
|
|
255
|
+
};
|
|
256
|
+
export const type = 'sdf';
|
|
257
|
+
/**
|
|
258
|
+
* Check if a font is already loaded by font family
|
|
259
|
+
*/
|
|
260
|
+
export const isFontLoaded = (fontFamily) => {
|
|
261
|
+
return fontCache.has(fontFamily);
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Get normalized font metrics for a font family
|
|
265
|
+
*/
|
|
266
|
+
export const getFontMetrics = (fontFamily, fontSize) => {
|
|
267
|
+
const out = normalizedMetrics.get(fontFamily);
|
|
268
|
+
if (out !== undefined) {
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
271
|
+
let metrics = fontCache.get(fontFamily).metrics;
|
|
272
|
+
return processFontMetrics(fontFamily, fontSize, metrics);
|
|
273
|
+
};
|
|
274
|
+
export const processFontMetrics = (fontFamily, fontSize, metrics) => {
|
|
275
|
+
const label = fontFamily + fontSize;
|
|
276
|
+
const normalized = normalizeFontMetrics(metrics, fontSize);
|
|
277
|
+
normalizedMetrics.set(label, normalized);
|
|
278
|
+
return normalized;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Get glyph data for a character in a specific font
|
|
282
|
+
* @param {string} fontFamily - Font family name
|
|
283
|
+
* @param {number} codepoint - Character codepoint
|
|
284
|
+
* @returns {Object|null} Glyph data or null if not found
|
|
285
|
+
*/
|
|
286
|
+
export const getGlyph = (fontFamily, codepoint) => {
|
|
287
|
+
const cache = fontCache.get(fontFamily);
|
|
288
|
+
if (cache === undefined)
|
|
289
|
+
return null;
|
|
290
|
+
return cache.glyphMap.get(codepoint) || cache.glyphMap.get(63) || null; // 63 = '?'
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Get kerning value between two glyphs
|
|
294
|
+
* @param {string} fontFamily - Font family name
|
|
295
|
+
* @param {number} firstGlyph - First glyph ID
|
|
296
|
+
* @param {number} secondGlyph - Second glyph ID
|
|
297
|
+
* @returns {number} Kerning value or 0
|
|
298
|
+
*/
|
|
299
|
+
export const getKerning = (fontFamily, firstGlyph, secondGlyph) => {
|
|
300
|
+
const cache = fontCache.get(fontFamily);
|
|
301
|
+
if (cache === undefined)
|
|
302
|
+
return 0;
|
|
303
|
+
const seconds = cache.kernings[secondGlyph];
|
|
304
|
+
return seconds ? seconds[firstGlyph] || 0 : 0;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Get atlas texture for a font family
|
|
308
|
+
* @param {string} fontFamily - Font family name
|
|
309
|
+
* @returns {ImageTexture|null} Atlas texture or null
|
|
310
|
+
*/
|
|
311
|
+
export const getAtlas = (fontFamily) => {
|
|
312
|
+
const cache = fontCache.get(fontFamily);
|
|
313
|
+
return cache !== undefined ? cache.atlasTexture : null;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Get font data for a font family
|
|
317
|
+
* @param {string} fontFamily - Font family name
|
|
318
|
+
* @returns {SdfFontData|null} Font data or null
|
|
319
|
+
*/
|
|
320
|
+
export const getFontData = (fontFamily) => {
|
|
321
|
+
return fontCache.get(fontFamily);
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Get maximum character height for a font family
|
|
325
|
+
* @param {string} fontFamily - Font family name
|
|
326
|
+
* @returns {number} Max character height or 0
|
|
327
|
+
*/
|
|
328
|
+
export const getMaxCharHeight = (fontFamily) => {
|
|
329
|
+
const cache = fontCache.get(fontFamily);
|
|
330
|
+
return cache !== undefined ? cache.maxCharHeight : 0;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Get all loaded font families
|
|
334
|
+
* @returns {string[]} Array of font family names
|
|
335
|
+
*/
|
|
336
|
+
export const getLoadedFonts = () => {
|
|
337
|
+
return Array.from(fontCache.keys());
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Unload a font and free resources
|
|
341
|
+
* @param {string} fontFamily - Font family name
|
|
342
|
+
*/
|
|
343
|
+
export const unloadFont = (fontFamily) => {
|
|
344
|
+
const cache = fontCache.get(fontFamily);
|
|
345
|
+
if (cache !== undefined) {
|
|
346
|
+
// Free texture if needed
|
|
347
|
+
if (typeof cache.atlasTexture.free === 'function') {
|
|
348
|
+
cache.atlasTexture.free();
|
|
349
|
+
}
|
|
350
|
+
fontCache.delete(fontFamily);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
export const measureText = (text, fontFamily, letterSpacing) => {
|
|
354
|
+
if (text.length === 1) {
|
|
355
|
+
const char = text.charAt(0);
|
|
356
|
+
const codepoint = text.codePointAt(0);
|
|
357
|
+
if (codepoint === undefined)
|
|
358
|
+
return 0;
|
|
359
|
+
if (hasZeroWidthSpace(char) === true)
|
|
360
|
+
return 0;
|
|
361
|
+
const glyph = getGlyph(fontFamily, codepoint);
|
|
362
|
+
if (glyph === null)
|
|
363
|
+
return 0;
|
|
364
|
+
return glyph.xadvance + letterSpacing;
|
|
365
|
+
}
|
|
366
|
+
let width = 0;
|
|
367
|
+
let prevCodepoint = 0;
|
|
368
|
+
for (let i = 0; i < text.length; i++) {
|
|
369
|
+
const char = text.charAt(i);
|
|
370
|
+
const codepoint = text.codePointAt(i);
|
|
371
|
+
if (codepoint === undefined)
|
|
372
|
+
continue;
|
|
373
|
+
// Skip zero-width spaces in width calculations
|
|
374
|
+
if (hasZeroWidthSpace(char)) {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
const glyph = getGlyph(fontFamily, codepoint);
|
|
378
|
+
if (glyph === null)
|
|
379
|
+
continue;
|
|
380
|
+
let advance = glyph.xadvance;
|
|
381
|
+
// Add kerning if there's a previous character
|
|
382
|
+
if (prevCodepoint !== 0) {
|
|
383
|
+
const kerning = getKerning(fontFamily, prevCodepoint, codepoint);
|
|
384
|
+
advance += kerning;
|
|
385
|
+
}
|
|
386
|
+
width += advance + letterSpacing;
|
|
387
|
+
prevCodepoint = codepoint;
|
|
388
|
+
}
|
|
389
|
+
return width;
|
|
390
|
+
};
|
|
58
391
|
//# sourceMappingURL=SdfFontHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SdfFontHandler.js","sourceRoot":"","sources":["../../../../src/core/text-rendering/SdfFontHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAyFH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAsB,EAAgB,EAAE;IACxE,MAAM,YAAY,GAAiB,EAAE,CAAC;IAEtC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAE/B,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC;QAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,EAAE,CAAC;QACJ,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAA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9C,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAE7B,IAAI,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC;QAE7B,8CAA8C;QAC9C,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;YACjE,OAAO,IAAI,OAAO,CAAC;QACrB,CAAC;QAED,KAAK,IAAI,OAAO,GAAG,aAAa,CAAC;QACjC,aAAa,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import type { Stage } from '../Stage.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FontHandler, TextRenderInfo, TextRenderProps } from './TextRenderer.js';
|
|
3
3
|
import type { CoreTextNodeProps } from '../CoreTextNode.js';
|
|
4
4
|
import type { CoreRenderer } from '../renderers/CoreRenderer.js';
|
|
5
5
|
import type { TextLayout } from './TextRenderer.js';
|
|
6
|
-
import { SdfFont } from './SdfFont.js';
|
|
7
6
|
/**
|
|
8
7
|
* SDF Text Renderer - implements TextRenderer interface
|
|
9
8
|
*/
|
|
10
9
|
declare const SdfTextRenderer: {
|
|
11
10
|
type: "sdf";
|
|
12
|
-
|
|
13
|
-
renderText: (
|
|
11
|
+
font: FontHandler;
|
|
12
|
+
renderText: (props: CoreTextNodeProps) => TextRenderInfo;
|
|
14
13
|
addQuads: (layout?: TextLayout) => Float32Array | null;
|
|
15
|
-
renderQuads: (renderer: CoreRenderer,
|
|
16
|
-
init: (
|
|
14
|
+
renderQuads: (renderer: CoreRenderer, layout: TextLayout, vertexBuffer: Float32Array, renderProps: TextRenderProps) => void;
|
|
15
|
+
init: (stage: Stage) => void;
|
|
17
16
|
};
|
|
18
17
|
export default SdfTextRenderer;
|
|
@@ -24,21 +24,20 @@ import { Sdf } from '../shaders/webgl/SdfShader.js';
|
|
|
24
24
|
import { BufferCollection } from '../renderers/webgl/internal/BufferCollection.js';
|
|
25
25
|
import { mergeColorAlpha } from '../../utils.js';
|
|
26
26
|
import { mapTextLayout } from './TextLayoutEngine.js';
|
|
27
|
-
import { SdfFont } from './SdfFont.js';
|
|
28
27
|
// Each glyph requires 6 vertices (2 triangles) with 4 floats each (x, y, u, v)
|
|
29
28
|
const FLOATS_PER_VERTEX = 4;
|
|
30
29
|
const VERTICES_PER_GLYPH = 6;
|
|
31
30
|
// Type definition to match interface
|
|
32
31
|
const type = 'sdf';
|
|
33
32
|
let sdfShader = null;
|
|
34
|
-
let stage = null;
|
|
35
33
|
// Initialize the SDF text renderer
|
|
36
|
-
const init = (
|
|
37
|
-
|
|
34
|
+
const init = (stage) => {
|
|
35
|
+
SdfFontHandler.init();
|
|
38
36
|
// Register SDF shader with the shader manager
|
|
39
37
|
stage.shManager.registerShaderType('Sdf', Sdf);
|
|
40
38
|
sdfShader = stage.shManager.createShader('Sdf');
|
|
41
39
|
};
|
|
40
|
+
const font = SdfFontHandler;
|
|
42
41
|
/**
|
|
43
42
|
* SDF text renderer using MSDF/SDF fonts with WebGL
|
|
44
43
|
*
|
|
@@ -46,7 +45,7 @@ const init = (s) => {
|
|
|
46
45
|
* @param props - Text rendering properties
|
|
47
46
|
* @returns Object containing ImageData and dimensions
|
|
48
47
|
*/
|
|
49
|
-
const renderText = (
|
|
48
|
+
const renderText = (props) => {
|
|
50
49
|
// Early return if no text
|
|
51
50
|
if (props.text.length === 0) {
|
|
52
51
|
return {
|
|
@@ -55,7 +54,7 @@ const renderText = (font, props) => {
|
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
56
|
// Get font cache for this font family
|
|
58
|
-
const fontData =
|
|
57
|
+
const fontData = SdfFontHandler.getFontData(props.fontFamily);
|
|
59
58
|
if (fontData === undefined) {
|
|
60
59
|
// Font not loaded, return empty result
|
|
61
60
|
return {
|
|
@@ -64,7 +63,7 @@ const renderText = (font, props) => {
|
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
65
|
// Calculate text layout and generate glyph data for caching
|
|
67
|
-
const layout = generateTextLayout(props,
|
|
66
|
+
const layout = generateTextLayout(props, fontData);
|
|
68
67
|
// For SDF renderer, ImageData is null since we render via WebGL
|
|
69
68
|
return {
|
|
70
69
|
remainingLines: 0,
|
|
@@ -142,12 +141,12 @@ const addQuads = (layout) => {
|
|
|
142
141
|
* Create and submit WebGL render operations for SDF text
|
|
143
142
|
* This is called from CoreTextNode during rendering to add SDF text to the render pipeline
|
|
144
143
|
*/
|
|
145
|
-
const renderQuads = (renderer,
|
|
144
|
+
const renderQuads = (renderer, layout, vertexBuffer, renderProps) => {
|
|
146
145
|
const fontFamily = renderProps.fontFamily;
|
|
147
146
|
const color = renderProps.color;
|
|
148
147
|
const worldAlpha = renderProps.worldAlpha;
|
|
149
148
|
const globalTransform = renderProps.globalTransform;
|
|
150
|
-
const atlasTexture =
|
|
149
|
+
const atlasTexture = SdfFontHandler.getAtlas(fontFamily);
|
|
151
150
|
if (atlasTexture === null) {
|
|
152
151
|
console.warn(`SDF atlas texture not found for font: ${fontFamily}`);
|
|
153
152
|
return;
|
|
@@ -206,13 +205,13 @@ const renderQuads = (renderer, font, layout, vertexBuffer, renderProps) => {
|
|
|
206
205
|
/**
|
|
207
206
|
* Generate complete text layout with glyph positioning for caching
|
|
208
207
|
*/
|
|
209
|
-
const generateTextLayout = (props,
|
|
208
|
+
const generateTextLayout = (props, fontCache) => {
|
|
210
209
|
const fontSize = props.fontSize;
|
|
211
210
|
const fontFamily = props.fontFamily;
|
|
212
211
|
const lineHeight = props.lineHeight;
|
|
213
|
-
const metrics =
|
|
212
|
+
const metrics = SdfFontHandler.getFontMetrics(fontFamily, fontSize);
|
|
214
213
|
const verticalAlign = props.verticalAlign;
|
|
215
|
-
const fontData =
|
|
214
|
+
const fontData = fontCache.data;
|
|
216
215
|
const commonFontData = fontData.common;
|
|
217
216
|
const designFontSize = fontData.info.size;
|
|
218
217
|
const atlasWidth = commonFontData.scaleW;
|
|
@@ -222,7 +221,7 @@ const generateTextLayout = (props, font) => {
|
|
|
222
221
|
const letterSpacing = props.letterSpacing / fontScale;
|
|
223
222
|
const maxWidth = props.maxWidth / fontScale;
|
|
224
223
|
const maxHeight = props.maxHeight;
|
|
225
|
-
const [lines, remainingLines, hasRemainingText, bareLineHeight, lineHeightPx, effectiveWidth, effectiveHeight,] = mapTextLayout(
|
|
224
|
+
const [lines, remainingLines, hasRemainingText, bareLineHeight, lineHeightPx, effectiveWidth, effectiveHeight,] = mapTextLayout(SdfFontHandler.measureText, metrics, props.text, props.textAlign, fontFamily, lineHeight, props.overflowSuffix, props.wordBreak, letterSpacing, props.maxLines, maxWidth, maxHeight);
|
|
226
225
|
const lineAmount = lines.length;
|
|
227
226
|
const glyphs = [];
|
|
228
227
|
let currentX = 0;
|
|
@@ -245,7 +244,7 @@ const generateTextLayout = (props, font) => {
|
|
|
245
244
|
continue;
|
|
246
245
|
}
|
|
247
246
|
// Get glyph data from font handler
|
|
248
|
-
const glyph =
|
|
247
|
+
const glyph = SdfFontHandler.getGlyph(fontFamily, codepoint);
|
|
249
248
|
if (glyph === null) {
|
|
250
249
|
continue;
|
|
251
250
|
}
|
|
@@ -253,7 +252,7 @@ const generateTextLayout = (props, font) => {
|
|
|
253
252
|
let advance = glyph.xadvance;
|
|
254
253
|
// Add kerning if there's a previous character
|
|
255
254
|
if (prevCodepoint !== 0) {
|
|
256
|
-
const kerning =
|
|
255
|
+
const kerning = SdfFontHandler.getKerning(fontFamily, prevCodepoint, codepoint);
|
|
257
256
|
advance += kerning;
|
|
258
257
|
}
|
|
259
258
|
// Calculate glyph position and atlas coordinates (in design units)
|
|
@@ -289,15 +288,12 @@ const generateTextLayout = (props, font) => {
|
|
|
289
288
|
fontFamily,
|
|
290
289
|
};
|
|
291
290
|
};
|
|
292
|
-
const createFont = (settings) => {
|
|
293
|
-
return new SdfFont(SdfTextRenderer, settings, stage);
|
|
294
|
-
};
|
|
295
291
|
/**
|
|
296
292
|
* SDF Text Renderer - implements TextRenderer interface
|
|
297
293
|
*/
|
|
298
294
|
const SdfTextRenderer = {
|
|
299
295
|
type,
|
|
300
|
-
|
|
296
|
+
font,
|
|
301
297
|
renderText,
|
|
302
298
|
addQuads,
|
|
303
299
|
renderQuads,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SdfTextRenderer.js","sourceRoot":"","sources":["../../../../src/core/text-rendering/SdfTextRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"SdfTextRenderer.js","sourceRoot":"","sources":["../../../../src/core/text-rendering/SdfTextRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAUH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,GAAG,EAAuB,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAGnF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,qCAAqC;AACrC,MAAM,IAAI,GAAG,KAAc,CAAC;AAE5B,IAAI,SAAS,GAA2B,IAAI,CAAC;AAE7C,mCAAmC;AACnC,MAAM,IAAI,GAAG,CAAC,KAAY,EAAQ,EAAE;IAClC,cAAc,CAAC,IAAI,EAAE,CAAC;IAEtB,8CAA8C;IAC9C,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK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CAAC,GAAG,WAAW;gBAC7B,UAAU,EAAE,KAAK,CAAC,KAAK,GAAG,UAAU;gBACpC,WAAW,EAAE,KAAK,CAAC,MAAM,GAAG,WAAW;aACxC,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEzB,yDAAyD;YACzD,QAAQ,IAAI,OAAO,GAAG,aAAa,CAAC;YACpC,aAAa,GAAG,SAAS,CAAC;QAC5B,CAAC;QACD,QAAQ,IAAI,YAAY,CAAC;IAC3B,CAAC;IAED,yDAAyD;IACzD,OAAO;QACL,MAAM;QACN,aAAa,EAAE,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa;QAC/D,KAAK,EAAE,cAAc,GAAG,SAAS;QACjC,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,SAAS;QACpB,UAAU,EAAE,YAAY;QACxB,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,19 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FontMetrics, NormalizedFontMetrics, TextLayoutStruct, TextLineStruct, WrappedLinesStruct } from './TextRenderer.js';
|
|
1
|
+
import type { FontMetrics, MeasureTextFn, NormalizedFontMetrics, TextLayoutStruct, TextLineStruct, WrappedLinesStruct } from './TextRenderer.js';
|
|
3
2
|
export declare const defaultFontMetrics: FontMetrics;
|
|
4
3
|
export declare const normalizeFontMetrics: (metrics: FontMetrics, fontSize: number) => NormalizedFontMetrics;
|
|
5
|
-
export declare const mapTextLayout: (
|
|
6
|
-
export declare const measureLines: (
|
|
7
|
-
export declare const wrapText: (
|
|
8
|
-
export declare const wrapLine: (
|
|
4
|
+
export declare const mapTextLayout: (measureText: MeasureTextFn, metrics: NormalizedFontMetrics, text: string, textAlign: string, fontFamily: string, lineHeight: number, overflowSuffix: string, wordBreak: string, letterSpacing: number, maxLines: number, maxWidth: number, maxHeight: number) => TextLayoutStruct;
|
|
5
|
+
export declare const measureLines: (measureText: MeasureTextFn, lines: string[], fontFamily: string, letterSpacing: number, maxLines: number) => WrappedLinesStruct;
|
|
6
|
+
export declare const wrapText: (measureText: MeasureTextFn, text: string, fontFamily: string, maxWidth: number, letterSpacing: number, overflowSuffix: string, wordBreak: string, maxLines: number) => WrappedLinesStruct;
|
|
7
|
+
export declare const wrapLine: (measureText: MeasureTextFn, line: string, fontFamily: string, maxWidth: number, letterSpacing: number, spaceWidth: number, overflowSuffix: string, overflowWidth: number, wordBreak: string, remainingLines: number) => WrappedLinesStruct;
|
|
9
8
|
/**
|
|
10
9
|
* Overflow wordBreak strategy, if a word partially fits add it to the line, start new line if necessary or add overflowSuffix.
|
|
11
10
|
*
|
|
12
11
|
* @remarks This strategy is similar to 'normal' in html/CSS. However
|
|
13
12
|
*/
|
|
14
|
-
export declare const overflow: (
|
|
15
|
-
export declare const breakWord: (
|
|
16
|
-
export declare const breakAll: (
|
|
17
|
-
export declare const truncateLineEnd: (
|
|
18
|
-
export declare const truncateWord: (
|
|
19
|
-
export declare const splitWord: (
|
|
13
|
+
export declare const overflow: (measureText: MeasureTextFn, word: string, wordWidth: number, fontFamily: string, letterSpacing: number, wrappedLines: TextLineStruct[], currentLine: string, currentLineWidth: number, remainingLines: number, remainingWord: string, maxWidth: number, space: string, spaceWidth: number, overflowSuffix: string, overflowWidth: number) => [string, number, string];
|
|
14
|
+
export declare const breakWord: (measureText: MeasureTextFn, word: string, wordWidth: number, fontFamily: string, letterSpacing: number, wrappedLines: TextLineStruct[], currentLine: string, currentLineWidth: number, remainingLines: number, remainingWord: string, maxWidth: number, space: string, spaceWidth: number, overflowSuffix: string, overflowWidth: number) => [string, number, string];
|
|
15
|
+
export declare const breakAll: (measureText: MeasureTextFn, word: string, wordWidth: number, fontFamily: string, letterSpacing: number, wrappedLines: TextLineStruct[], currentLine: string, currentLineWidth: number, remainingLines: number, remainingWord: string, maxWidth: number, space: string, spaceWidth: number, overflowSuffix: string, overflowWidth: number) => [string, number, string];
|
|
16
|
+
export declare const truncateLineEnd: (measureText: MeasureTextFn, fontFamily: string, letterSpacing: number, currentLine: string, currentLineWidth: number, remainingWord: string, maxWidth: number, overflowSuffix: string, overflowWidth: number) => [string, number, string];
|
|
17
|
+
export declare const truncateWord: (measureText: MeasureTextFn, word: string, wordWidth: number, maxWidth: number, fontFamily: string, letterSpacing: number, overflowSuffix: string, overflowWidth: number) => [string, string, number];
|
|
18
|
+
export declare const splitWord: (measureText: MeasureTextFn, word: string, wordWidth: number, maxWidth: number, fontFamily: string, letterSpacing: number) => [string, string, number];
|