我在这里有一个画布,用户可以在其中输入自己的消息..并且可以更改字体,字体样式和大小。。所有人在Safari,Opera,Chrome和chrome中都可以正常工作,但是当涉及到Firefox时,它根本不起作用。简单地什么也不做,除非我禁用“可用时的用户硬件加速”,这就是斜体工作的时间。
顺便说一句,我使用(fonts.googleapis.com)使用来自Google的现有CSS。
我已经使用了.htaccess的技巧来解决问题,但仍然无法使用。
我该如何解决这个问题?
我试过了
var canvas = document.getElementById("check");
var ctx = canvas.getContext('2d');
ctx.font = "italic 40px Arial";
ctx.fillText("Impact", 0, 40);
小提琴
尝试更新
var userinputstr='';
var italic=0;
function draw(){
var canvas = document.getElementById("check");
var ctx = canvas.getContext('2d');
ctx.clearRect(0,0,300,50);
if(italic==0)
{
ctx.font = "40px Lato";
ctx.fillText(userinputstr, 0, 40);
}
else
{
ctx.font = "Italic 40px Lato";
ctx.fillText(userinputstr, 0, 40);
}
}
userinputstr=$("#userinput").val();
draw();
$("#userinput").keyup(function(){
userinputstr=$("#userinput").val();
draw();
});
$("#clickbut").click(function(){
italic=1;
draw();
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句