Bold MS sansSerif font

BlitzMax Forums/BlitzMax Beginners Area/Bold MS sansSerif font

Kistjes(Posted 2007) [#1]
A Windows platform question.

There is no special bold version of the MS-SansSerif screen font (sserife.fon)
If I use the following code:
Global gMSplain14:TImageFont = LoadImageFont("c:\BlitzMax code\fonts\sserife.fon", 14, SMOOTHFONT)
Global gMSbold14:TImageFont = LoadImageFont("c:\BlitzMax code\fonts\sserife.fon", 14, BOLDFONT|SMOOTHFONT)

there is no difference in using gMSplain14 or gMSbold14.

What do I need to do to use DrawText with the bold version of MS-SansSerif?
Note: the screen font, NOT the TrueType version.


degac(Posted 2007) [#2]
Question: can you use .fon type file? Or in BlitzMax you can only load .ttf file font?


Kistjes(Posted 2007) [#3]
Yes, you can.
The gMSplain14 image font looks ok. But I can not figure out how to use the bold version. It's actually just writing each character twice with an horizontal offset of 1. But then you also have to shift each character 1 pixel to the right to retain a proper char-spacing.


Kistjes(Posted 2007) [#4]
Ok. I solved this by writing a special function for this.
I still think there must be another way. I tried to use a MaxGUI label but you cannot make the text background transparent, so that doesn't do the trick.

Function drawBoldText(s$, fx#, fy#)
	Local char$
	For Local c%= 0 Until Len(s)
		char = Chr(s[c])
		DrawText(char, fx, fy)
		fx:+1
		DrawText(char, fx, fy)
		fx:+ TextWidth(char)	
	Next
End Function