Try using the font name (“Prototype”) or Assets.getFont ("prototype_font").fontName
Ok you are right, using “Prototype” as a font name, this works… (both on android with openfl next and windows with openfl legacy)
How can i change the name of an asset then? (In my haxeflixel projects, I have fonts with strange names or sometimes I just want to chnage a font without having to change its name everywhere it occurs in my code. So I make intensive use of the <font path="fonts/realname.ttf" id="myname" />
tag in my project.xml file…
And what is strange is that, on android, when the asset font is not found, it looks like it fall back to a default font with word wrap issue whereas on windows with legacy it simply do not display the text… Would be good that in both cases, it fall back to a default font without display issues (like on windows with openfl next)
On my device, it falls back to nothing. I guess the default font name used doesn’t exist on this device?
Using an asset ID works with openfl.Assets
, so getFont (id).fontName
should work if you want to use this
Tested with
var format:TextFormat = new TextFormat(Assets.getFont("prototype_font").fontName, 26, 0x000000);
and that do not work (still have the word wrap issue on android). The only way to have it work correctly for now is by directly using the fontname (ie: new TextFormat("Prototype", 26, 0x000000)
) so the asset ID is not working