<!DOCTYPE html><!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --><metacharset="UTF-8"><title>OffscreenCanvas test: 2d.text.draw.baseline.hanging</title><scriptsrc="/resources/testharness.js"></script><scriptsrc="/resources/testharnessreport.js"></script><scriptsrc="/html/canvas/resources/canvas-tests.js"></script><h1>2d.text.draw.baseline.hanging</h1><pclass="desc"></p><script>promise_test(asynct=>{varcanvas=newOffscreenCanvas(100,50);varctx=canvas.getContext('2d');varf=newFontFace("CanvasTest","url('/fonts/CanvasTest.ttf')");f.load();document.fonts.add(f);awaitdocument.fonts.ready;ctx.font='50px CanvasTest';ctx.fillStyle='#f00';ctx.fillRect(0,0,100,50);ctx.fillStyle='#0f0';ctx.textBaseline='hanging';ctx.fillText('CC',0,12.5);_assertPixelApprox(canvas,5,5,0,255,0,255,2);_assertPixelApprox(canvas,95,5,0,255,0,255,2);_assertPixelApprox(canvas,25,25,0,255,0,255,2);_assertPixelApprox(canvas,75,25,0,255,0,255,2);_assertPixelApprox(canvas,5,45,0,255,0,255,2);_assertPixelApprox(canvas,95,45,0,255,0,255,2);},"");</script>