Page 1 of 1

Geyser MiniConsole setFontSize Issue

Posted: Wed May 01, 2013 3:22 pm
by Jor'Mox
Using the "setFontSize" function for any MiniConsole object created with Geyser stores that value in Geyser.Window.fontSize rather than in the object itself, a behavior not observed with other objects (labels and gauges tested). Here is an example function demonstrating what I'm talking about.
Code: [show] | [select all] lua
local test1 = Geyser.MiniConsole:new({name = "test1"})
local test2 = Geyser.MiniConsole:new({name = "test2"})
test1:setFontSize(8)
display(test1.fontSize) --> 8
display(Geyser.MiniConsole.fontSize) --> 8
display(Geyser.Window.fontSize) --> 8
display(Geyser.Container.fontSize) --> 8
test2:setFontSize(10)
display(test2.fontSize) --> 10
display(test1.fontSize) --> 10
display(Geyser.MiniConsole.fontSize) --> 10
display(Geyser.Window.fontSize) --> 10
display(Geyser.Container.fontSize) --> 8
Similarly, MiniConsole objects retrieve the value stored in Geyser.Window.fontSize when queried for their own fontSize value, as shown in this example.
Code: [show] | [select all] lua
local test1 = Geyser.MiniConsole:new({name = "test1"})
test1:setFontSize(8)
display(test1.fontSize) --> 8
Geyser.Window.fontSize = 10
display(test1.fontSize) --> 10
display(Geyser.MiniConsole.fontSize) --> 10
display(Geyser.Window.fontSize) --> 10
Cause appears to be modified version of setFontSize function which propagates fontSize to the parent of the MiniConsole in GeyserMiniConsole.lua, as seen here.
Code: [show] | [select all] lua
--- Sets the font size for this miniconsole.
-- @param size The font size.
function Geyser.MiniConsole:setFontSize(size)
   self.parent:setFontSize(size)
   setMiniConsoleFontSize(self.name, size)
end

Re: Geyser MiniConsole setFontSize Issue

Posted: Wed May 01, 2013 8:49 pm
by Jor'Mox
As a proof that my idea was correct, I changed the line in GeyserMiniConsole.lua from self.parent:setFontSize(size) to self.parent.setFontSize(self, size) and ran my initial example, using the exact same code. These were the results:
Code: [show] | [select all] lua
local test1 = Geyser.MiniConsole:new({name = "test1"})
local test2 = Geyser.MiniConsole:new({name = "test2"})
test1:setFontSize(8)
display(test1.fontSize) --> 8
display(Geyser.MiniConsole.fontSize) --> 8
display(Geyser.Window.fontSize) --> 8
display(Geyser.Container.fontSize) --> 8
test2:setFontSize(10)
display(test2.fontSize) --> 10
display(test1.fontSize) --> 8
display(Geyser.MiniConsole.fontSize) --> 8
display(Geyser.Window.fontSize) --> 8
display(Geyser.Container.fontSize) --> 8

Re: Geyser MiniConsole setFontSize Issue

Posted: Wed May 01, 2013 11:31 pm
by Vadi
Try setting it to be 9, 8 is the default font for them. Do you get this result?
Code: [show] | [select all] lua
local test1 = Geyser.MiniConsole:new({name = "test1"})
local test2 = Geyser.MiniConsole:new({name = "test2"})
test1:setFontSize(9)
display(test1.fontSize) -- 9
display(Geyser.MiniConsole.fontSize) -- 9
display(Geyser.Window.fontSize) -- 9
display(Geyser.Container.fontSize) --> 8
test2:setFontSize(10)
display(test2.fontSize) --> 10
display(test1.fontSize) --> 10 (problem!)
display(Geyser.MiniConsole.fontSize) --> 10
display(Geyser.Window.fontSize) --> 10
display(Geyser.Container.fontSize) --> 8

Re: Geyser MiniConsole setFontSize Issue

Posted: Wed May 01, 2013 11:43 pm
by Jor'Mox
These are the results that I get:
Code: [show] | [select all] lua
local test1 = Geyser.MiniConsole:new({name = "test1"})
local test2 = Geyser.MiniConsole:new({name = "test2"})
test1:setFontSize(9)
display(test1.fontSize) --> 9
display(Geyser.MiniConsole.fontSize) --> 8
display(Geyser.Window.fontSize) -- 8
display(Geyser.Container.fontSize) --> 8
test2:setFontSize(10)
display(test2.fontSize) --> 10
display(test1.fontSize) --> 9
display(Geyser.MiniConsole.fontSize) --> 8
display(Geyser.Window.fontSize) --> 8
display(Geyser.Container.fontSize) --> 8

Re: Geyser MiniConsole setFontSize Issue

Posted: Wed May 01, 2013 11:52 pm
by Vadi
You're right - I tested on an instance that didn't have this. Sorry! Thanks for the fix, I've put it in - it'll be in the next Mudlet update.