Temp read failed on Font.fromName

Hi there. I’m trying to loading a FontFace by it’s name (eg. “Mulish”). However, I keep getting a warning, telling me “temp read failed” and that the Font failed to load.

I’ve tried PreloadAsync on an asset containing the FontFace - although, this probably wasn’t my brightest idea… since the font failed to load.

This is the code where I load the font:

local atomicButtonTitle = Instance.new("TextLabel");
atomicButtonTitle.Text = "";
atomicButtonTitle.FontFace = Font.fromName(currentTheme.fontFamily.base, currentTheme.fontWeight.regular);
atomicButtonTitle.TextSize = currentTheme.fontSize.base3;
atomicButtonTitle.AutomaticSize = Enum.AutomaticSize.XY;
atomicButtonTitle.Size = UDim2.new(0, 0, 0, 20);
atomicButtonTitle.LayoutOrder = 2;
atomicButtonTitle.TextXAlignment = Enum.TextXAlignment.Center;
atomicButtonTitle.BackgroundTransparency = 1;
atomicButtonTitle.TextColor3 = Color3.fromHex("#424242");
atomicButtonTitle.Parent = atomicButtonContentContainer;

wherein:

local currentTheme = {
    fontFamily = {
        base = "Mulish";
    },
    fontWeight = {
        regular = Enum.FontWeight.Regular;
    };
};

The specific warning I receive is:
Font family rbxasset://fonts/families/Mulish.json failed to load: Temp read failed.

Any ideas would be appreciated.

Font.fromName refers to built-in fonts provided by Roblox. The error occurs because “Mulish” is not within the list. Officially, there is no way to add custom fonts, but there are workarounds.

You can upload a sprite sheet of your desired font to Roblox and then use the ImageRectOffset and ImageRectSize properties to display each character individually, or you can convert those UI elements into text images using an image editing application, upload them as assets to Roblox, and then display them in your game using ImageLabels or ImageButtons.

This post might explain about the Spritesheet method a lot better.

1 Like

So, why can I can do Font.fromName on Montserrat? That’s not a built-in font iirc.

Nvm - after looking at the Fonts, I see Montserrat was put in place of the old Gotham. Thank you!