canvas绘制文本
- fillText(text, x, y, [, maxWidth]); //在指定的(x, y)位置填充指定的文本,绘制的最大宽度是可选的,若设置了最大宽度,且字体实际宽度大于最大宽度,则字体会被压缩。
- strokeText(text, x, y, [, maxWidth]); //在指定的(x, y)位置绘制文本边框,绘制的最大宽度是可选的。
- font = value;//用来绘制文本样式,value值和css设置font值相同,默认值为"10px sans-serif"
- textAlign = value;//表示指定的(x, y)坐标和文字的相对位置,value的值为:start(默认)/end/left/right/center
- textBaseline = value; //基线对齐选项。value的值为:top/hanging/middle/alphabetic(默认)/ideographic/bottom
- direction = value; //文本方向。value的值为:ltr/rtl/inherit(默认),浏览器支持不是很好
<!DOCTYPE html>
<html>
<head>
<title>canvas</title>