X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d94819c437fdf28c45e9f328e6c38fd1c639ddf..ed0dd9c1f0e9a79b5110d59b903a5f1fd9ee6c42:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index d5e40992c3..d9376ed756 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -2360,6 +2360,26 @@ bool wxTextCtrl::SetForegroundColour(const wxColour& colour) return true; } +bool wxTextCtrl::SetFont(const wxFont& font) +{ + if ( !wxTextCtrlBase::SetFont(font) ) + return false; + + if ( IsRich() ) + { + // Using WM_SETFONT doesn't work reliably with rich edit controls: as + // an example, if we set a fixed width font for a richedit 4.1 control, + // it's used for the ASCII characters but inserting any non-ASCII ones + // switches the font to a proportional one, whether it's done + // programmatically or not. So just use EM_SETCHARFORMAT for this too. + wxTextAttr attr; + attr.SetFont(font); + SetDefaultStyle(attr); + } + + return true; +} + // ---------------------------------------------------------------------------- // styling support for rich edit controls // ----------------------------------------------------------------------------