I'm currently building a little experiment.
It's about having some sort of "emulator" written in C# that can run some "ROMs" that are programmed in HTML ( CSS, JS, .. ).
To build there ROMs, I've programmed a little "compiler" that is using my JS based game engine and it's editor to pack the game / application into a single file ( the "ROM" ) that is basically just an encrypted ( or plain ) JSON file that contains the full HTML code ( in one of its attributes ), except that linked files are directly written into it.
<script src="./script/main.js"></script>
will turn into:
<script> ...code... </script>
and the same with CSS.
Images will be turned into Base64 String
<img src="http://www.img.com/img.png"/>
becomes
<img src="data:image/png;base64, R0lGODlhmwD....."/>
My problem is, to include font files into the CSS or HTML file.
So maybe something like this
@font-face {
font-family: 'Open Sans';
src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v10/K88pR3goAWT7BTt32Z01m1tXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
}
becomes
@font-face {
font-family: 'Open Sans';
src: local('Open Sans'), local('OpenSans'), url( ...magic... ) format('woff2');
}
Does anybody know if this is possible, and if so, how I can implement that functionality ?
Thank you for your suggestions.
This should works:
Found here: http://blog.patdavid.net/2012/08/embedding-fonts-with-css-and-base64.html