When it comes to scaling text with CSS transform scale, for instance:
transform: scale(2, 4);
fontSize: 20px // Is including fontSize necessary?
I also have the task of displaying the same text on a canvas element.
function draw() {
const ctx = document.getElementById('canvas').getContext('2d');
ctx.font = '20px serif';
ctx.fillText('Hello world', 10, 50);
}
In the JavaScript function above, how should I go about scaling the text? I've set the font size as 20px
, but how would I apply the scale values of 2
and 4
?