TextField displays question marks (html5, safari)

Hey, so I’m having a problem with fonts on Safari. For some reason all characters are displayed as question marks. There are no errors in the console. Once after refreshing maybe 20 times characters were displayed ok.
Fonts work well on other browsers.
Here is my code:

makeText(100, 100, TextFormatAlign.CENTER, 20, font("BrandonGrotesque-Bold.ttf"), false);
makeText(250, 300, TextFormatAlign.LEFT, 20, font("BrandonGrotesque-Regular.ttf"), true);
makeText(200, 500, TextFormatAlign.JUSTIFY, 20, font("BUDBP.ttf"), true);
makeText(120, 650, TextFormatAlign.RIGHT, 20, font("BUDBP.ttf"), false);

function makeText(X:Float, Y:Float, align, size:Int, ?font:String, ?embed:Bool=false)
{
       var textField = new TextField();
	textField.embedFonts = embed;
	textField.defaultTextFormat = new TextFormat(font, size, 0x000000, null, null, null, null, null, align, null, null, null, 20);

	textField.selectable = false;
	textField.border = true;
	textField.borderColor = 0x000000;

	textField.width = 700;
	textField.multiline = true;
	textField.wordWrap = true;

	textField.autoSize = TextFieldAutoSize.NONE;

	textField.x = X;
	textField.y = Y;

	textField.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut      labore et dolore magna aliqua.";

	addChild (textField);
	}
function font(str:String):String
{
	var f = Assets.getFont("assets/fonts/"+str);
	if (f != null)
		return f.fontName;
	return str;
}

AddingText sample doesnt work either (it works localy, but not on the target server, perhaps something isn’t loading fast enough? Adding textfields after delay doesn’t help)

edit: resizing textfield after some delay fixes it :slight_smile: if only I could know when the fonts are ready…

In your project.xml, try adding embed=“true” to the line that includes your font assets

Something like this:
<assets path="assets/font" embed="true" />

edit… or is it … preload=“true”

<assets path=“assets/fonts” embed=“true” preload=“true”/>

This didn’t help :frowning:

Try this: https://github.com/openfl/lime/commit/f37f279a6c3a9f41a13648ead8916b8e9fdcc3e7

1 Like

it worked :smiley: thanks a lot