add gs
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
local baseSize = 16
|
||||
-- Nominal size conversion
|
||||
-- https://confluence.rbx.com/display/PX/Font+Metrics
|
||||
local nominalSizeFactor = 1.2
|
||||
local font = {
|
||||
BaseSize = baseSize * nominalSizeFactor,
|
||||
Title = {
|
||||
Font = Enum.Font.GothamBlack,
|
||||
RelativeSize = 32 / baseSize,
|
||||
RelativeMinSize = 24 / baseSize,
|
||||
},
|
||||
Header1 = {
|
||||
Font = Enum.Font.GothamSemibold,
|
||||
RelativeSize = 20 / baseSize,
|
||||
RelativeMinSize = 16 / baseSize,
|
||||
},
|
||||
Header2 = {
|
||||
Font = Enum.Font.GothamSemibold,
|
||||
RelativeSize = 16 / baseSize,
|
||||
RelativeMinSize = 12 / baseSize,
|
||||
},
|
||||
SubHeader1 = {
|
||||
Font = Enum.Font.GothamSemibold,
|
||||
RelativeSize = 16 / baseSize,
|
||||
RelativeMinSize = 12 / baseSize,
|
||||
},
|
||||
Body = {
|
||||
Font = Enum.Font.Gotham,
|
||||
RelativeSize = 16 / baseSize,
|
||||
RelativeMinSize = 12 / baseSize,
|
||||
},
|
||||
CaptionHeader = {
|
||||
Font = Enum.Font.GothamSemibold,
|
||||
RelativeSize = 12 / baseSize,
|
||||
RelativeMinSize = 9 / baseSize,
|
||||
},
|
||||
CaptionSubHeader = {
|
||||
Font = Enum.Font.GothamSemibold,
|
||||
RelativeSize = 12 / baseSize,
|
||||
RelativeMinSize = 9 / baseSize,
|
||||
},
|
||||
CaptionBody = {
|
||||
Font = Enum.Font.Gotham,
|
||||
RelativeSize = 12 / baseSize,
|
||||
RelativeMinSize = 9 / baseSize,
|
||||
},
|
||||
Footer = {
|
||||
Font = Enum.Font.GothamSemibold,
|
||||
RelativeSize = 10 / baseSize,
|
||||
RelativeMinSize = 8 / baseSize,
|
||||
},
|
||||
}
|
||||
|
||||
return font
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
return function()
|
||||
it("should be valid font palette without errors", function()
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
local UIBlox = require(CorePackages.UIBlox)
|
||||
local validateFont = UIBlox.Style.Validator.validateFont
|
||||
local Gotham = require(script.Parent.Gotham)
|
||||
assert(validateFont(Gotham))
|
||||
end)
|
||||
end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
local ArgCheck = require(CorePackages.ArgCheck)
|
||||
local Logging = require(CorePackages.Logging)
|
||||
local UIBlox = require(CorePackages.UIBlox)
|
||||
local validateFont = UIBlox.Style.Validator.validateFont
|
||||
|
||||
return function (fontName, defaultFont, fontMap)
|
||||
local mappedFont
|
||||
if fontName ~= nil and #fontName > 0 then
|
||||
mappedFont = fontMap[string.lower(fontName)]
|
||||
end
|
||||
|
||||
if mappedFont == nil then
|
||||
mappedFont = fontMap[defaultFont]
|
||||
Logging.warn(string.format("Unrecognized font name: `%s`", tostring(fontName)))
|
||||
end
|
||||
|
||||
ArgCheck.assert(validateFont(mappedFont))
|
||||
return mappedFont
|
||||
end
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
return function()
|
||||
local getFontFromName = require(script.Parent.getFontFromName)
|
||||
local Constants = require(script.Parent.Parent.Constants)
|
||||
it("should be able to get a font palette without errors", function()
|
||||
local fontMap = {
|
||||
[Constants.FontName.Gotham] = require(script.Parent.Gotham),
|
||||
}
|
||||
local fontTable = getFontFromName(Constants.FontName.Gotham, Constants.FontName.Gotham, fontMap)
|
||||
expect(fontTable).to.be.a("table")
|
||||
end)
|
||||
|
||||
it("should be able to get a font palette using default without errors", function()
|
||||
local fontMap = {
|
||||
[Constants.FontName.Gotham] = require(script.Parent.Gotham),
|
||||
}
|
||||
local fontTable = getFontFromName("sourceSans", Constants.FontName.Gotham, fontMap)
|
||||
expect(fontTable).to.be.a("table")
|
||||
end)
|
||||
|
||||
it("should throw the font palette is invalid", function()
|
||||
expect(function()
|
||||
local fontMap = {
|
||||
[Constants.FontName.Gotham] = {
|
||||
Font = {
|
||||
Font = Enum.Font.Gotham,
|
||||
RelativeSize = 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
getFontFromName(Constants.FontName.Gotham, Constants.FontName.Gotham, fontMap)
|
||||
end).to.throw()
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user