Jump to content

Text2D delayed font loading


TMTH
 Share

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?

 

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

@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.

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...