intrigus/gdx-freetype-gwt

freetype.js loads infinity

SimonIT opened this issue · 9 comments

I included this lib like your instructions in the readme.
You can see in the screenshot, that freetype.js loads infinity.
CollapseTheGame - Google Chrome 06 12 2019 22_14_12

I'm using libgdx version 1.9.11-SNAPSHOT. I load my ttf via the asset manager like here described in the wiki. If you want, I can invite you to the project

Please invite me to the project :)

Done

Hmm, I see nothing obvious wrong in your project setup.
Looking at my source I also found nothing that is obviously wrong.

Can you get a "stack traces" of the resource loading part?
I.e. which code is triggering the loading?

My guess would be that some new (security) feature maybe doesn't allow injecting Javascript in certain cases?
The code I'm using for injection is also not my code, but GWT code:
https://github.com/intrigus/gdx-freetype-gwt/blob/master/src/com/badlogic/gdx/graphics/g2d/freetype/gwt/FreetypeInjector.java#L40

I'm not sure when I'll have time to look at the problem myself. Maybe after Christmas.

The injection seem to work:
image

I don't know how to print a stacktrace if there is no exception.
It seems that onModuleLoad in my own HTML Launcher gets everytime called.
I fixed it by replacing FreetypeInjector.inject(HtmlLauncher.super::onModuleLoad); with FreetypeInjector.inject(super::onModuleLoad);.

Could you please try whether the official method works?
I.e. using no Lambdas?

Because I'm not sure whether there should be any difference between HtmlLauncher.super::onModuleLoad and super::onModuleLoad.
I'd assumed that they would work the same way.

@Override
public void onModuleLoad () {
	FreetypeInjector.inject(new OnCompletion() {
		public void run () {
			// Replace HtmlLauncher with the class name
			// If your class is called FooBar.java than the line should be FooBar.super.onModuleLoad();
			HtmlLauncher.super.onModuleLoad();
		}
	});
}

Your code without lambda works fine. I thought the two statements are the same, too. It was IntelliJ which made the lambda expression.

@SimonIT I guess this can be closed, right?

Yes, you reopened it :)

Whoops ^^