Как я могу выровнять текст на холсте html5 для выравнивания "? В приведенном ниже коде текст можно выровнять влево / вправо / по центру. Мне нужно установить align = "justify"
. Подскажите, пожалуйста, как это сделать?
HTML:
<body onload="callMe()">
<canvas id="MyCanvas"></canvas>
</body>
JS:
function callMe() {
var canvas = document.getElementById("MyCanvas");
var ctx = canvas.getContext("2d");
var txt = "Welcome to the new hello world example";
cxt.font = "10pt Arial";
cxt.textAlign = "left";
/* code to text wrap*/
cxt.fillText(txt, 10, 20);
}