Check out example codes for "js canvas text font". It will help you in understanding the concepts better.

Code Example 1

    <link href="[email protected]&display=swap" rel="stylesheet">
    <p>to use external fonts you must have them linked to the dom</p>
    <canvas id="c" width="500" height="300"></canvas>
    var c = document.getElementById("c");
    var ctx = c.getContext("2d");
    ctx.font = "40px Roboto";//notice that behind the px comes the font family name
    ctx.fillText("hello world",40,40);

Learn ReactJs, React Native from