0 Replies Latest reply on Jan 24, 2013 10:57 PM by BitPoet

    Delay-load open-type font from data url in pure JS Air app


      I'm currently trying to adapt a JS project to run in Air that does some heavy (and dirty) iframe lifting to load OpenType fonts into the document and draws onto canvas using those.

      Somehow, this doesn't work in Air. I've toyed around with different possibilities, but I'm lost how to make this work.


      Shouldn't it be enough for a first try to add a css rule declaring the font-face with a data url like:


      var stl = document.createElement('style');

      stl.innerHTML = '@font-face: { font-family: 'my_font_1', src:url(data:font/opentype;base64,AAEAAAANAI...); }'



      then wait sufficiently for the font to be loaded and use it with new html elements or in drawing to the canvas?

      I'm really lost, as all the answers regarding fonts I could find refer to Flash or Flex development, while I'm using plain ol' html and js.


      I'm using Air 3.5 on Windows 7, if that has any influence.


      Thank you for any answers and reading tips.