Patrick, you can do this easily using fillRect as follows:
ctx.fillText("Hello World", 0, 0); var text = ctx.measureText("Hello World"); ctx.fillRect(xPos, yPos, text.width, 2);
The only difficult part of this approach is that there is no way to get a measurement of height use. Otherwise, you can use this as your Y coordinate when drawing a fillRect.
Your Y position will depend only on the height of your text and on how close you want to emphasize.
Garebear Jun 05 '15 at 19:32 2015-06-05 19:32
source share