TMTH

Text2D delayed font loading

Recommended Posts

Sprite2D expects that underlying texture may not be loaded on sprite2d creation. It waits for texture to load, and everything is working fine.

But the same problem can arise with Text2D, when using custom font, embedded into css/html.  When Text2D object is created, it tries to create font texture, using supplied font parameter. But that font has to be loaded, and that is the process that takes time. So there is no font to use.

In Firefox it leads to rendering Text2D objects without any text at all, soft page refresh fixes it.

In Chrome one of the system fonts is used instead of required font. Soft page refresh doesn't not fix it, you have to recreate Text2D object.

@Nockawa, is there any work around for this?

UPD: One can use Bitmap font, that do know about loading time, and waits for underlying texture to load. But is that the only way to deal with the problem?

 

Share this post


Link to post
Share on other sites

you mean by using the bitmapFontTexture setting ? Yes I can remember now that I didn't use the same codeblock than Sprite2D to manage late texture loading.

I can fix it pretty quickly I think, as it's an issue I already solved. Here the Trello Card. I will ping you once I start working on the fix and when I'm finished.

Share this post


Link to post
Share on other sites

@TMTH I'm starting to work on your bugs, can you test the latest Preview Files and tell me if this issue is solved, as I have no PG to reproduce it, I can't test it myself.

If this attempt doesn't work, I think we will have to make a PG/Test Case in order to avoid a big ping-pong game of PR/Tests. Thanks

Share this post


Link to post
Share on other sites

@Nockawa, that's not actually a bug. BitmapFontTexture is working properly.

That was a question about using regular FontTexture "when using custom font, embedded into css/html ". So, when I have:

@font-face {
    font-family: AAA
}

 in my css, and refer to that AAA font in Text2D settings, font is not always loaded to the client when Text2D starts to render. So, text is rendered using some default browser substitute. The same thing can happen with ordinal html, but after loading the font browser usually re-renders text. And the question was - can we do something with it, or the only way to use custom font is to use bitmap font texture.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.