我有一个有空格的长字符串。我的源代码:
代码:
<canvas id="text_1" ></canvas>
<script src="jquery-1.9.1.js"></script>
<script type="text/javascript">
$('document').ready(function(){
var ctx= document.getElementById("text_1").getContext("2d");
ctx.canvas.width = 136;
ctx.canvas.height = 30;
ctx.font="10px Times New Roman";
ctx.fillText("PHAT TRIEN PHAN MEM HUONG DOI TUONG VA RAT NHIEU CHU RAT LA DAI O DANG SAU NUA",0,10);
ctx.textAlign = 'left';
ctx. textBaseline = 'left';
ctx.beginPath();
canvas_arrow(ctx,10,10,100,10);
});
</script>
运行时,我的画布显示如下:
-----------------------
| PHAT TRIEN PHAN | |
-----------------------
我需要看起来像
---------------------------
| PHAT TRIEN PHAN MEM |
| HUONG DOI TUONG VA |
| RAT NHIEU CHU RAT |
| LA DAI O DANG SAU NUA|
| |
---------------------------
请帮帮我!!!!!