A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(ui/text): correct glyph left-bearing sign (uneven spacing / overlap)
yhh861e608fa05e
diff --git a/sdk/src/ui/text/glyph-rasterizer.ts b/sdk/src/ui/text/glyph-rasterizer.tsindex 605585f9c..2a08d0e08 100644--- a/sdk/src/ui/text/glyph-rasterizer.ts+++ b/sdk/src/ui/text/glyph-rasterizer.ts@@ -120,8 +120,14 @@ export class CanvasGlyphRasterizer implements GlyphRasterizer {width: w,height: h,advance,- bearingX: left - pad, // bitmap left relative to the pen origin- bearingY: ascent + pad, // bitmap top above the baseline+ // The glyph is drawn at pen x = pad + left, so its ink left edge lands+ // at tile x = pad; mapping the pen origin back to the tile's left edge+ // (tile x = 0) is therefore -(left + pad). (The earlier `left - pad`+ // mirrored the left bearing, shifting each glyph by 2·left — visible as+ // uneven spacing / overlap, worst at small sizes where the browser+ // rounds actualBoundingBoxLeft to whole pixels.)+ bearingX: -(left + pad), // pen origin → bitmap left edge+ bearingY: ascent + pad, // bitmap top above the baseline};}}