欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

HTML 5 canvas font 屬性

實例

在畫布上寫一段 40 像素的文本,使用的字體是 "Arial":

Your browser does not support the canvas tag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.font="40px Arial";
ctx.fillText("Hello World",10,50);

親自試一試

瀏覽器支持

Internet Explorer 9、Firefox、Opera、Chrome 以及 Safari 支持 fillStyle 屬性。

注釋:Internet Explorer 8 以及更早的版本不支持 <canvas> 元素。

定義和用法

font 屬性設置或返回畫布上文本內(nèi)容的當前字體屬性。

font 屬性使用的語法與 CSS font 屬性相同。

默認值: 10px sans-serif
JavaScript 語法: context.font="italic small-caps bold 12px arial";

屬性值

描述
font-style

規(guī)定字體樣式?赡艿闹担

  • normal
  • italic
  • oblique
font-variant

規(guī)定字體變體?赡艿闹担

  • normal
  • small-caps
font-weight

規(guī)定字體的粗細?赡艿闹担

  • normal
  • bold
  • bolder
  • lighter
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
font-size / line-height 規(guī)定字號和行高,以像素計。
font-family 規(guī)定字體系列。
caption 使用標題控件的字體(比如按鈕、下拉列表等)。
icon 使用用于標記圖標的字體。
menu 使用用于菜單中的字體(下拉列表和菜單列表)。
message-box 使用用于對話框中的字體。
small-caption 使用用于標記小型控件的字體。
status-bar 使用用于窗口狀態(tài)欄中的字體。