Flash target - font change not working, works fine with other targets

Hello,

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.
ask-flash-clip

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.

Flash:
ask-flash-font

Neko:
ask-neko-font

HTML5:
ask-html-font

the label style:

.label{
		font-size:13;
		margin:0;
		padding:0;
		font-name: "fonts/DSEG14ModernMini-BoldItalic.ttf";
	}

the application.xml. I’ve tried both embed=“true” and without.

<assets path="assets/fonts" rename="fonts" embed="true" />

It’s a minor issue since I’m not targeting Flash as my final output, but I’d like to know what I’m doing wrong. Did I miss a step?

Hi,

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)

Cheers,
Ian

Thanks for the quick reply, ianharrigan!

On windows I’m on

  • haxe 4.0.2
  • openfl 8.9.6
  • haxeui-core 1.0.25
  • haxeui-openfl 1.0.7
  • hscript 2.4.0

I tried it on Debian 10 (Buster) as well, same versions except for haxe (3.3.0 from the official repo)

ask-flash-font-debian10

Looks slightly less clipped than the Windows counterpart, but still clipped, and fonts not working. I’ll try to test the git versions.

FYI, just tested the git versions:

  • haxeui-core 1.0.25 [git]
  • haxeui-openfl 1.0.7 [git]

Still the same, no luck. I’ll just use html for testing. Thanks!

1 Like

OK, cool - ill take a look at it though when i get a moment, its likely to be something pretty silly.

Can you try with the latest git haxeui-openfl? I havent test thoroughly at all, but hopefully its fixed / better.

Hi Ian. Just did a test now. Seems to have fixed the clipped labels, but still not changing the font for flash target.

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);

Flash:
openfl-font

Neko:
openfl-font-neko

I’m currently on OpenFL 8.9.6

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);

openfl-font-embed-flash

So everything is fine?

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:
haxeui-font-embed-still-not-fixed

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?

Can you share the full source (font, everything) or your test app?

Cheers,
Ian