I would like to know if I can detect if my actual font support all the characters of a string.
For exemple, we can see there that the unsupported characters are filled with Times New Roman, and the normal text is filled with the selected font :
But I would like to first put the whole text with the same font if one character is not supported, and too switch the font with Arial.
Any idea about how can I do it ?
ctx.font
uses the same syntax as CSS'sfont
shorthand (with the line-height param ignored), so you can specify the fallback fonts the same way as in CSS, i.e by adding multiple font-family values at the end:
ctx.font = "10px 'your font', Arial";