Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

HTML5: Font failover to monospace?

Community Beginner ,
Jun 18, 2020 Jun 18, 2020

Hi there,

I'm using custom fonts, which I'm dynamically embedding, but I can't seem to force it to fall back to monospace on machines where the browser has been config'd to not allow font downloads? Anyone have any ideas for how to make this work? Am I just doing something stupid with my CSS?

 

Thanks in advance,

Eric.

 

Current font.js include script:

var styleNode           = document.createElement ("style");
styleNode.type          = "text/css";
styleNode.textContent   = "";
styleNode.textContent   = styleNode.textContent + "@font-face { font-family: 'Transponder AOE', monospace; src: url('./fonts/TRANA___.ttf'); }\n";
styleNode.textContent   = styleNode.textContent + "@font-face { font-family: 'Transponder Grid AOE', monospace; src: url('./fonts/TRANGA__.ttf'); }\n";
//console.log(styleNode.textContent);
document.head.appendChild (styleNode);
125
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation