JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="myCanvas" width="578" height="200"></canvas>

JavaScript

var canvas = document.getElementById('myCanvas');
var c = canvas.getContext('2d');

c.scale(3, 3);
c.fillText("this text is not clipped", 10, 10)

c.rect(25, 25, 50, 10);
c.clip();
c.fillText("this text is clipped", 10, 30)