I’ve been trying out HaxeUI + OpenFL and ran into a Flash target font issue. I normally output to Flash or Neko even if my output is something else because it’s faster. Between the two, I usually choose Flash because I use an old Wacom tablet as my primary mouse (It runs on an outdated driver and on windows I run into click/drag recognition issues at times. These problems aren’t present on Flash so I target flash when I’m testing).
Anyway, I noticed that when targeting flash, the labels get slightly clipped.
I thought it was a default font issue between targets so I decided to test if the issue would persist if I changed the font and/or set the size. I tested html and neko targets, both worked fine, but failed in flash.
Honestly, its probably a bug on the haxeui site (haxeui-openfl specifically), i havent tested on flash in ages (maybe years!) - ill check it out.
Just to make sure, are you using git versions of haxeui-core and haxeui-openfl? Does the problem persist there? (It probably does since i havent done anything to fix anything like that, but just want to make sure)
Actually, I just tried testing fonts with OpenFL. Seems like it might be an OpenFL issue not a HaxeUI issue because the fonts still aren’t working with Flash but work fine with other targets. Not sure if I’m doing anything wrong:
var font = Assets.getFont ("fonts/COMIC.TTF");
var defaultFormat = new TextFormat (font.fontName, 20, 0x000000);
var txt = new TextField();
txt.text = "test";
txt.defaultTextFormat = defaultFormat;
addChild(txt);
My bad, disregard the previous post. Turns out I just needed to embed font for the TextField for it to work with Flash targets–I thought embedding in the project.xml was enough. It’s actually working fine in OpenFL:
var font = Assets.getFont ("fonts/COMIC.TTF");
var defaultFormat = new TextFormat (font.fontName, 20, 0x000000);
var txt = new TextField();
txt.defaultTextFormat = defaultFormat;
txt.embedFonts = true;
txt.text = "test";
addChild(txt);
Sorry for the confusion. It’s still not working, the text is just slightly less clipped compared to before, but not embedding fonts for Flash.
Flash Player:
Last Flash Player test after changes, less clipped, still not changing font:
My last two posts, I was just testing embedding fonts in OpenFL to see if it would work. My first test was unsuccessful (worked with other targets but not flash), so I thought it was an OpenFL issue not HaxeUI…But it turns out I simply missed the embed for the TextField, so it’s not an OpenFL issue.
I’ll look into it more, maybe the embed has something to do with the HaxeUI flash target font issue as well?