diff --git a/loveframes/objects/button.lua b/loveframes/objects/button.lua index b3877a6..d0f94cc 100644 --- a/loveframes/objects/button.lua +++ b/loveframes/objects/button.lua @@ -196,6 +196,27 @@ function newobject:GetText() end +--[[--------------------------------------------------------- + - func: SetFont(font) + - desc: sets the object's font, nil uses the skin's default +--]]--------------------------------------------------------- +function newobject:SetFont(font) + + self.font = font + return self + +end + +--[[--------------------------------------------------------- + - func: GetFont() + - desc: gets the object's font +--]]--------------------------------------------------------- +function newobject:GetFont() + + return self.font + +end + --[[--------------------------------------------------------- - func: SetImage(image) - desc: adds an image to the object diff --git a/loveframes/objects/imagebutton.lua b/loveframes/objects/imagebutton.lua index 786c7a5..a034acd 100644 --- a/loveframes/objects/imagebutton.lua +++ b/loveframes/objects/imagebutton.lua @@ -190,6 +190,27 @@ function newobject:GetText() end +--[[--------------------------------------------------------- + - func: SetFont(font) + - desc: sets the object's font, nil uses the skin's default +--]]--------------------------------------------------------- +function newobject:SetFont(font) + + self.font = font + return self + +end + +--[[--------------------------------------------------------- + - func: GetFont() + - desc: gets the object's font +--]]--------------------------------------------------------- +function newobject:GetFont() + + return self.font + +end + --[[--------------------------------------------------------- - func: SetClickable(bool) - desc: sets whether the object can be clicked or not diff --git a/loveframes/skins/Blue/skin.lua b/loveframes/skins/Blue/skin.lua index 1f4e879..513682c 100644 --- a/loveframes/skins/Blue/skin.lua +++ b/loveframes/skins/Blue/skin.lua @@ -313,7 +313,7 @@ function skin.button(object) local height = object:GetHeight() local hover = object:GetHover() local text = object:GetText() - local font = skin.controls.button_text_font + local font = object:GetFont() or skin.controls.button_text_font local twidth = font:getWidth(object.text) local theight = font:getHeight(object.text) local down = object:GetDown() @@ -558,7 +558,7 @@ function skin.imagebutton(object) local image = object:GetImage() local imagecolor = object.imagecolor or {1, 1, 1, 1} local down = object.down - local font = skin.controls.imagebutton_text_font + local font = object:GetFont() or skin.controls.imagebutton_text_font local twidth = font:getWidth(object.text) local theight = font:getHeight(object.text) local textdowncolor = skin.controls.imagebutton_text_down_color diff --git a/loveframes/skins/Default/skin.lua b/loveframes/skins/Default/skin.lua index f897880..cf7daa3 100644 --- a/loveframes/skins/Default/skin.lua +++ b/loveframes/skins/Default/skin.lua @@ -172,7 +172,7 @@ function skin.button(object) local height = object:GetHeight() local hover = object:GetHover() local text = object:GetText() - local font = skin.controls.smallfont + local font = object:GetFont() or skin.controls.smallfont local twidth = font:getWidth(object.text) local theight = font:getHeight(object.text) local down = object:GetDown() @@ -344,7 +344,7 @@ function skin.imagebutton(object) local image = object:GetImage() local imagecolor = object.imagecolor or skin.controls.color_image local down = object.down - local font = skin.controls.imagebuttonfont + local font = object:GetFont() or skin.controls.imagebuttonfont local twidth = font:getWidth(object.text) local theight = font:getHeight(object.text) local checked = object.checked