@galacean/engine-core 0.0.0-experimental-1.4-small-language.1 → 0.0.0-experimental-1.4-small-language.3
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/main.js +5 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -1
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1562,7 +1562,7 @@ FontAtlas.textureSize = 256;
|
|
|
1562
1562
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
1563
1563
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
1564
1564
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
1565
|
-
var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, actualWidth = _context_measureText.width;
|
|
1565
|
+
var _context_measureText = context.measureText(measureString), actualBoundingBoxLeft = _context_measureText.actualBoundingBoxLeft, actualBoundingBoxRight = _context_measureText.actualBoundingBoxRight, fontBoundingBoxAscent = _context_measureText.fontBoundingBoxAscent, fontBoundingBoxDescent = _context_measureText.fontBoundingBoxDescent, actualWidth = _context_measureText.width;
|
|
1566
1566
|
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
1567
1567
|
// TODO: With testing, actualBoundingBoxLeft + actualBoundingBoxRight is the actual rendering width
|
|
1568
1568
|
// but the space rules between characters are unclear. Using actualBoundingBoxRight + Math.abs(actualBoundingBoxLeft) is the closest to the native effect.
|
|
@@ -1571,6 +1571,10 @@ FontAtlas.textureSize = 256;
|
|
|
1571
1571
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
1572
1572
|
var height = baseline * TextUtils._heightMultiplier;
|
|
1573
1573
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
1574
|
+
if (!this.useImageData) {
|
|
1575
|
+
height = Math.round(TextUtils._heightMultiplier * (fontBoundingBoxAscent + fontBoundingBoxDescent));
|
|
1576
|
+
baseline = Math.round(height / 4 + fontBoundingBoxAscent);
|
|
1577
|
+
}
|
|
1574
1578
|
var _extendHeight = TextUtils._extendHeight;
|
|
1575
1579
|
height += _extendHeight;
|
|
1576
1580
|
baseline += _extendHeight * 0.5;
|