0.525.0.5250378

This commit is contained in:
Max
2022-05-06 14:37:23 -05:00
parent 5dc0e9f99c
commit b5e471a2bf
7 changed files with 64 additions and 20 deletions

View File

@ -303,24 +303,32 @@ function Format.SharedString(str: string): string
end
function Format.FontFace(font: Font): string
local family = string.format("%q", font.Family)
local args = { family }
local style = font.Style
local weight = font.Weight
if style ~= Enum.FontStyle.Normal then
table.insert(args, "FontStyle." .. style.Name)
local success, result = pcall(function ()
local family = string.format("%q", font.Family)
local args = { family }
local style = font.Style
local weight = font.Weight
if style ~= Enum.FontStyle.Normal then
table.insert(args, "FontStyle." .. style.Name)
end
if #args > 1 or weight ~= Enum.FontWeight.Regular then
table.insert(args, "FontWeight." .. weight.Name)
end
local fmt = "new FontFace(%s)"
local argStr = table.concat(args, ", ")
return fmt:format(argStr)
end)
if success then
return result
end
if #args > 1 or weight ~= Enum.FontWeight.Regular then
table.insert(args, "FontWeight." .. weight.Name)
end
local fmt = "new FontFace(%s)"
local argStr = table.concat(args, ", ")
return fmt:format(argStr)
return nil
end
return Format