Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda