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

Method initCanvas

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

* Initialize canvas state * 初始化画布状态

()

Source from the content-addressed store, hash-verified

206 * 初始化画布状态
207 */
208 private initCanvas(): void {
209 const ctx = this._ctx;
210
211 // Clear to transparent
212 ctx.clearRect(0, 0, this._atlasWidth, this._atlasHeight);
213
214 // Set font
215 ctx.font = `${this._fontSize}px "${this._fontFamily}"`;
216 ctx.textBaseline = 'top';
217 ctx.fillStyle = 'white';
218 }
219
220 /**
221 * Measure font metrics

Callers 2

constructorMethod · 0.95
clearMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected