Change text font dynamically by network

good morning, can anyone think of a way to load an external font directly into a playcanvas project? like in google fonts example
@import url(‘https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap’);
but that works with playcanvas entities not with html, thanks in advance

Hi @isvaku,

It won’t be straightforward to load remote ttf/otf font files, since they need to be processed first (texture maps generated). If you do that process before hand and host them in your server, I think this post can help then:

1 Like

thank you for your reply

1 Like

Check out this thread and the project from @RyutoHaga.

3 Likes

thanks for the answer, I’ll keep an eye on it in case I have the same problem as in this thread.

You can use the private class CanvasFont which allows you to generate a texture font from a font file: https://playcanvas.github.io/#/user-interface/text-emojis

Example editor project here: https://playcanvas.com/project/702920/overview/canvas-font-example

2 Likes

I have been researching and have found a solution to my problem, so that playcanvas will recognise all characters regardless of the font and without the need to add locally or remotely other fonts PlayCanvas 3D HTML5 Game Engine

2 Likes

thanks for that link kulodo133 that’s just what I was looking for

2 Likes

:star_struck:

1 Like