lineWidth(text, context) {
		if (this.ancestor instanceof Text) {
			return context.measureText(text).width;
		} else {
			// it's a BitmapText
			const characters = text.split("");
			const charactersLength = characters.length;
			let width = 0;
			let lastGlyph = null;
			for (let i = 0; i < charactersLength; i++) {
				const ch = characters[i].charCodeAt(0);
				const glyph = this.ancestor.fontData.glyphs[ch];
				if (typeof glyph !== "undefined") {
					const kerning =
						lastGlyph && lastGlyph.kerning ? lastGlyph.getKerning(ch) : 0;
					width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
					lastGlyph = glyph;
				}
			}
			return width;
		}
	}
Returns the width of the given segment of inline text in CSS pixels.
@param {string} text - the text to be measured
@param {CanvasRenderingContext2D} [context] - reference to an active 2d context for canvas rendering
@returns {number} the width of the given segment of inline text in CSS pixels.