Set a custom default MAXGUI font?

BlitzMax Forums/MaxGUI Module/Set a custom default MAXGUI font?

Grisu(Posted 2013) [#1]
Hi,

Is there a way to force MAXGUI to use a specific font for all gadgets of an app?

I currently have to set a font (in my case "fixed") for each label / listbox / treeview / combobox etc. in order to get proper results under Linux.

Example code:
?Non Linux
 SetGadgetFont( Label_about1, LookupGuiFont( GUIFONT_SYSTEM, 0, FONT_BOLD) )
?
?Linux
 SetGadgetFont( Label_about1, LoadGuiFont( "fixed" , 12, FONT_BOLD) )
?


There has to be an easier way for this. Like overwriting the broken system font at startup. - So all later gadgets will make use of the new font from now on. So I only would have to change the non-regular labels by hand.

Grisu


TomToad(Posted 2013) [#2]
Try this (no guarantees it won't create other problems)
SuperStrict

Import maxgui.drivers

?Win32
	Local font:TWindowsFont = TWindowsFont(LookupGuiFont( GUIFONT_SYSTEM, 0, FONT_BOLD))	
	TWindowsGUIDriver.GDIFont = Font
?Linux
	Local Font:TFLGuiFont = TFLGuiFont(LoadGuiFont("fixed" , 12, FONT_BOLD))
	TFLTKGuiDriver.fntDefault = Font
?

Global Window:TGadget = CreateWindow("Hello World!",100,100,300,200)
Global TextArea:TGadget = CreateTextArea(0,0,ClientWidth(Window),ClientHeight(Window)-50,Window)
Global Button:TGadget = CreateButton("Push Me",0,ClientHeight(Window)-40,ClientWidth(Window),30,Window)

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
			End
	End Select
Forever



Grisu(Posted 2013) [#3]
Thanks for the help! Your code seems to work except for comboboxes and treeviews.

After one week of fussing with BMX under Linux I still can't get the translations to work properly. The texts display fine with Gedit (UTF8 converted), but in the IDE or app they are faulty.

Most languages just miss some chars displayed by "?". The greek translation e.g. is totally broken.

Is there an Arial-like font that one can use under Linux to get around these issues? Or is it just a feature of the outdated MAXGUI Linux module / IDE.




Brucey(Posted 2013) [#4]
It looks like issues with FLTK and BlitzMax UTF-8 support.

Are you using the latest Linux MaxGUI source? (can't remember if skid had a fix for UTF-8 stuff somewhere).


Grisu(Posted 2013) [#5]
FLTKMaxui - ModuleInfo "Version: 1.59", don't know if this is the latest one though.


Grisu(Posted 2013) [#6]
Is there a possibility that the problem mentioned is a font related glitch only? I.e. the font doesn't support all characters needed?


Midimaster(Posted 2013) [#7]
How do the words get into the list? Do you load the textfile by yourself and convert it by LocalizeString()?

Did you already test to add a prefix at the path?

Stream=ReadFile ("utf8::" + Path + "Words.Txt")



Brucey(Posted 2013) [#8]
I'm pretty sure when we tried it with my QtMaxGUI module, there were no issues with the text in any of the controls on Linux?

(which leads me to point the finger at FLTK)


Grisu(Posted 2013) [#9]
@Midimaster:
With the added "uff8::" I get a "malformed line terminator" error.
Same as you described here: http://www.blitzbasic.com/Community/posts.php?topic=100148#1182918

@Brucey:
When you were testing it back then it worked out of the box, even without the need to change the file format. :/

|Edit|
For those who are crazy enough, get a test build here: http://pocketradio.awardspace.info/downloads.html ;)


Midimaster(Posted 2013) [#10]
Ah... that's why I asked whether you use the file for a TMaxGUILanguage or for a other stream. I got problems like yours in my own text files out of TMaxGUILanguage.


Grisu(Posted 2013) [#11]
I use plain text files and a basic ini system.