Modifying the file font_renderer.js for UI elements

Hi! I would like to know if there is some way to edit correctly the file font_renderer.js to change the text input using something like:

FontRenderer.attributes.add('text', {
    type: 'asset',
    assetType: 'text'
});

Instead of:

FontRenderer.attributes.add('text', {
    type: 'string'
});

I do this question because I dnt know how modify exactly the script (vertex buffer, re-render the text, positions of characters, etc…)

Any help will be greatly appreciated.
Thanks for attention.

Yes you can edit it that way. You will need to subscribe to asset load/change events and update your UI text accordingly.
Refer to relevant tutorials: https://developer.playcanvas.com/en/tutorials/?tags=assets

Thanks for the answer, finally I have chosen to use Html/css to develop the elements of the User Interface. In this way I will use

<div class='text'></div>

instead several

FontRenderer.attributes.add('text', {
    type: 'string'
});

. And I think this way will resolve the issues that I had with anchors responsive adjustments, and will simplify the workflow using its attributes with css. Anyway thanks very much for the answer and for attention.

Kind regards, Onize.

I do prefer DOM (HTML5 + CSS3) as well for UI, it just works and gives you a lot of possibilities. Browsers been implementing stuff for UI for very long, trying to re-implement same stuff in WebGL is not an easy task.

1 Like