Problems with custom font

Hi, I´m using a custom font and using all the legacy UI elements. It was working well but when I changed the font size :
Suddenly, the font were not displayed when I generated the web proyect, it can be saw in the editor but no in web.
Also, I have some errors :
image.png

Original Post on Discord

by user 632418299711324161

Hello there – I’m an AI powered assistant :robot: that might be able to help you with your question. Would you like me to try helping you?

How it works:
Reply to the messages of the bot that end with a thread_id to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.

Help requested: please wait a moment…

Here is what I found for you :brain: Discord

Hello DiegoEloko,

The issue with the custom font not displaying when you generate the web project could be related to the registration of the font family and variant in the FontLibrary or other settings defined for the Text component when changing the font size.

Make sure that the custom font is properly set up and registered. Below is the relevant section from the Needle Engine documentation (see the documentation):

export declare class Text extends Graphic implements IHasAlphaFactor, ICanvasEventReceiver {
    // ... other properties
    font?: string;
    fontStyle: FontStyle;
    // ... other properties
    /**
     * Update provided opts to have a proper fontDefinition : family+weight+style
     * Ensure Family and Variant are registered in FontLibrary
     *
     * @param opts
     * @param fontStyle
     * @private
     */
    private setFont;
    // ... other methods
}

It’s important to handle fontDefinition options correctly and ensure that the family name and variants you are using are known to the FontLibrary. Changes to the font size may also necessitate updates to overflow settings to ensure text is displayed as expected.

If you continue experiencing issues or have errors to share, providing specific error messages can help me provide a more accurate solution.

When changing the font or size, make sure you also update other necessary properties like alignment, overflow modes, and line spacing to ensure proper display on the web. If issues persist, check the browser’s console for any errors that could provide more insight into the problem.

1 messages left GPT 4
thread_oH6n2CyAI959XyzWmuCWIqdd
Thanks for your feedback!

I have the next warning :

UnityEngine.Canvas:SendWillRenderCanvases ()

for the font

by user 632418299711324161

It seems that I’m currently unable to access the specific details about font-related issues in the Needle Engine documentation.

The warning you’re encountering, “Font size and style overrides are only supported for dynamic fonts. Font ‘GOTHIC’ is not dynamic,” suggests that the font ‘GOTHIC’ you are using is not considered dynamic and therefore cannot be modified for size or style overrides.

To resolve this issue, you may need to switch to a font that is dynamic and supports size and style overrides, or consider using dynamic text elements within the Needle Engine that allow for these modifications.

If there are specific settings or approaches you’d like me to look into further, or if you need assistance with alternative font options, please let me know. Additionally, if there are other errors or issues you’d like help with, feel free to share those as well.

0 messages left GPT 3.5
thread_oH6n2CyAI959XyzWmuCWIqdd
Thanks for your feedback!

Which Unity/Needle version are you on?