Geyser MiniConsole setFontSize Issue

Post Reply
Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Geyser MiniConsole setFontSize Issue

Post 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

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Geyser MiniConsole setFontSize Issue

Post 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

User avatar
Vadi
Posts: 4826
Joined: Sat Mar 14, 2009 3:13 pm

Re: Geyser MiniConsole setFontSize Issue

Post 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

Jor'Mox
Posts: 1101
Joined: Wed Apr 03, 2013 2:19 am

Re: Geyser MiniConsole setFontSize Issue

Post 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

User avatar
Vadi
Posts: 4826
Joined: Sat Mar 14, 2009 3:13 pm

Re: Geyser MiniConsole setFontSize Issue

Post 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.

Post Reply