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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access