C++ Question Changing font size

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
670
Reaction score
89
Points
43
Location
Happy Wherever
Just so I can go:facepalm:!!
Can someone enlighten me how we change the font size/characteristics please in something like:
Code:
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]char[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] buffer[150];[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]switch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (id) [/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]case[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] AID_TIME_LIGHTS:[/SIZE]
[SIZE=2]HDC hDC = oapiGetDC(surf);[/SIZE]
[SIZE=2]sprintf(buffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"%02.0f : %02.0f : %02.0f"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], SysTimeHour, SysTimeMinute, SysTimeSecond);[/SIZE]
[SIZE=2]SetBkMode (hDC, TRANSPARENT);[/SIZE]
[SIZE=2]SetTextColor (hDC, RGB(0, 196, 196));[/SIZE]
[SIZE=2]TextOut(hDC, 0, 0, buffer, strlen(buffer));[/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//0, 65,[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]oapiReleaseDC(surf, hDC);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
(Thanks JELAIR)

I've searched things like http://www.orbiter-forum.com/showthread.php?t=15810&highlight=HFONT+font but they're somewhat over my head.
Just a simple example would be great.

Thanks if you can put me out of my misery.
 
You need to first create a Font object using CreateFont(...). Then get your DC to select the Font using SelectObject(...). Then when you call TextOut(...) it will render the text with the specified font/size etc.

If you're using writing an MFD you shouldn't be using DCs anyway and should use the new TextOut(...) functions in MFD2.
 
Thanks Agentgonzo,

It's included in a .dll (I hope).
Got even less of an idea about sketchpad:rolleyes:
I'll give it a go.:cheers:
 
Back
Top