O'Reilly logo

Web Programming with HTML5, CSS, and JavaScript by Dean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required