bug 624359 - reftest for grapheme clusters in <canvas> mozTextAlongPath(). r=vlad

This commit is contained in:
Jonathan Kew 2011-03-22 11:05:19 -04:00
parent d7548946ee
commit f959c62628
3 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Bug 624359</title>
<style type="text/css">
@font-face {
font-family: test;
src: url(../fonts/sil/GenR102.ttf);
};
</style>
<script type="text/javascript">
function draw()
{
var txt = 'x';
var canvas = document.getElementById("foo");
var width = canvas.width;
var height = canvas.height;
var ctx = canvas.getContext('2d');
ctx.font = "150px test";
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, width, height);
ctx.save();
ctx.fillStyle = 'black';
ctx.beginPath();
ctx.translate(25, height / 2);
ctx.moveTo(0,0);
ctx.lineTo(40,0);
ctx.lineTo(40,200);
ctx.mozTextAlongPath(txt, false);
ctx.restore();
}
</script>
</head>
<body onload="draw();">
<div style="font-family: test;">Cluster in mozTextAlongPath:</div>
<canvas id="foo" width="100" height="500"></canvas>
</body>
</html>

View File

@ -0,0 +1,41 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Bug 624359</title>
<style type="text/css">
@font-face {
font-family: test;
src: url(../fonts/sil/GenR102.ttf);
};
</style>
<script type="text/javascript">
function draw()
{
/* if clusters are not handled properly, the diacritic will be placed
after the path turns a corner, and clipped from the canvas;
with correct cluster handling, it will appear above the "x" */
var txt = 'x' + String.fromCharCode(0x200c, 0x0308);
var canvas = document.getElementById("foo");
var width = canvas.width;
var height = canvas.height;
var ctx = canvas.getContext('2d');
ctx.font = "150px test";
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, width, height);
ctx.save();
ctx.fillStyle = 'black';
ctx.beginPath();
ctx.translate(25, height / 2);
ctx.moveTo(0,0);
ctx.lineTo(40,0); /* create a corner just beyond where "x" will be placed */
ctx.lineTo(40,200);
ctx.mozTextAlongPath(txt, false);
ctx.restore();
}
</script>
</head>
<body onload="draw();">
<div style="font-family: test;">Cluster in mozTextAlongPath:</div>
<canvas id="foo" width="100" height="500"></canvas>
</body>
</html>

View File

@ -1611,6 +1611,7 @@ fails-if(Android) HTTP(..) == 619511-1.html 619511-1-ref.html
random-if(winWidget) == 621918-1.svg 621918-1-ref.svg # 1-pixel diacritic positioning discrepancy in rotated text (may depend on platform fonts)
random-if(winWidget) HTTP(..) == 621918-2.svg 621918-2-ref.svg # same 1px issue as above, and HTTP(..) for filters.svg, used to mask antialiasing issues where glyphs touch
== 622585-1.html 622585-1-ref.html
HTTP(..) != 624359-1.html 624359-1-notref.html # http(..) for @font-face, to ensure consistent behavior
fails-if(Android) == 625409-1.html 625409-1-ref.html
== 627393-1.html about:blank
== 630835-1.html about:blank