jupyter-widgets-contrib / ipycanvas

Interactive Canvas in Jupyter
https://ipycanvas.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
686 stars 64 forks source link

Italic text not working #189

Closed enzotib closed 3 years ago

enzotib commented 3 years ago

Hi,

I am trying to build an image in which there is also some text. I need to write text in italic, I tried

canvas.font = '12px serif italic'

and also tried

canvas.font = 'font-family: "Times New Roman"; font-size: 12px; font-style: italic'

but I am not able to obtain italic.

enzotib commented 3 years ago

Just a second after posting the issue, I found that

canvas.font = 'italic 12px serif'

works. But why the position of the string 'italic' is important? It is so in CSS?

martinRenou commented 3 years ago

I was about to answer that :)

Yeah, I don't really know. I found some help here: https://stackoverflow.com/questions/5158222/how-do-i-style-html5-canvas-text-to-be-bold-and-or-italic

I don't even know if it has to be that way in CSS as well.