<!DOCTYPE html>
<style>
canvas {
direction: rtl;
border: 1px solid;
}
</style>
<canvas id="canvas" width="500" height="300"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
ctx.font = '48px serif';
ctx.fillText('rab oof', 250, 50);
</script>