<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>text in canvas</title> </head> <body> <h1>text in canvas</h1> <canvas id="canvas1" width="1000" height="500" style="border:1px solid #d3d3d3;"></canvas> <script> var canvas = document.getElementById("canvas1") var context = canvas.getContext("2d") context.font = "30px Arial" var text = "Hello World \n ✂️ Copy and 📋 Paste Emoji 👍\n No apps required" var y = 50 var spacing = 30 context.fillText(text, 10, y) y += spacing*2 for(var line of text.split("\n")){ context.fillText(line, 10, y) y += spacing } </script> <script src="/web/show-source.js"></script> </body> </html>