We would like to know how to change text font to italic 30px serif.
<!-- w w w. j av a 2 s . c o m-->
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var canvas = $("#myCanvas");
var context = canvas.get(0).getContext("2d");
var text = "Hello, World!"; // String of text to display
context.font = "italic 30px serif";// Change the size and font
context.fillText(text, 40, 40); // Draw the text
});
</script>
</head>
<body>
<canvas id="myCanvas" width="500" height="500">
<!-- Insert fallback content here -->
</canvas>
</body>
</html>
The code above is rendered as follows: