Reference » Window classes » MWindow » Font

Elgrint::MWindow::Font property

Declaration (see MWindow.h):

void setFont(const MFont& newVal); inline MFont getFont();


Specifies the default font for text drawing with drawText. Initial value is MFont("Arial",20,taDefault).

Return type: MFont


The Font property determines the default font characteristics (see MFont) for the drawText function.

The default font can be changed to any other using setDrawTextSettings, so the OnPaint can ignore the default setting altogether. However, when implementing OnPaint, it is recommended to use this property when drawing window's textual elements. Even if the window requires two kinds of texts, say of a different sizes, the default font can be used as a reference point.

If OnPaint adheres to the Font property, the window text can be customized from outside, simply by changing this property, without overloading the OnPaint handler. All Elgrint windows, that draw text, indeed rely on the specified Font property.

When changing the value of this property, the MSys::getFontNames function can be used to determine a valid font name for the MFont parameter. If the specified font name (or any other font attribute) is not supported, the setFont function automatically selects the most similar font available, if possible. Subsequent getFont can be used to determine the actual font set by setFont.


Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.