Canvas context.fillText () vs context.strokeText ()

Is there a difference between context.fillText() and context.strokeText() , except that the first uses context.fillStyle , and later uses context.strokeStyle . For some reason, they did not add the context.textStyle property?

+6
source share
1 answer

Yep, strokeText actually draws outlines of letters, while fillText fills the inside of letters.

enter image description here

 ctx.fillStyle='red'; ctx.strokeStyle='green' ctx.lineWidth=3; ctx.font='90px verdana'; ctx.fillText('Q',50,150); ctx.strokeText('Q',125,150); ctx.fillText('Q',200,150); ctx.strokeText('Q',200,150); 
+12
source

Source: https://habr.com/ru/post/975205/


All Articles