Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

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

$
0
0

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...); }'

document.getElementsByTagName("head")[0].appendChild(stl);

 

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.


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>