Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
How to use a fallback font with javascript canvas

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 :

enter image description here

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 ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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";
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda