November 2011
Intermediate to advanced
384 pages
13h 23m
English
Drawing canvas text combines the capabilities of CSS fonts with the fill and stroke procedures described earlier in this chapter. Essentially, your font is defined using the same syntax as the CSS font property; this includes the ability to take advantage of @font-face, new in CSS3 and described in Chapter 4, “Styling with CSS3.” The text itself creates a path that can either be filled or stroked.
Start by specifying the font the text will be drawn as:
context.font = 'font-style font-variant font-weight font-size font-family';
All font values are order specific, although not all are required. At a minimum, you must specify font-size and font-family values to properly set a canvas font. All values use the same syntax ...
Read now
Unlock full access