Loading Local Font File as a GUI Font
BlitzMax Forums/MaxGUI Module/Loading Local Font File as a GUI Font
| ||
I am trying to load a font file named "EditFont.fon" as a text area font in MaxGUI but I keep running into a problem: The font in the file is mono spaced, but when you type in the text area, it is not. Here's some of the code: Global EditFont:TGuiFont = New TGuiFont EditFont.Path = "./EditFont.fon" EditFont.Size = 12 SetTextAreaFont editArea, EditFont Why is the font not mono spaced in the text area? |
| ||
SetTextAreaFont is deprecated. You should be using SetGadgetFont. |
| ||
Even so, the problem still persists. |
| ||
MaxGUI doesn't support the specifying of a font by filename - it has to be installed onto the system (effectively copying into the Font folder), and then you can use LoadGuiFont(). Someone might have a neat way of tricking MaxGUI into using one, though. |
| ||
After installing the font into the Windows font folder and using LoadGuiFont() the font worked perfectly. What I can't understand is why when I use my above method of loading the font, it loads the correct styled characters, but they are spaced wrong. |
| ||
I think this is just a coincidence, i.e. if a Windows control is set a font handle that doesn't exist, it defaults to a rather retro looking one that is quite similar to the old BlitzCode font. E.g. does the following produce the same results? Global EditFont:TGuiFont = New TGuiFont SetTextAreaFont editArea, EditFont |
| ||
The win32 command AddFontResource should allow you to register a font file so it can then be loaded by name. |