@hpcc-js/common 2.71.12 → 2.71.14

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/index.es6.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { classID2Meta, hashSum, isArray } from '@hpcc-js/util';
2
2
 
3
3
  var PKG_NAME = "@hpcc-js/common";
4
- var PKG_VERSION = "2.71.12";
5
- var BUILD_VERSION = "2.104.30";
4
+ var PKG_VERSION = "2.71.14";
5
+ var BUILD_VERSION = "2.104.35";
6
6
 
7
7
  /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -7617,11 +7617,17 @@ function textSize(_text, fontName, fontSize, bold) {
7617
7617
  var hash = "".concat(bold, "::").concat(fontSize, "::").concat(fontName, "::").concat(text.join("::"));
7618
7618
  var retVal = g_fontSizeContextCache[hash];
7619
7619
  if (!retVal) {
7620
+ retVal = { width: 0, height: 0 };
7620
7621
  g_fontSizeContext.font = "".concat(bold ? "bold " : "").concat(fontSize, "px ").concat(fontName);
7621
- g_fontSizeContextCache[hash] = retVal = {
7622
- width: Math.max.apply(Math, text.map(function (t) { return g_fontSizeContext.measureText("" + t).width; })),
7623
- height: fontSize * text.length
7624
- };
7622
+ text.forEach(function (line) {
7623
+ var textMeasurement = g_fontSizeContext.measureText("" + line);
7624
+ var width = textMeasurement.width;
7625
+ var height = (textMeasurement.fontBoundingBoxDescent + textMeasurement.fontBoundingBoxAscent) * text.length;
7626
+ g_fontSizeContextCache[hash] = retVal = {
7627
+ width: width > retVal.width ? width : retVal.width,
7628
+ height: height > retVal.height ? height : retVal.height
7629
+ };
7630
+ });
7625
7631
  }
7626
7632
  return retVal;
7627
7633
  }
@@ -10571,7 +10577,7 @@ var Text = /** @class */ (function (_super) {
10571
10577
  var width = Math.max.apply(Math, widths);
10572
10578
  var retVal = {
10573
10579
  x: -width / 2,
10574
- y: -height / 2 - lineHeight / (this.fontFamily() === "FontAwesome" ? 4 : 6),
10580
+ y: -height / 2 - lineHeight / (this.fontFamily() === "FontAwesome" ? 4 : 6), // baseLine offset
10575
10581
  width: width,
10576
10582
  height: height
10577
10583
  };