Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/offscreen/text/2d.text.shape.fillGlyphRun-leading-spaces.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<link rel="match" href="2d.text.shape.fillGlyphRun-leading-spaces.tentative-expected.html">
<title>Canvas test: 2d.text.shape.fillGlyphRun-leading-spaces.tentative</title>
<h1>2d.text.shape.fillGlyphRun-leading-spaces.tentative</h1>
<p class="desc">Test that a glyph run starting with spaces, drawn at a negative x, renders its visible glyphs like fillText() instead of being clipped away.</p>
<canvas id="canvas" width="300" height="100">
<p class="fallback">FAIL (fallback content)</p>
</canvas>
<script>
const canvas = new OffscreenCanvas(300, 100);
const ctx = canvas.getContext('2d');
ctx.font = '24px sans-serif';
// The LTR run ends before the Hebrew word, so it holds only the leading
// spaces and 'A '.
const st = ctx.shapeText(' A אב');
ctx.fillGlyphRun(st.glyphRuns()[0], -40, 50);
const outputCanvas = document.getElementById("canvas");
outputCanvas.getContext('2d').drawImage(canvas, 0, 0);
</script>