ctx.fillTex
ctx.strokeText
przy określeniu opcjonalnej maksymalnej szerokości mniejszej niż zajmowana przez tekst przy skalowaniu,literka s jest wyświetlana nieprawidłowo.
- Kod: Zaznacz cały
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
window.onload=createcnv
function createcnv(){
wdth=window.innerWidth
hght=window.innerHeight
cnv=document.createElement("canvas")
cnv.width=wdth
cnv.height=hght
document.body.appendChild(cnv)
cnv.style.margin=-8
ctx=cnv.getContext("2d")
draw()
}
function draw(){
ctx.fillStyle="lightblue"
ctx.fillRect(0,0,wdth,hght)
ctx.fillStyle="green"
ctx.mozTextStyle = "56pt bold ";
ctx.fillText("A Ą B C Ć D E Ę F G H I J K L Ł M N Ń O Ó P R S Ś T U W X Y Z Ź Ż",0,100,400)
ctx.fillStyle="green"
ctx.fillText("a ą b c ć d e ę f g h i j k l ł m n o ó p r s ś t u w x y z ż ź ",0,200,400)
ctx.strokeStyle="green"
ctx.strokeText("A Ą B C Ć D E Ę F G H I J K L Ł M N Ń O Ó P R S Ś T U W X Y Z Ź Ż",0,300,400)
ctx.strokeStyle="green"
ctx.strokeText("a ą b c ć d e ę f g h i j k l ł m n o ó p r s ś t u w x y z ż ź ",0,400,400)
}
</script>
</head>
<body>
</body>
</html>
http://canvas.freehost.pl/test/test1.html