textWidth = (text, mod) => {
      if (text === undefined) return 0;

      // TODO: This can be done more efficiently with caching
      // This will set the ctx.font correctly, depending on selected/hover and mod - so that ctx.measureText() will be accurate.
      const values = this.parent.getFormattingValues(ctx, selected, hover, mod);

      let width = 0;
      if (text !== "") {
        const measure = this.ctx.measureText(text);
        width = measure.width;
      }

      return { width, values: values };
    }
Callback to determine text width; passed to LabelAccumulator instance
@param  {string} text string to determine width of
@param  {string} mod  font type to use for this text
@returns {object} { width, values} width in pixels and font attributes