types icon indicating copy to clipboard operation
types copied to clipboard

Font constructor's first argument is incorrect

Open znepb opened this issue 1 year ago • 2 comments

I tried to use new Font("Merriweather"), though that does not work, and displays "Temp read error" in the properties pane. Using Enum.Font.Merriweather works in-game, though it causes an error when type-checking.

znepb avatar Mar 20 '23 00:03 znepb

According to https://create.roblox.com/docs/reference/engine/datatypes/Font#new, passing a string to the .new constructor like that is not valid. I guess it's undocumented that passing an Enum works directly. I'd argue for consistency that it should still be encouraged to use the specific constructors.

Dionysusnu avatar Mar 20 '23 01:03 Dionysusnu

Like @Dionysusnu said, the new constructor should be used when you have a Content URI (e.g. rbxasset:// or rbxassetid://), if you want to construct from an Enum, you should use the .fromEnum() constructor, and if you would like to construct from a font name (you shouldn't usually need to do this), you should use the .fromName() constructor.

LouieK22 avatar May 31 '23 00:05 LouieK22

...this should be closed?

AdamRaichu avatar Jun 27 '24 00:06 AdamRaichu

...this should be closed?

Agreed

osyrisrblx avatar Jun 27 '24 02:06 osyrisrblx