[v2.0.2] SetFont throws error if space character first Topic is solved

Report problems with documented functionality
neogna2
Posts: 589
Joined: 15 Sep 2016, 15:44

[v2.0.2] SetFont throws error if space character first

Post by neogna2 » 20 Jan 2023, 09:11

[v2.0.2]
One tiny issue that tripped me up today is that SetFont throws error if the first parameter has a space character prefix

Code: Select all

G := Gui()
G.SetFont(" s12") ;errors on prefix space
G.SetFont("s12    norm     ") ;no error from inbetween or suffix spaces
G.Show("   w100 h100") ;no error from prefix space here
The doc at Gui.htm#SetFont says
Zero or more options. Each option is either a single letter immediately followed by a value, or a single word. To specify more than one option, include a space between each.
which neither explicitly allows that space nor disallows it. But throwing still seems too harsh here given that extra spaces inbetween and after options do not throw and prefix spaces do not throw in e.g. Show.

One use for padding with spaces is to visually align parts of lines in the code editor.
A simple workaround for that in this case is to pad before the quotes G.SetFont( "s12")


Post Reply

Return to “Bug Reports”