Adding a font to the entire GUI

BlitzMax Forums/BlitzMax Beginners Area/Adding a font to the entire GUI

Marco A G Pinto(Posted 2013) [#1]
Hi again!

How do I change the font of the entire GUI?

I was searching in the help but all I found was a command to change the font of each gadget one at a time, meaning I would have to add one command per each.

Is there a simpler way (global font)?

Here is my source code:

	'open a window
	Global window:TGadget = CreateWindow( "Autómatos V1.2", 100, 100, 640+360+10, 480, Null, WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_CLIENTCOORDS|WINDOW_CENTER)
	SetMaxWindowSize(window:TGadget, 640+360+10, 480)
	SetMinWindowSize(window:TGadget, 640+360+10, 480)
	LoadGuiFont:TGuiFont("Verdana",13,bold=False,italic=False,underline=False,strikethrough=False)
	SetGadgetPixmap window:TGadget, image_appicon


Thanks!


jsp(Posted 2013) [#2]
No global command for this.
SetGadgetFont is only for single gadgets.

Although the idea is not bad I actually never used it for a whole form.
Also some gadgets can't be set with this, for example a window gadget.


col(Posted 2013) [#3]
Hiya,

I only know how to do this for Win32 :-

Local DefaultFontName$ = "Arial"
Local DefaultFontSize = 20

TWindowsGUIDriver(maxgui_driver).GDIFont = TWindowsFont(LoadGuiFont(DefaultFontName,DefaultFontSize))


I'm not sure it works ok with window titles though?
I'm sure the same technique could be used for the other platforms, no?


Marco A G Pinto(Posted 2013) [#4]
Hey hey!

Col!!!!!

It worked on my Windows version of BlitzMax!

Do you know for sure if it will work on Linux and Mac as well?

I am going to buy a new hdd and Windows 8 for my laptop soon and I want to create a virtual machine with Ubuntu and Mac, and try to compile there too.

Thanks!

Kind regards,
>Marco A.G.Pinto
--------------------


col(Posted 2013) [#5]
Hiya,

Quickly looking through the source it looks like the same technique will work as long as the castings are correct.

For Linux you may be able to use :-
TFLTKGUIDriver(maxgui_driver).fntDefault = TFLGuiFont(LoadGuiFont("Arial",20))


and for Mac :-
TCocoaMaxGUIDriver(maxgui_driver).CocoaGuiFont = TCocoaGuiFont(LoadGuiFont("Arial",20))


Like I say, I cant test them so its a complete shot in the dark. If someone could test them it would be a good small addition for MaxGUI.