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

HTML5: Font failover to monospace?

Community Beginner ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

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);

Views

88

Translate

Translate

Report

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