Embed fonts not working for HTML5 target

Hi! I have some difficulties having embed fonts working for HTML5 target. Hash is correctly created. I looked into the app js everything seems ok but fonts are never applied (I tried with many different ones and from two differents os, Mac OS X 10.6, M…

Viewing 1 to 7 (7 Total)
Embed fonts not working for HTML5 target

mike

mike
Total Posts: 7
Joined: January 25, 2012

Hi!

I have some difficulties having embed fonts working for HTML5 target. Hash is correctly created. I looked into the app js everything seems ok but fonts are never applied (I tried with many different ones and from two differents os, Mac OS X 10.6, Mac OS X 10.7). Any clue ?

Thanks & congrats for the great work on NME!

You can access dummy sample here:
http://www.deja-vue.net/files/TextFieldsNME/bin/...

You can download FDT5 export project here:
http://www.deja-vue.net/files/TextFieldsNME.zip...

Tags:
Attachments: TextFieldsNME.zip
Posted on March 20, 2012 at 4:00 AM

grumpytoad

grumpytoad
Total Posts: 63
Joined: November 21, 2011

Re: Embed fonts not working for HTML5 target

just looking at the debugger and calling haxe.Resouce.listNames(), I cannot see that the font is embedded into the js output file at all, so it must be a problem with calling hxswfml or the nmml file.

Posted on March 20, 2012 at 3:40 PM

mike

mike
Total Posts: 7
Joined: January 25, 2012

Re: Embed fonts not working for HTML5 target

This is working for flash/mac... target but not html5

var font = Assets.getFont ("Aubrey.ttf");
var format = new TextFormat (font.fontName, 24, 0xFF0000);

<assets>
<font id="Aubrey.ttf" name="assets/Aubrey.ttf" />
</assets>



Make it simple, could you send me a working example/ nmml configuration ? Thanks!

Posted on March 21, 2012 at 2:24 AM

mike

mike
Total Posts: 7
Joined: January 25, 2012

Re: Embed fonts not working for HTML5 target

Really, nobody ?

Posted on March 22, 2012 at 1:30 AM

grumpytoad

grumpytoad
Total Posts: 63
Joined: November 21, 2011

Re: Embed fonts not working for HTML5 target

This seems to be a problem with NME build tool, which does not add the asset hash to anything in jeash, so jeash doesn't know how to bootstrap the font. Adding this line somewhere in your code will help:

untyped {
jeash.text.Font.jeashFontData["NME_assets__aubrey_ttf"] = ApplicationMain.urlLoaders.get("assets/_Aubrey.ttf.hash").data
}

FYI the officially supported method for adding fonts in jeash is still through the -resource flag of the haxe compiler.

Posted on March 22, 2012 at 4:50 AM

grumpytoad

grumpytoad
Total Posts: 63
Joined: November 21, 2011

Re: Embed fonts not working for HTML5 target

The link for that is

http://haxe.org/com/libs/jeash/embedfont...

Posted on March 22, 2012 at 6:53 AM

mike

mike
Total Posts: 7
Joined: January 25, 2012

Re: Embed fonts not working for HTML5 target

Thanks, I'll give it a try asap.

Meanwhile as it "seems to be a problem with NME build tool ", i guess there is a need to fill out a bug report.

Posted on March 23, 2012 at 3:34 AM