[2.0.55] Error when trying to extend a new FontPrototype

Place to report issues and suggest improvements to the API documentation.
cyx2020f
Inserter
Inserter
Posts: 25
Joined: Mon Feb 03, 2020 12:12 pm
Contact:

[2.0.55] Error when trying to extend a new FontPrototype

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4033
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post 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.
cyx2020f
Inserter
Inserter
Posts: 25
Joined: Mon Feb 03, 2020 12:12 pm
Contact:

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

Post 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 27 times
cyx2020f
Inserter
Inserter
Posts: 25
Joined: Mon Feb 03, 2020 12:12 pm
Contact:

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

Post 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.
Post Reply

Return to “Documentation Improvement Requests”