Page 1 of 1

[2.0.55] Error when trying to extend a new FontPrototype

Posted: Thu Jun 19, 2025 2:32 pm
by cyx2020f

Code: Select all

data:extend {
    {
        type = "font",
        name = "console-alt",
        from = "default-mono",
        size = 18,
        border = true,
        filtered = false,
    },
    {
        type = "font",
        name = "debug-alt",
        from = "default",
        size = 18,
        border = true,
        filtered = false,
    },
    {
        type = "font",
        name = "debug-mono-alt",
        from = "default-mono",
        size = 18,
        border = true,
        filtered = false,
    },
    {
        type = "font",
        name = "infinite-alt",
        from = "default-bold",
        size = 22,
        border = true,
        filtered = false,
    },
    {
        type = "font",
        name = "item-count-alt",
        from = "default-bold",
        size = 13,
        border = true,
        filtered = true,
    },
    {
        type = "font",
        name = "default",
        from = "default",
        size = 14,
    },
}
Above is data-final-fixes.lua. Removing any alt in the name will result in the following error (for example console):

Error while loading font prototype "console" (font): Duplicate font with name: "console"

Also, all of the font names that will cause error does not respect the font path defined in info.json either.

Proposed fix:

1. Make them define in core.lua instead of some place in the game engine (As i couldn't find them in core)

2. Update the API Doc to mark these names as unusable.

Re: [2.0.55] Error when trying to extend a new FontPrototype

Posted: Sun Jun 22, 2025 9:47 pm
by boskid
It looks like those fonts were intentionally made hardcoded and not changeable by mods so the game can use them before mods are loaded, and to avoid mods messing with them.

I am not considering this to be a bug. Moving to documentation improvement requests.

Re: [2.0.55] Error when trying to extend a new FontPrototype

Posted: Tue Jun 24, 2025 2:37 am
by cyx2020f
boskid wrote: Sun Jun 22, 2025 9:47 pm It looks like those fonts were intentionally made hardcoded and not changeable by mods so the game can use them before mods are loaded, and to avoid mods messing with them.

I am not considering this to be a bug. Moving to documentation improvement requests.
Thanks a lot. I discovered another bug, that if you change the UI scale in interface settings, the above 5 fonts will inheritate the correct styles defined by the mods. Videos in the description (It's a Chinese font and I only declared them in zh-CN/info.json so the interfaces are chinese). Can you please make it an official feature?
2025-06-24 10-33-47.mp4
(32.02 MiB) Downloaded 28 times

Re: [2.0.55] Error when trying to extend a new FontPrototype

Posted: Tue Jun 24, 2025 2:46 am
by cyx2020f
cyx2020f wrote: Tue Jun 24, 2025 2:37 am
boskid wrote: Sun Jun 22, 2025 9:47 pm It looks like those fonts were intentionally made hardcoded and not changeable by mods so the game can use them before mods are loaded, and to avoid mods messing with them.

I am not considering this to be a bug. Moving to documentation improvement requests.
Thanks a lot. I discovered another bug, that if you change the UI scale in interface settings, the above 5 fonts will inheritate the correct styles defined by the mods. Videos in the description (It's a Chinese font and I only declared them in zh-CN/info.json so the interfaces are chinese). Can you please make it an official feature?

2025-06-24 10-33-47.mp4
This is a slightly different problem. I made a separate bug report.