HTML and CSS Reference
Chapter 3. The HTML5 Canvas Text API
The HTML5 Canvas Text API allows developers to render text on an HTML page in ways
that were either tricky or next to impossible before its invention.
We are providing an in-depth analysis of the HTML5 Canvas Text API because it is one of
the most basic ways to interact with the canvas. However, that does not mean it was the first
Canvas API feature developed. In fact, for many browsers, it was one of the last parts imple-
There was a time in the recent past when HTML5 Canvas Text API support in browsers was
spotty at best. Back then, using modernizr.js to test for text support would have been a good
vas Text API in some way.
interdependencies of the HTML5 Canvas Text API. This application will display a single line
of text in an almost infinite number of ways. This is also a useful tool to see whether support
for text is common among web browsers. Later in this chapter, you will see that some text
features are incompatible when drawn on the canvas at the same time.