Skip to content

Tag: typography

How do I style HTML5 canvas text to be bold and/or italic?

I’m printing text to a canvas in a pretty straight forward way: But how can I change the text to bold, italic or both? Any suggestions to fix that simple example? Answer From the MDN documentation on CanvasRenderingContext2D.font: The CanvasRenderingContext2D.font property of the Canvas 2D API specifies the current text style to use when drawing text. This string uses the