File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/engine/Source/Core Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,13 @@ import Frozen from "./Frozen.js";
33import defined from "./defined.js" ;
44import DeveloperError from "./DeveloperError.js" ;
55
6+ /**
7+ * Computes dimensions for text, based on current canvas state.
8+ *
9+ * Rounds metrics, excluding width, to whole pixels. This is purely to minimize
10+ * rendering differences with migration to in-browser measureText(), and may be
11+ * revised in the future. See: github.com/CesiumGS/cesium/pull/13081
12+ */
613function measureText ( context2D , textString ) {
714 const metrics = context2D . measureText ( textString ) ;
815 const isSpace = ! / \S / . test ( textString ) ;
@@ -17,10 +24,6 @@ function measureText(context2D, textString) {
1724 } ;
1825 }
1926
20- // Round metrics, excluding width, to whole pixels. This is purely to minimize
21- // rendering differences with migration to in-browser measureText(), and may be
22- // revised in the future. See: github.com/CesiumGS/cesium/pull/13081
23-
2427 // Baseline alignment requires `height = ascent + descent`. Rounding (if any)
2528 // must be done before summing, or glyph pairs like "ij" may be misaligned.
2629 const ascent = Math . round ( metrics . actualBoundingBoxAscent ) ;
You can’t perform that action at this time.
0 commit comments