canvas 文字api

来源:互联网 发布:魔兽世界幻化软件 编辑:程序博客网 时间:2024/06/05 22:56

/**
* 文字的书写
* fillText(要写的文字, 文字开始的横坐标, 文字开始的纵坐标, 文字占用的最长宽度)
* strokeText(要写的文字, 文字开始的横坐标, 文字开始的纵坐标, 文字占用的最长宽度)
* font 字体大小和样式
*/

/* * font参数的值分为 * font-style: normal(正常), italic(斜体字), oblique(倾斜字体) 后两种在网页端一般没什么区别 * font-variant: normal(正常), small-caps(英文小写字母变成小的大写) * font-weight: normal(正常), bold(加粗) 100-900(一般不用) * font-size: 文字大小 * font-family: 字体样式 */cxt.font = "oblique small-caps bold 50px Arial";cxt.fillStyle = "blue";cxt.fillText("Hello Canvas!" ,100, 100, 200);cxt.strokeStyle = 'blue';    cxt.strokeText("Hello Canvas!", 100, 300, 200);
原创粉丝点击