12.5 Formatting Text

In using fillText and strokeText, there are lots of ways to customize the drawn text. Before calling either method, you can assign values to the linewidth, fillStyle, and strokeStyle properties. They have the same effect on text as they do on rectangles. The lineWidth property specifies the width in pixels of the border lines for text characters. The fillStyle and strokeStyle properties specify the color for text characters’ interiors and border lines, respectively. To further customize your text drawings, you can assign values to the font, textAlign, and textBaseline properties. As with the context object’s other formatting properties, each of these additional properties specifies the format for all subsequent drawn ...

Get Web Programming with HTML5, CSS, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.