HTML and CSS Reference
In-Depth Information
fontWeight = target.value;
drawScreen();
}
function fontStyleChanged(e) {
var target = e.target;
fontStyle = target.value;
drawScreen();
}
Setting the font in the drawScreen() function
Finally, in the drawScreen() function, we put all of this together to create a valid CSS
font string that we apply to the context.font property:
context.font = fontWeight + " " + fontStyle + " " + fontSize + "px " + fontFace;
Figures 3-3 and 3-4 show the results.
Figure 3-3. Setting the font size and face
 
Search WWH ::




Custom Search