[MaxGUI] Canvas and fonts

BlitzMax Forums/BlitzMax Programming/[MaxGUI] Canvas and fonts

Suco-X(Posted 2005) [#1]
Hi
I have a small problem. I would like to load a font with "RequestFont" and set it to my canvas (DrawText).
My first idea:



No effects with this code.
If i use FontName and LoadImageFont, i canīt load every selected font from my "windows/fonts"+FontName()+".ttf" dir.
Any idea?
Thanks.
Mfg Suco


Hummelpups(Posted 2005) [#2]
Is there a problem loading the image font?
You cant set a gadget font to the canvas, because
ist has no guitexts in it.

I think this is pixel manipulation and will not
be saved as objects, more as a PixMap.
So you can' set Gadget fonts.

There's just one way I think. Load the imagefont
or use labels to represent texts.

EDIT: As the result, you can only set Fonts per RequestFont,
which returns a GUI font, to GUI Objects. Drawtext isnt
a GUI object i think.

Hope you understood by bad english, german friend ,D

IMurDOOM


Suco-X(Posted 2005) [#3]
In Bplus you can load a Reuqested font for a canvas with LoadFont and the data (FontName, FontSize) from the RequestedFont.
But in Bmax I canīt see a way to load an ImageFont by the Name (FontName, FontSize) of the requested Font.

Look at this

		Case EVENT_MOUSEDOWN
		
			Local TempFont:TGUiFont = RequestFont()
			
			If TempFont
				Local FontPath:String = "C:\WINDOWS\Fonts\"+FontName(TempFont)+".ttf"
				Local ImageFont:TImageFont = LoadImageFont(FontPath, FontSize(TempFont))
				Print "Font Path: "+FontPath
				If ImageFont
					Print "ImageFont loaded"
					SetImageFont ImageFont
				EndIf
				
			EndIf


Itīs a bad solution and he can find only the Arial font..

Mfg Suco


Hummelpups(Posted 2005) [#4]
Yes, i have the same problem, that should have
other reasons why it doesn't work (I think).

I hardcoded a few fonts and didn't got it to work.
With your solution, some fonts are working, others not.

As i said, guifonts for textareas and labels are nicely working.

Hmmmmmmmm,

IMurDOOM


morszeck(Posted 2005) [#5]
Is this a bug? That's a gread problem for me! And ImageFont isn't absolutely a solution...