MCPcopy Create free account
hub / github.com/esengine/esengine / requestCharacters

Method requestCharacters

packages/fairygui/src/text/DynamicFont.ts:249–271  ·  view source on GitHub ↗

* Request characters to be available in the atlas * 请求字符在图集中可用 * * Similar to Unity's Font.RequestCharactersInTexture

(text: string)

Source from the content-addressed store, hash-verified

247 * Similar to Unity's Font.RequestCharactersInTexture
248 */
249 public requestCharacters(text: string): void {
250 let hasNew = false;
251
252 for (let i = 0; i < text.length; i++) {
253 const charCode = text.charCodeAt(i);
254
255 // Skip if already cached
256 if (this._glyphs.has(charCode)) continue;
257
258 // Skip control characters
259 if (charCode < 32 && charCode !== 9 && charCode !== 10 && charCode !== 13) continue;
260
261 // Render the character
262 if (this.renderCharacter(charCode)) {
263 hasNew = true;
264 }
265 }
266
267 // Upload texture if needed
268 if (hasNew && this._onTextureUpload && this._dirtyRegion) {
269 this.uploadTexture();
270 }
271 }
272
273 /**
274 * Render a character to the atlas

Callers 2

constructorMethod · 0.95
getTextRenderDataMethod · 0.80

Calls 3

renderCharacterMethod · 0.95
uploadTextureMethod · 0.95
hasMethod · 0.65

Tested by

no test coverage detected